public class ConsumerChoicePointFrame extends GenericTripleMatchFrame implements LPAgendaEntry, LPInterpreterState
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.
Constructor and Description |
---|
ConsumerChoicePointFrame(LPInterpreter interpreter)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the frame actively.
|
LPInterpreterContext |
getConsumingContext()
Return the interpeter context which is reading the results of this consumer.
|
Generator |
getGenerator()
Return the generator associated with this entry (might be the entry itself)
|
void |
init(LPInterpreter interpreter)
Initialize the choice point state.
|
boolean |
isReady()
Return true if this choice point could usefully be restarted.
|
StateFlag |
nextMatch(LPInterpreter interpreter)
Find the next result triple and bind the result vars appropriately.
|
void |
preserveState(List<Node> trail)
Preserve the state of an interpreter into this frame.
|
void |
pump()
Reactivate this choice point to return new results.
|
void |
restoreState(LPInterpreter interp)
Restore the state of an interpreter from this frame
|
void |
setFinished()
Notify that this consumer choice point has finished consuming all
the results of a closed generator.
|
void |
setReady()
Called by generator when there are more results available.
|
bindResult, functorMatch
setContinuation
fastLinkTo, getLink, linkTo
public ConsumerChoicePointFrame(LPInterpreter interpreter)
interpreter
- the parent interpreter whose state is to be preserved here, its arg stack
defines the parameters for the target goalpublic void init(LPInterpreter interpreter)
init
in class GenericTripleMatchFrame
interpreter
- the parent interpreter whose state is to be preserved here, its arg stack
defines the parameters for the target goalpublic void preserveState(List<Node> trail)
public void restoreState(LPInterpreter interp)
public StateFlag nextMatch(LPInterpreter interpreter)
interpreter
- the calling interpreter whose trail should be usedpublic boolean isReady()
isReady
in interface LPAgendaEntry
public void setReady()
public void close()
FrameObject
close
in class FrameObject
public void setFinished()
public void pump()
pump
in interface LPAgendaEntry
public Generator getGenerator()
getGenerator
in interface LPAgendaEntry
public LPInterpreterContext getConsumingContext()
Licenced under the Apache License, Version 2.0