summaryrefslogtreecommitdiffstats
path: root/Monitoring/MonitoringService/DataProcessing/LinearCombination.py
diff options
context:
space:
mode:
authorpikusa <pikusa@man.poznan.pl>2013-04-03 13:18:17 (GMT)
committer pikusa <pikusa@man.poznan.pl>2013-04-03 13:18:17 (GMT)
commit2f2a3a129c91de540e66c3bfbe30b0df1942cd4b (patch)
tree2d313cdf0068af368d4de6067d676be16f6a6464 /Monitoring/MonitoringService/DataProcessing/LinearCombination.py
parentff8aa232b071a9b54dff833714a870fd0aec0b30 (diff)
downloadnovi-public-2f2a3a129c91de540e66c3bfbe30b0df1942cd4b.zip
novi-public-2f2a3a129c91de540e66c3bfbe30b0df1942cd4b.tar.gz
novi-public-2f2a3a129c91de540e66c3bfbe30b0df1942cd4b.tar.bz2
project commit and dir tree change
Diffstat (limited to 'Monitoring/MonitoringService/DataProcessing/LinearCombination.py')
-rw-r--r--Monitoring/MonitoringService/DataProcessing/LinearCombination.py42
1 files changed, 42 insertions, 0 deletions
diff --git a/Monitoring/MonitoringService/DataProcessing/LinearCombination.py b/Monitoring/MonitoringService/DataProcessing/LinearCombination.py
new file mode 100644
index 0000000..5174b58
--- /dev/null
+++ b/Monitoring/MonitoringService/DataProcessing/LinearCombination.py
@@ -0,0 +1,42 @@
+'''
+Created on Mar 21, 2013
+
+@author: steger
+'''
+from DataProcessing.DataSource import DataSource
+from DataProcessing.Aggregator import Aggregator
+from DataProcessing.DataError import DataError
+
+class LinearCombination(DataSource):
+ '''
+ classdocs
+ '''
+
+ def __init__(self):
+ '''
+ Constructor
+ '''
+ DataSource.__init__(self, dependency = None)
+ self._terms = []
+ self._value = None
+
+ def addTerm(self, factor, aggregate):
+ if not isinstance(aggregate, Aggregator):
+ raise DataError("Wrong type of term")
+ self._terms.append((factor, aggregate))
+
+ @property
+ def name(self):
+ return "BLA"
+
+ @property
+ def value(self):
+ self.process()
+ return self._value
+
+ def process(self):
+ result = 0
+ for factor, aggregate in self._terms:
+ term = aggregate.aggregate
+ result += factor * term
+ self._value = result \ No newline at end of file