public abstract class DeltaMonitor<MatchType> extends SimpleReceiver implements Clearable
Usage. If a new matching is found, it appears in the matchFoundEvents collection, and disappears when that particular matching cannot be found anymore. If the event of finding a match has been processed by the client, it can be removed manually. In this case, when a previously found matching is lost, the Tuple will appear in the matchLostEvents collection, and disappear upon finding the same matching again. "Matching lost" events can also be acknowledged by removing a Tuple from the collection. If the matching is found once again, it will return to matchFoundEvents.
Technical notes. Does NOT propagate updates! By overriding statelessConvert(), results can be stored to a MatchType. MatchType must provide equals() and hashCode() reflecting its contents. The default implementation (DefaultDeltaMonitor) uses Tuple as MatchType. By overriding statelessFilter(), some tuples can be filtered.
Modifier and Type | Field and Description |
---|---|
java.util.Collection<MatchType> |
matchFoundEvents
matches that are newly found
|
java.util.Collection<MatchType> |
matchLostEvents
matches that are newly lost
|
Constructor and Description |
---|
DeltaMonitor(ReteContainer reteContainer) |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clear all partial matchings stored in memory
|
abstract MatchType |
statelessConvert(Tuple tuple) |
boolean |
statelessFilter(Tuple tuple)
Override this method to provide a lightweight, stateless filter on the tuples
|
void |
update(Direction direction,
Tuple updateElement)
updates the receiver with a newly found or lost partial matching
|
appendParent, assignTraceInfo, disconnectFromNetwork, getParents, removeParent
acceptPropagatedTraceInfo, getContainer, getNodeId, getTag, getTraceInfos, setTag, toString
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
acceptPropagatedTraceInfo, getContainer, getNodeId, getTag, getTraceInfos, setTag
public java.util.Collection<MatchType> matchFoundEvents
public java.util.Collection<MatchType> matchLostEvents
public DeltaMonitor(ReteContainer reteContainer)
reteContainer
- public boolean statelessFilter(Tuple tuple)
tuple
- the occurrence that is to be filteredpublic void update(Direction direction, Tuple updateElement)
Receiver