DATA - The type of the data points which are handled by this policypublic class DeltaPolicy<DATA> extends Object implements CloneableTriggerPolicy<DATA>, CloneableEvictionPolicy<DATA>
ActiveEvictionPolicyWrapper to make it calculate the delta even on
fake elements.| Modifier and Type | Field and Description |
|---|---|
protected DeltaFunction<DATA> |
deltaFuntion |
protected double |
threshold |
protected DATA |
triggerDataPoint |
| Constructor and Description |
|---|
DeltaPolicy(DeltaFunction<DATA> deltaFuntion,
DATA init,
double threshold,
org.apache.flink.api.common.typeutils.TypeSerializer typeSerializer)
Creates a delta policy which calculates a delta between the data point
which triggered last and the currently arrived data point.
|
| Modifier and Type | Method and Description |
|---|---|
DeltaPolicy<DATA> |
clone()
This method should return an exact copy of the object it belongs to
including the current object state.
|
boolean |
equals(Object other) |
int |
notifyEviction(DATA datapoint,
boolean triggered,
int bufferSize)
Proves if and how many elements should be deleted from the element
buffer.
|
boolean |
notifyTrigger(DATA datapoint)
Proves and returns if a new window should be started.
|
String |
toString() |
protected DeltaFunction<DATA> deltaFuntion
protected double threshold
protected transient DATA triggerDataPoint
public DeltaPolicy(DeltaFunction<DATA> deltaFuntion, DATA init, double threshold, org.apache.flink.api.common.typeutils.TypeSerializer typeSerializer)
TypeSerializer is needed for the initial value.
In case it gets used for eviction, this policy starts from the first element of the buffer and removes all elements from the buffer which have a higher delta then the threshold. As soon as there is an element with a lower delta, the eviction stops.
deltaFuntion - The delta function to be used.init - The initial to be used for the calculation of a delta before
the first trigger.threshold - The threshold upon which a triggering should happen.typeSerializer - TypeSerializer to properly forward the initial value to
the clusterpublic boolean notifyTrigger(DATA datapoint)
TriggerPolicynotifyTrigger in interface TriggerPolicy<DATA>datapoint - the data point which arrivedpublic int notifyEviction(DATA datapoint, boolean triggered, int bufferSize)
EvictionPolicynotifyEviction in interface EvictionPolicy<DATA>datapoint - data point the data point which arrivedtriggered - Information whether the UDF was triggered or notbufferSize - The current size of the element buffer at the operatorpublic DeltaPolicy<DATA> clone()
CloneableTriggerPolicyclone in interface CloneableEvictionPolicy<DATA>clone in interface CloneableTriggerPolicy<DATA>clone in class ObjectCopyright © 2014–2015 The Apache Software Foundation. All rights reserved.