Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef ACTIVEMODEL_H
00028 #define ACTIVEMODEL_H
00029
00030 #include <QGpCoreTools.h>
00031 #include "DinverCoreDLLExport.h"
00032
00033 namespace DinverCore {
00034
00035 class DINVERCORE_EXPORT ActiveModel
00036 {
00037 TRANSLATIONS("ActiveModel")
00038 public:
00039 inline void operator=(int modelIndex);
00040 inline void operator=(const ActiveModel& o);
00041
00042 int modelIndex() const {return _modelIndex;}
00043
00044 int acceptedCount() const {return _nAccepted;}
00045 void addAccepted() {_nAccepted++;}
00046
00047 int rejectedCount() const {return _nRejected;}
00048 void addRejected() {_nRejected++;}
00049
00050 bool isQuarantined() const {return _quarantined;}
00051 void setQuarantined() {_quarantined=true;}
00052
00053 inline bool giveUp(double ratio) const;
00054
00055
00056
00057 int navigatorHit() const {return _navigatorHit;}
00058 void setNavigatorHit(int n=0) {_navigatorHit=n;}
00059
00060 bool isDying() const {return _lives==1;}
00061 bool isAlive() const {return _lives>0;}
00062 inline void healthCheck();
00063 private:
00064 int _modelIndex;
00065 int _nAccepted;
00066 int _nRejected;
00067
00068 int _navigatorHit;
00069 int _lives;
00070 bool _quarantined;
00071 };
00072
00073 inline void ActiveModel::operator=(int modelIndex)
00074 {
00075 _modelIndex=modelIndex;
00076 _nAccepted=0;
00077 _nRejected=0;
00078
00079 _navigatorHit=0;
00080 _lives=40;
00081 _quarantined=false;
00082 }
00083
00084 inline void ActiveModel::operator=(const ActiveModel& o)
00085 {
00086 _modelIndex=o._modelIndex;
00087 _nAccepted=o._nAccepted;
00088 _nRejected=o._nRejected;
00089 _quarantined=o._quarantined;
00090
00091 _navigatorHit=o._navigatorHit;
00092 _lives=o._lives;
00093 }
00094
00095 inline void ActiveModel::healthCheck()
00096 {
00097
00098
00099
00100
00101
00102
00103
00104 }
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116 inline bool ActiveModel::giveUp(double ratio) const
00117 {
00118 return _nRejected>50 &&
00119 _nRejected>ratio*(double)(_nRejected+_nAccepted);
00120 }
00121
00122 }
00123
00124 #endif // ACTIVEMODEL_H