Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

ColumnOffset.h

Go to the documentation of this file.
00001 #include "ColumnClassifier.h"
00002 #include <string>
00003 
00004 class ColumnOffset{
00005         
00006 private:
00007         
00008         int _start;
00009         int _end;
00010         int _width;
00011         
00012         const char * _name;
00013         // Madeline column types, i.e. "C", "N", "G", "X", "A" ... :
00014         DATATYPE _discoveredType;
00015         char _declaredType;
00016         
00017 public:
00018         
00019         // constructor:
00020         ColumnOffset(){ 
00021                 
00022                 _start=0;
00023                 _end=0;
00024                 _width=0;
00025                 _name='\0';
00026                 // The discovered type becomes the official type.
00027                 // In some cases, the _discoveredType will be set
00028                 // according to _declaredType (see setTypeFromDeclaration() ):
00029                 _discoveredType=UNCLASSIFIED;
00030                 _declaredType='\0'; // '\0' indicates the default 'not declared' state
00031                 
00032         }
00033         
00034         // setters:
00035         void setStart(int start){ _start=start; }
00036         void setEnd(int end ){ _end=end; if(_end>_start) _width=_end-_start; }
00037         
00038         // setName():
00039         void setName( const char *stt){
00040                 _name = stt;
00041         }
00042         
00043         void setDeclaredType( char type ){ _declaredType=type; }
00044         void setDiscoveredType(DATATYPE type ){ _discoveredType=type; }
00045         
00046         //
00047         // setTypeFromDeclaration:
00048         //
00049         void setTypeFromDeclaration( void ){
00050                 
00051                 if(_declaredType=='\0') _discoveredType=MISSING;
00052                 if(_declaredType=='N' ) _discoveredType=NUMBER;
00053                 if(_declaredType=='D' ) _discoveredType=DATE;
00054                 if(_declaredType=='X' ) _discoveredType=GENDER;
00055                 if(_declaredType=='G' ) _discoveredType=GENOTYPE;
00056                 if(_declaredType=='A' ) _discoveredType=ALLELE;
00057                 if(_declaredType=='C' ) _discoveredType=STRING;
00058                 
00059         }
00060         
00061         //
00062         // setDeclaredTypeFromDiscovery
00063         //
00064         void setDeclaredTypeFromDiscovery( void ){
00065                 
00066                 if(_discoveredType==MISSING ) _declaredType='\0';
00067                 if(_discoveredType==NUMBER  ) _declaredType='N';
00068                 if(_discoveredType==DATE    ) _declaredType='D';
00069                 if(_discoveredType==GENDER  ) _declaredType='X';
00070                 if(_discoveredType==GENOTYPE) _declaredType='G';
00071                 if(_discoveredType==ALLELE  ) _declaredType='A';
00072                 if(_discoveredType==STRING  ) _declaredType='S';
00073         }
00074         
00075         // getters:
00076         int getStart( void ){ return _start; }
00077         int getEnd( void ){ return _end; }
00078         int getWidth( void ){ return _width; }
00079         const char *getName( void ){ return _name; }
00080         DATATYPE getDiscoveredType( void ){ return _discoveredType; }
00081         char getDeclaredType( void ){ return _declaredType; }
00082         
00083 };
00084 

Generated on Fri Nov 18 16:24:39 2011 for MADELINE by  doxygen 1.4.4