public class Generator extends Object implements LPAgendaEntry, LPInterpreterContext
Each generator may have multiple associated consumer choice points representing different choices in satisfying the generator's goal.
| Constructor and Description |
|---|
Generator(LPInterpreter interpreter,
TriplePattern goal)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addConsumer(ConsumerChoicePointFrame ccp)
Add a new client choince point to consume results from this generator.
|
void |
checkForCompletions()
Check for deadlocked states where none of the generators we are (indirectly)
dependent on can run.
|
static void |
checkForCompletions(Collection<? extends Generator> completions)
Check for deadlocked states across a collection of generators which have
been run.
|
Generator |
getGenerator()
Return the generator associated with this entry (might be the entry itself)
|
boolean |
isComplete()
Return true if the generator is complete.
|
boolean |
isReady()
Return true if the generator is ready to be scheduled (i.e.
|
void |
notifyBlockedOn(ConsumerChoicePointFrame ccp)
Notify that the interpreter has now blocked on the given choice point.
|
void |
notifyFinished(ConsumerChoicePointFrame ccp)
Notify this context that the given choice point has terminated
and can be remove from the wait list.
|
void |
notifyResults()
Signal dependents that we have new results.
|
int |
numResults()
Return the number of results available from this context.
|
void |
pump()
Start this generator running for the first time.
|
void |
pump(LPInterpreterState context)
Start this generator running from the given previous blocked generating
choice point.
|
void |
removeConsumer(ConsumerChoicePointFrame ccp)
Remove a terminated consuming choice point from the state set.
|
void |
setComplete()
Signal that this generator is complete, no more results can be created.
|
void |
setReady(ConsumerChoicePointFrame ccp)
Directly set that this generator is ready (because the generator
for one of its generatingCPs has produced new results).
|
public Generator(LPInterpreter interpreter, TriplePattern goal)
interpreter - an initialized interpreter instance that will answer
results for this generator.public int numResults()
public boolean isReady()
isReady in interface LPAgendaEntryisReady in interface LPInterpreterContextpublic void setReady(ConsumerChoicePointFrame ccp)
setReady in interface LPInterpreterContextpublic boolean isComplete()
public void setComplete()
public void addConsumer(ConsumerChoicePointFrame ccp)
public void removeConsumer(ConsumerChoicePointFrame ccp)
public void notifyResults()
public void notifyBlockedOn(ConsumerChoicePointFrame ccp)
notifyBlockedOn in interface LPInterpreterContextpublic void notifyFinished(ConsumerChoicePointFrame ccp)
notifyFinished in interface LPInterpreterContextpublic void pump()
pump in interface LPAgendaEntrypublic void pump(LPInterpreterState context)
public Generator getGenerator()
getGenerator in interface LPAgendaEntrypublic void checkForCompletions()
public static void checkForCompletions(Collection<? extends Generator> completions)
Licenced under the Apache License, Version 2.0