00001 00027 #ifndef _NUMERICAL_H 00028 #define _NUMERICAL_H 00029 00030 #include "Feature.h" 00031 00046 class NumericalDiscreteFeature: public PersistantFeature 00047 { 00048 protected: 00050 double val; 00052 long *minval; 00054 long *maxval; 00055 00071 NumericalDiscreteFeature(long *minval, long *maxval); 00072 00087 NumericalDiscreteFeature(long *minval, long *maxval, long val); 00088 00089 public: 00090 virtual double getPosition() const; 00091 virtual double getDistance(Feature *f) const; 00092 virtual void moveTowards(Feature *f, double factor); 00093 00094 virtual string serialize() const; 00095 virtual void unserialize(string value); 00096 00097 virtual featureparams write() const; 00098 virtual void read(featureparams *param); 00099 00100 virtual Feature* clone() const; 00101 virtual void aggregate(aggregatelist samples); 00102 00103 virtual FeatureType getType() const { return numerical_discrete; } 00104 virtual const string getName() const { return "NumericalDiscreteFeature"; } 00105 00107 const long getVal() const { return (long) val; } 00108 00109 const long getMin() const { return *minval; } 00110 const long getMax() const { return *maxval; } 00111 00112 #if _DEBUG_FEATURES 00113 virtual string toString() const; 00114 #endif 00115 }; 00116 00126 class NumericalContinuousFeature: public PersistantFeature 00127 { 00128 protected: 00130 double val; 00132 double *minval; 00134 double *maxval; 00135 00151 NumericalContinuousFeature(double *minval, double *maxval); 00152 00167 NumericalContinuousFeature(double *minval, double *maxval, double val); 00168 00169 public: 00170 virtual double getPosition() const; 00171 virtual double getDistance(Feature *f) const; 00172 virtual void moveTowards(Feature *f, double factor); 00173 00174 virtual string serialize() const; 00175 virtual void unserialize(string value); 00176 00177 virtual featureparams write() const; 00178 virtual void read(featureparams *param); 00179 00180 virtual Feature* clone() const; 00181 virtual void aggregate(aggregatelist samples); 00182 00183 virtual FeatureType getType() const { return numerical_continuous; } 00184 virtual const string getName() const { return "NumericalContinuousFeature"; } 00185 00187 const double getVal() const { return val; } 00188 00189 const double getMin() const { return *minval; } 00190 const double getMax() const { return *maxval; } 00191 00192 #if _DEBUG_FEATURES 00193 virtual string toString() const; 00194 #endif 00195 }; 00196 00197 #endif