Class ReteEngine
java.lang.Object
tools.refinery.interpreter.rete.matcher.ReteEngine
- All Implemented Interfaces:
IQueryBackend
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ReteBoundary
protected ReteRecipeCompiler
protected final boolean
protected Collection
<Disconnectable> protected Map
<PQuery, RetePatternMatcher> protected final boolean
protected Network
protected final int
protected IQueryRuntimeContext
protected final TimelyConfiguration
-
Constructor Summary
ConstructorsConstructorDescriptionReteEngine
(IQueryBackendContext context, int reteThreads) ReteEngine
(IQueryBackendContext context, int reteThreads, boolean deleteAndRederiveEvaluation, TimelyConfiguration timelyConfiguration) -
Method Summary
Modifier and TypeMethodDescriptionaccessMatcher
(PQuery query) Accesses the patternmatcher for a given pattern, constructs one if a matcher is not available yet.void
void
buildMatchersCoalesced
(Collection<PQuery> specifications) Constructs RETE pattern matchers for a collection of patterns, if they are not available yet.<T> T
constructionWrapper
(Callable<T> payload) void
dispose()
void
void
org.apache.log4j.Logger
getResultProvider
(PQuery query) getResultProvider
(PQuery query, QueryEvaluationHint hints) boolean
boolean
boolean
boolean
void
Deconstructs the engine to get rid of it finallypeekExistingResultProvider
(PQuery query) void
reset()
Resets the engine to an after-initialization phasevoid
setCompiler
(ReteRecipeCompiler builder) void
settle()
Waits until the pattern matcher is in a steady state and output can be retrieved.void
Waits until the pattern matcher is in a steady state and output can be retrieved.
-
Field Details
-
reteNet
-
reteThreads
protected final int reteThreads -
boundary
-
deleteAndRederiveEvaluation
protected final boolean deleteAndRederiveEvaluation- Since:
- 2.2
-
timelyConfiguration
- Since:
- 2.4
-
runtimeContext
-
disconnectables
-
matchers
-
compiler
-
parallelExecutionEnabled
protected final boolean parallelExecutionEnabled
-
-
Constructor Details
-
ReteEngine
- Parameters:
context
- the context of the pattern matcher, conveying all information from the outside world.reteThreads
- the number of threads to operate the RETE network with; 0 means single-threaded operation, 1 starts an asynchronous thread to operate the RETE net, >1 uses multiple RETE containers.
-
ReteEngine
public ReteEngine(IQueryBackendContext context, int reteThreads, boolean deleteAndRederiveEvaluation, TimelyConfiguration timelyConfiguration) - Since:
- 2.4
-
-
Method Details
-
getBackendContext
- Since:
- 1.6
-
isDeleteAndRederiveEvaluation
public boolean isDeleteAndRederiveEvaluation()- Since:
- 2.2
-
getTimelyConfiguration
- Since:
- 2.4
-
flushUpdates
public void flushUpdates()- Specified by:
flushUpdates
in interfaceIQueryBackend
-
killEngine
public void killEngine()Deconstructs the engine to get rid of it finally -
reset
public void reset()Resets the engine to an after-initialization phase -
accessMatcher
Accesses the patternmatcher for a given pattern, constructs one if a matcher is not available yet.- Parameters:
query
- the pattern to be matched.- Returns:
- a patternmatcher object that can match occurences of the given pattern.
- Throws:
InterpreterRuntimeException
- if construction fails.
-
buildMatchersCoalesced
Constructs RETE pattern matchers for a collection of patterns, if they are not available yet. Model traversal during the whole construction period is coalesced (which may have an effect on performance, depending on the matcher context).- Parameters:
specifications
- the patterns to be matched.- Throws:
InterpreterRuntimeException
- if construction fails.
-
constructionWrapper
- Since:
- 2.4
-
executeDelayedCommands
public void executeDelayedCommands()- Since:
- 2.3
-
settle
public void settle()Waits until the pattern matcher is in a steady state and output can be retrieved. -
settle
Waits until the pattern matcher is in a steady state and output can be retrieved. When steady state is reached, a retrieval action is executed before the steady state ceases.- Parameters:
action
- the action to be run when reaching the steady-state.
-
getReteNet
- Returns:
- the reteNet
-
getBoundary
- Returns:
- the boundary
-
setCompiler
- Parameters:
builder
- the pattern matcher builder to set
-
addDisconnectable
- Parameters:
disc
- the new Disconnectable adapter.
-
isParallelExecutionEnabled
public boolean isParallelExecutionEnabled()- Returns:
- the parallelExecutionEnabled
-
getLogger
public org.apache.log4j.Logger getLogger() -
getRuntimeContext
-
getCompiler
-
isDisposedOrUninitialized
public boolean isDisposedOrUninitialized()- Since:
- 2.9
-
getResultProvider
- Specified by:
getResultProvider
in interfaceIQueryBackend
-
getResultProvider
- Specified by:
getResultProvider
in interfaceIQueryBackend
- Since:
- 1.4
-
peekExistingResultProvider
- Specified by:
peekExistingResultProvider
in interfaceIQueryBackend
-
dispose
public void dispose()- Specified by:
dispose
in interfaceIQueryBackend
-
isCaching
public boolean isCaching()- Specified by:
isCaching
in interfaceIQueryBackend
-
getHintConfiguration
- Since:
- 1.5
-
getFactory
- Specified by:
getFactory
in interfaceIQueryBackend
-