java.lang.Object
org.apache.jena.reasoner.rulesys.impl.Generator
- All Implemented Interfaces:
LPAgendaEntry,LPInterpreterContext,LPInterpreterState
A generator represents a set of memoized results for a single
tabled subgoal. The generator may be complete (in which case it just
contains the complete cached set of results for a goal), ready (not complete
but likely to product more results if called) or blocked (not complete and
awaiting results from a dependent generator).
Each generator may have multiple associated consumer choice points representing different choices in satisfying the generator's goal.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a new client choince point to consume results from this generator.voidCheck for deadlocked states where none of the generators we are (indirectly) dependent on can run.static voidcheckForCompletions(Collection<? extends Generator> completions) Check for deadlocked states across a collection of generators which have been run.Return the generator associated with this entry (might be the entry itself)booleanReturn true if the generator is complete.booleanisReady()Return true if the generator is ready to be scheduled (i.e. it is not known to be complete and not known to be waiting for a dependent generator).voidNotify that the interpreter has now blocked on the given choice point.voidNotify this context that the given choice point has terminated and can be remove from the wait list.voidSignal dependents that we have new results.intReturn the number of results available from this context.voidpump()Start this generator running for the first time.voidpump(LPInterpreterState context) Start this generator running from the given previous blocked generating choice point.voidRemove a terminated consuming choice point from the state set.voidSignal that this generator is complete, no more results can be created.voidDirectly set that this generator is ready (because the generator for one of its generatingCPs has produced new results).
-
Constructor Details
-
Generator
Constructor.- Parameters:
interpreter- an initialized interpreter instance that will answer results for this generator.
-
-
Method Details
-
numResults
public int numResults()Return the number of results available from this context. -
isReady
public boolean isReady()Return true if the generator is ready to be scheduled (i.e. it is not known to be complete and not known to be waiting for a dependent generator).- Specified by:
isReadyin interfaceLPAgendaEntry- Specified by:
isReadyin interfaceLPInterpreterContext
-
setReady
Directly set that this generator is ready (because the generator for one of its generatingCPs has produced new results).- Specified by:
setReadyin interfaceLPInterpreterContext
-
isComplete
public boolean isComplete()Return true if the generator is complete. -
setComplete
public void setComplete()Signal that this generator is complete, no more results can be created. -
addConsumer
Add a new client choince point to consume results from this generator. -
removeConsumer
Remove a terminated consuming choice point from the state set. -
notifyResults
public void notifyResults()Signal dependents that we have new results. -
notifyBlockedOn
Notify that the interpreter has now blocked on the given choice point.- Specified by:
notifyBlockedOnin interfaceLPInterpreterContext
-
notifyFinished
Notify this context that the given choice point has terminated and can be remove from the wait list.- Specified by:
notifyFinishedin interfaceLPInterpreterContext
-
pump
public void pump()Start this generator running for the first time. Should be called from within an appropriately synchronized block.- Specified by:
pumpin interfaceLPAgendaEntry
-
pump
Start this generator running from the given previous blocked generating choice point. Should be called from within an appropriately synchronized block. -
getGenerator
Return the generator associated with this entry (might be the entry itself)- Specified by:
getGeneratorin interfaceLPAgendaEntry
-
checkForCompletions
public void checkForCompletions()Check for deadlocked states where none of the generators we are (indirectly) dependent on can run. -
checkForCompletions
Check for deadlocked states across a collection of generators which have been run.
-