Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

model/topos/SHypercubePosition.h

Go to the documentation of this file.
00001 /* #start# ***********************************************************
00002 
00003            Scheduling Simulator
00004         Lehrstuhl f"ur Effiziente Algorithmen
00005            Technische Universit"at M"unchen
00006 
00007  File    : $Id: SHypercubePosition.h,v 1.3 2003/01/08 18:57:14 meierb Exp $
00008 
00009  Purpose : 
00010 
00011  RCS-Log:
00012  $Log: SHypercubePosition.h,v $
00013  Revision 1.3  2003/01/08 18:57:14  meierb
00014  added randomized release times
00015 
00016  Revision 1.1.1.1  2002/12/02 22:26:19  meierb
00017  my_schedule
00018 
00019  Revision 1.1  2002/08/29 12:59:59  taeubig
00020  Added the sources
00021 
00022  Revision 1.1  2000/05/29 14:44:30  taeubig
00023  Moved topology related stuff into subdirectory topos
00024 
00025 
00026  * #end# ************************************************************* */
00027 
00028 #ifndef SHYPERCUBEPOSITION_H
00029 #define SHYPERCUBEPOSITION_H
00030 
00031 // system header files
00032 
00033 // project header files
00034 #include "SComplexPosition.h"
00035 #include "SDimArray.h"
00036 
00037 // ------------------------------------------------------------
00038 
00039 class SHypercubePosition: public SComplexPosition, public SDimArray {
00040  public:
00041   SHypercubePosition(int dim) : SDimArray(dim) {};
00042 
00043   // -1 means both, 0 OR 1
00044   virtual int getMinPos() const {
00045     int linearPos = 0;
00046     for (int i=size()-1; i>=0; i--) {
00047       linearPos *= 2;
00048       if ((*this)[i] == 1)
00049   linearPos += 1;
00050     }
00051     return linearPos;
00052   };
00053 
00054   int getMaxPos() const {
00055     int linearPos = 0;
00056     for (int i=size()-1; i>=0; i--) {
00057       linearPos *= 2;
00058       if ((*this)[i] != 0)
00059   linearPos += 1;
00060     }
00061     return linearPos;
00062   };
00063 
00064   bool isNormal() const {
00065     int i=0;
00066     while ( (i<size()) && ((*this)[i] == -1) ) i++;
00067     while ( i<size() )
00068       if ( (*this)[i] == -1 )
00069   return false;
00070       else
00071   i++;
00072     return true;
00073   }
00074 
00075 };
00076 
00077 #endif //SHYPERCUBEPOSITION_H

Generated on Thu May 22 16:48:09 2003 for Sketch-it! by doxygen1.2.18