public class ConsumerChoicePointFrame extends GenericTripleMatchFrame implements LPAgendaEntry, LPInterpreterState
Frame in the LPInterpreter's control stack used to represent matching to the results of a tabled predicate. Conventionally the system state which finds and tables the goal results is called the generator and states which require those results are called consumers.
This is used in the inner loop of the interpreter and so is a pure data structure not an abstract data type and assumes privileged access to the interpreter state.
Method SummaryModifier and TypeMethodDescription
close()Close the frame actively.Return the interpeter context which is reading the results of this consumer.Return the generator associated with this entry (might be the entry itself)
voidInitialize the choice point state.
isReady()Return true if this choice point could usefully be restarted.Find the next result triple and bind the result vars appropriately.
voidPreserve the state of an interpreter into this frame.
pump()Reactivate this choice point to return new results.
voidRestore the state of an interpreter from this frame
voidNotify that this consumer choice point has finished consuming all the results of a closed generator.
setReady()Called by generator when there are more results available.
Methods inherited from class org.apache.jena.reasoner.rulesys.impl.GenericTripleMatchFrame
Methods inherited from class org.apache.jena.reasoner.rulesys.impl.GenericChoiceFrame
Methods inherited from class org.apache.jena.reasoner.rulesys.impl.FrameObject
fastLinkTo, getLink, linkTo
interpreter- the parent interpreter whose state is to be preserved here, its arg stack defines the parameters for the target goal
initpublic void init
(LPInterpreter interpreter)Initialize the choice point state.
preserveStatePreserve the state of an interpreter into this frame.
restoreStatepublic void restoreState
(LPInterpreter interp)Restore the state of an interpreter from this frame
nextMatchFind the next result triple and bind the result vars appropriately.
interpreter- the calling interpreter whose trail should be used
- FAIL if there are no more matches and the generator is closed, SUSPEND if there are no more matches but the generator could generate more, SATISFIED if a match has been found.
isReadypublic boolean isReady()Return true if this choice point could usefully be restarted.
setReadypublic void setReady()Called by generator when there are more results available.
closepublic void close()Description copied from class:
FrameObjectClose the frame actively. This frees any internal resources, frees this frame and frees the frame to which this is linked.
setFinishedpublic void setFinished()Notify that this consumer choice point has finished consuming all the results of a closed generator.
pumppublic void pump()Reactivate this choice point to return new results.
getGeneratorpublic Generator getGenerator()Return the generator associated with this entry (might be the entry itself)
getConsumingContextpublic LPInterpreterContext getConsumingContext()Return the interpeter context which is reading the results of this consumer.