Class DeltaMonitor<MatchType>

All Implemented Interfaces:
Clearable, Node, Receiver
Direct Known Subclasses:
DefaultDeltaMonitor

public abstract class DeltaMonitor<MatchType> extends SimpleReceiver implements Clearable
A monitoring object that connects to the rete network as a receiver to reflect changes since an arbitrary state acknowledged by the client. Match tuples are represented by a type MatchType.

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.

  • Field Details

  • Constructor Details

    • DeltaMonitor

      public DeltaMonitor(ReteContainer reteContainer)
      Parameters:
      reteContainer -
  • Method Details

    • statelessFilter

      public boolean statelessFilter(Tuple tuple)
      Override this method to provide a lightweight, stateless filter on the tuples
      Parameters:
      tuple - the occurrence that is to be filtered
      Returns:
      true if this tuple should be monitored, false if ignored
    • statelessConvert

      public abstract MatchType statelessConvert(Tuple tuple)
    • update

      public void update(Direction direction, Tuple updateElement, Timestamp timestamp)
      Description copied from interface: Receiver
      Updates the receiver with a newly found or lost partial matching.
      Specified by:
      update in interface Receiver
    • clear

      public void clear()
      Specified by:
      clear in interface Clearable