Class RetePatternMatcher

All Implemented Interfaces:
IQueryResultProvider, NetworkStructureChangeSensitiveNode, Node, Receiver, Supplier, Tunnel

public class RetePatternMatcher extends TransformerNode implements IQueryResultProvider
  • Field Details

  • Constructor Details

    • RetePatternMatcher

      public RetePatternMatcher(ReteEngine engine, RecipeTraceInfo productionNodeTrace)
      Parameters:
      productionNode - a production node that matches this pattern without any parameter bindings
  • Method Details

    • getProductionNode

      public ProductionNode getProductionNode()
      Since:
      1.6
    • matchAll

      public Stream<Tuple> matchAll(Object[] inputMapping, boolean[] fixed)
      Since:
      2.0
    • matchAll

      public Stream<Tuple> matchAll(TupleMask mask, ITuple inputSignature)
      Since:
      2.0
    • matchOne

      public Optional<Tuple> matchOne(Object[] inputMapping, boolean[] fixed)
      Since:
      2.0
    • matchOne

      public Optional<Tuple> matchOne(TupleMask mask, ITuple inputSignature)
      Since:
      2.0
    • count

      public int count(Object[] inputMapping, boolean[] fixed)
      Counts the number of occurrences of the pattern that match inputMapping on positions where fixed is true.
      Returns:
      the number of occurrences
    • count

      public int count(TupleMask mask, ITuple inputSignature)
      Counts the number of occurrences of the pattern that match inputMapping on positions where fixed is true.
      Returns:
      the number of occurrences
      Since:
      1.7
    • projectionSize

      public int projectionSize(TupleMask groupMask)
      Counts the number of distinct tuples attainable from the match set by projecting match tuples according to the given mask.
      Returns:
      the size of the projection
      Since:
      2.1
    • connect

      public void connect(Receiver receiver, boolean synchronize)
      Connects a new external receiver that will receive update notifications from now on. The receiver will practically connect to the production node, the added value is unwrapping the updates for external use.
      Parameters:
      synchronize - if true, the contents of the production node will be inserted into the receiver after the connection is established.
    • connect

      public void connect(Receiver receiver, Object tag, boolean synchronize)
      Connects a new external receiver that will receive update notifications from now on. The receiver will practically connect to the production node, the added value is unwrapping the updates for external use. The external receiver will be disconnectable later based on its tag.
      Parameters:
      tag - an identifier to recognize the child node by.
      synchronize - if true, the contents of the production node will be inserted into the receiver after the connection is established.
    • disconnect

      public void disconnect(Receiver receiver)
      Disconnects a child node.
    • disconnectByTag

      public boolean disconnectByTag(Object tag)
      Disconnects the child node that was connected by specifying the given tag.
      Returns:
      if a child node was found registered with this tag.
    • transform

      protected Tuple transform(Tuple input)
      Specified by:
      transform in class TransformerNode
    • hasMatch

      public boolean hasMatch(Object[] parameters)
      Specified by:
      hasMatch in interface IQueryResultProvider
    • hasMatch

      public boolean hasMatch(TupleMask parameterSeedMask, ITuple parameters)
      Specified by:
      hasMatch in interface IQueryResultProvider
    • countMatches

      public int countMatches(Object[] parameters)
      Specified by:
      countMatches in interface IQueryResultProvider
    • countMatches

      public int countMatches(TupleMask parameterSeedMask, ITuple parameters)
      Specified by:
      countMatches in interface IQueryResultProvider
    • estimateCardinality

      public Optional<Long> estimateCardinality(TupleMask groupMask, Accuracy requiredAccuracy)
      Specified by:
      estimateCardinality in interface IQueryResultProvider
    • getOneArbitraryMatch

      public Optional<Tuple> getOneArbitraryMatch(Object[] parameters)
      Specified by:
      getOneArbitraryMatch in interface IQueryResultProvider
    • getOneArbitraryMatch

      public Optional<Tuple> getOneArbitraryMatch(TupleMask parameterSeedMask, ITuple parameters)
      Specified by:
      getOneArbitraryMatch in interface IQueryResultProvider
    • getAllMatches

      public Stream<Tuple> getAllMatches(Object[] parameters)
      Specified by:
      getAllMatches in interface IQueryResultProvider
    • getAllMatches

      public Stream<Tuple> getAllMatches(TupleMask parameterSeedMask, ITuple parameters)
      Specified by:
      getAllMatches in interface IQueryResultProvider
    • getQueryBackend

      public IQueryBackend getQueryBackend()
      Specified by:
      getQueryBackend in interface IQueryResultProvider
    • addUpdateListener

      public void addUpdateListener(IUpdateable listener, Object listenerTag, boolean fireNow)
      Specified by:
      addUpdateListener in interface IQueryResultProvider
    • removeUpdateListener

      public void removeUpdateListener(Object listenerTag)
      Specified by:
      removeUpdateListener in interface IQueryResultProvider
    • getInternalIndexer

      public Indexer getInternalIndexer(TupleMask mask)