public class RetePatternMatcher extends TransformerNode implements IQueryResultProvider
Constructor and Description |
---|
RetePatternMatcher(ReteEngine engine,
RecipeTraceInfo productionNodeTrace) |
Modifier and Type | Method and Description |
---|---|
void |
addUpdateListener(IUpdateable listener,
java.lang.Object listenerTag,
boolean fireNow)
Internal method that registers low-level callbacks for match appearance and disappearance.
|
void |
connect(Receiver receiver,
boolean synchronize)
Connects a new external receiver that will receive update notifications from now on.
|
void |
connect(Receiver receiver,
java.lang.Object tag,
boolean synchronize)
Connects a new external receiver that will receive update notifications from now on.
|
int |
count(java.lang.Object[] inputMapping,
boolean[] fixed)
Counts the number of occurrences of the pattern that match inputMapping on positions where fixed is true.
|
int |
countMatches(java.lang.Object[] parameters)
Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
|
void |
disconnect(Receiver receiver)
Disconnects a child node.
|
boolean |
disconnectByTag(java.lang.Object tag)
Disconnects the child node that was connected by specifying the given tag.
|
java.util.Collection<? extends Tuple> |
getAllMatches(java.lang.Object[] parameters)
Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
|
Tuple |
getOneArbitraryMatch(java.lang.Object[] parameters)
Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
|
IQueryBackend |
getQueryBackend()
The underlying query evaluator backend.
|
java.util.ArrayList<Tuple> |
matchAll(java.lang.Object[] inputMapping,
boolean[] fixed) |
Tuple |
matchOne(java.lang.Object[] inputMapping,
boolean[] fixed) |
Tuple |
matchOneRandomly(java.lang.Object[] inputMapping,
boolean[] fixed) |
void |
removeUpdateListener(java.lang.Object listenerTag)
Removes an existing listener previously registered with the given tag.
|
pullInto, update
appendParent, assignTraceInfo, getParents, propagatePullInto, removeParent
appendChild, constructIndex, getPulledContents, getReceivers, removeChild
acceptPropagatedTraceInfo, getContainer, getNodeId, getTag, getTraceInfos, setTag, toString
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
appendChild, constructIndex, getPulledContents, getReceivers, removeChild
acceptPropagatedTraceInfo, getContainer, getNodeId, getTag, getTraceInfos, setTag
public RetePatternMatcher(ReteEngine engine, RecipeTraceInfo productionNodeTrace)
productionNode
- a production node that matches this pattern without any parameter bindingspublic Tuple matchOneRandomly(java.lang.Object[] inputMapping, boolean[] fixed)
public java.util.ArrayList<Tuple> matchAll(java.lang.Object[] inputMapping, boolean[] fixed)
public Tuple matchOne(java.lang.Object[] inputMapping, boolean[] fixed)
public int count(java.lang.Object[] inputMapping, boolean[] fixed)
public void connect(Receiver receiver, boolean synchronize)
synchronize
- if true, the contents of the production node will be inserted into the receiver after the connection
is established.public void connect(Receiver receiver, java.lang.Object tag, boolean synchronize)
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.public void disconnect(Receiver receiver)
public boolean disconnectByTag(java.lang.Object tag)
public int countMatches(java.lang.Object[] parameters)
IQueryResultProvider
countMatches
in interface IQueryResultProvider
parameters
- array where each non-null element binds the corresponding pattern parameter to a fixed value.public Tuple getOneArbitraryMatch(java.lang.Object[] parameters)
IQueryResultProvider
getOneArbitraryMatch
in interface IQueryResultProvider
parameters
- array where each non-null element binds the corresponding pattern parameter to a fixed value.Tuple
representation.public java.util.Collection<? extends Tuple> getAllMatches(java.lang.Object[] parameters)
IQueryResultProvider
getAllMatches
in interface IQueryResultProvider
parameters
- array where each non-null element binds the corresponding pattern parameter to a fixed value.Tuple
representation.public IQueryBackend getQueryBackend()
IQueryResultProvider
getQueryBackend
in interface IQueryResultProvider
public void addUpdateListener(IUpdateable listener, java.lang.Object listenerTag, boolean fireNow)
IQueryResultProvider
Caution: This is a low-level callback that is invoked when the pattern matcher is not necessarily in a consistent state yet. Importantly, no model modification permitted during the callback.
The callback can be unregistered via invoking IQueryResultProvider.removeUpdateListener(Object)
with the same tag.
addUpdateListener
in interface IQueryResultProvider
listener
- the listener that will be notified of each new match that appears or disappears, starting from now.listenerTag
- a tag by which to identify the listener for later removal by IQueryResultProvider.removeUpdateListener(Object)
.fireNow
- if true, the insertion update allback will be immediately invoked on all current matches as a one-time effect.public void removeUpdateListener(java.lang.Object listenerTag)
IQueryResultProvider
removeUpdateListener
in interface IQueryResultProvider