use of org.apache.apex.malhar.lib.util.HighLow in project apex-malhar by apache.
the class Range method endWindow.
/**
* Emits the range. If no tuple was received in the window, no emit is done
* Clears the internal data before return
*/
@Override
public void endWindow() {
if ((low != null) && (high != null)) {
HighLow tuple = new HighLow(getValue(high.doubleValue()), getValue(low.doubleValue()));
range.emit(tuple);
}
high = null;
low = null;
}
use of org.apache.apex.malhar.lib.util.HighLow in project apex-malhar by apache.
the class MultiWindowRangeKeyVal method endWindow.
/**
* Emits range for each key at application window boundary. If no data is received, no emit is done
* Clears the internal data before return
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void endWindow() {
boolean emit = (++windowCount) % windowSize == 0;
if (!emit) {
return;
}
for (Map.Entry<K, V> e : high.entrySet()) {
HighLow<V> hl = new HighLow<V>();
hl.setHigh(getValue(e.getValue().doubleValue()));
// cannot be null
hl.setLow(getValue(low.get(e.getKey()).doubleValue()));
range.emit(new KeyValPair(e.getKey(), hl));
}
clearCache();
}
Aggregations