diff options
Diffstat (limited to 'Monitoring/MonitoringService/DataProcessing/Bool.py')
-rw-r--r-- | Monitoring/MonitoringService/DataProcessing/Bool.py | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/Monitoring/MonitoringService/DataProcessing/Bool.py b/Monitoring/MonitoringService/DataProcessing/Bool.py new file mode 100644 index 0000000..54cbb4e --- /dev/null +++ b/Monitoring/MonitoringService/DataProcessing/Bool.py @@ -0,0 +1,62 @@ +''' +Created on Mar 22, 2013 + +@author: steger +''' +from DataProcessing.DataError import DataError + +#FIXME: this is a DataSource? +class Comparator(object): + ''' + classdocs + ''' + def __init__(self, datasource): + self._datasource = datasource + + @property + def value(self): + raise DataError("Implement value property") + +class IsPositive(Comparator): + ''' + ''' + @property + def name(self): + return "IsPositive(%s)" % self._datasource.name + + @property + def value(self): + return self._datasource.value > 0 + +class IsNegative(Comparator): + ''' + ''' + @property + def name(self): + return "IsNegative(%s)" % self._datasource.name + + @property + def value(self): + return self._datasource.value < 0 + +class IsNotPositive(Comparator): + ''' + ''' + @property + def name(self): + return "IsNotPositive(%s)" % self._datasource.name + + @property + def value(self): + return self._datasource.value <= 0 + +class IsNotNegative(Comparator): + ''' + ''' + @property + def name(self): + return "IsNotNegative(%s)" % self._datasource.name + + @property + def value(self): + return self._datasource.value >= 0
\ No newline at end of file |