예제 #1
0
 /** Clears the cache making this operator stateless on window boundary */
 public void clearCache() {
   if (cumulative) {
     for (Map.Entry<K, SumEntry> e : sums.entrySet()) {
       SumEntry val = e.getValue();
       val.changed = false;
     }
   } else {
     sums.clear();
   }
 }
예제 #2
0
 /** For each tuple (a key value pair) Adds the values for each key. */
 @Override
 public void process(KeyValPair<K, V> tuple) {
   K key = tuple.getKey();
   if (!doprocessKey(key)) {
     return;
   }
   SumEntry val = sums.get(key);
   if (val == null) {
     val = new SumEntry(new MutableDouble(tuple.getValue().doubleValue()), true);
   } else {
     val.sum.add(tuple.getValue().doubleValue());
     val.changed = true;
   }
   sums.put(cloneKey(key), val);
 }