|
|||||||||
| Home >> All >> com >> hp >> hpl >> jena >> reasoner >> rulesys >> [ impl overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.hp.hpl.jena.reasoner.rulesys.impl
Class Generator

java.lang.Objectcom.hp.hpl.jena.reasoner.rulesys.impl.Generator
- All Implemented Interfaces:
- LPAgendaEntry, LPInterpreterContext, LPInterpreterState
- public class Generator
- extends java.lang.Object
- implements LPAgendaEntry, LPInterpreterContext
- extends java.lang.Object
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.
- Version:
- $Revision: 1.7 $ on $Date: 2005/04/12 17:01:41 $
| Nested Class Summary | |
private static class |
Generator.LFlag
Inner class used to flag generator states during completeness check. |
| Field Summary | |
protected boolean |
checkReadyNeeded
set to true if at least one branch has block so an active readiness check is required |
protected Generator.LFlag |
completionState
Flags whether the generator is live/dead/unknown during completion checking |
protected java.util.Set |
consumingCPs
The list of active consumer choice points consuming results from this generator |
protected java.util.Set |
generatingCPs
The set of choice points producing results for us to use |
protected com.hp.hpl.jena.reasoner.TriplePattern |
goal
The goal the generator is satisfying - just used in debugging |
protected LPInterpreter |
interpreter
The intepreter instance which generates the results for this goal, null if the generator is complete |
protected boolean |
isReady
set to true if the dependent generator has new results ready for us |
protected boolean |
isSingleton
True if this generator can produce at most one answer |
protected java.util.ArrayList |
results
The ordered set of results available for the goal |
protected java.util.Set |
resultSet
A indexed version of the result set, used while the generator is live to detect duplicate results |
| Constructor Summary | |
Generator(LPInterpreter interpreter,
com.hp.hpl.jena.reasoner.TriplePattern goal)
Constructor. |
|
| Method Summary | |
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(java.util.Collection 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. |
protected static void |
postCompletionCheckScan(java.util.Set visited)
Scan the result of a (set of) completion check(s) to detect which of the unknowns are actually live and set the remaining (deadlocked) states to complete. |
protected void |
propagateLive(java.util.Set filter)
Propagate liveness state forward to consuming generators, but only those within the filter set. |
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. |
protected Generator.LFlag |
runCompletionCheck(java.util.Set visited)
Check whether this generator is live (indirectly dependent on a ready generator), dead (complete) or in a deadlock loop which might or might not be live (unknown). |
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). |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
interpreter
protected LPInterpreter interpreter
- The intepreter instance which generates the results for this goal,
null if the generator is complete
results
protected java.util.ArrayList results
- The ordered set of results available for the goal
resultSet
protected java.util.Set resultSet
- A indexed version of the result set, used while the generator is live
to detect duplicate results
isReady
protected boolean isReady
- set to true if the dependent generator has new results ready for us
checkReadyNeeded
protected boolean checkReadyNeeded
- set to true if at least one branch has block so an active readiness check is required
generatingCPs
protected java.util.Set generatingCPs
- The set of choice points producing results for us to use
consumingCPs
protected java.util.Set consumingCPs
- The list of active consumer choice points consuming results from this generator
completionState
protected Generator.LFlag completionState
- Flags whether the generator is live/dead/unknown during completion checking
goal
protected com.hp.hpl.jena.reasoner.TriplePattern goal
- The goal the generator is satisfying - just used in debugging
isSingleton
protected boolean isSingleton
- True if this generator can produce at most one answer
| Constructor Detail |
Generator
public Generator(LPInterpreter interpreter, com.hp.hpl.jena.reasoner.TriplePattern goal)
- Constructor.
| Method Detail |
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
setReady
public void setReady(ConsumerChoicePointFrame ccp)
- 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
public void addConsumer(ConsumerChoicePointFrame ccp)
- Add a new client choince point to consume results from this generator.
removeConsumer
public void removeConsumer(ConsumerChoicePointFrame ccp)
- Remove a terminated consuming choice point from the state set.
notifyResults
public void notifyResults()
- Signal dependents that we have new results.
notifyBlockedOn
public void notifyBlockedOn(ConsumerChoicePointFrame ccp)
- Notify that the interpreter has now blocked on the given choice point.
- Specified by:
notifyBlockedOnin interfaceLPInterpreterContext
notifyFinished
public void notifyFinished(ConsumerChoicePointFrame ccp)
- 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
public void pump(LPInterpreterState context)
- Start this generator running from the given previous blocked generating
choice point.
Should be called from within an appropriately synchronized block.
getGenerator
public Generator 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
public static void checkForCompletions(java.util.Collection completions)
- Check for deadlocked states across a collection of generators which have
been run.
runCompletionCheck
protected Generator.LFlag runCompletionCheck(java.util.Set visited)
- Check whether this generator is live (indirectly dependent on a ready
generator), dead (complete) or in a deadlock loop which might or
might not be live (unknown).
postCompletionCheckScan
protected static void postCompletionCheckScan(java.util.Set visited)
- Scan the result of a (set of) completion check(s) to detect which of the
unknowns are actually live and set the remaining (deadlocked) states
to complete.
propagateLive
protected void propagateLive(java.util.Set filter)
- Propagate liveness state forward to consuming generators, but only those
within the filter set.
|
|||||||||
| Home >> All >> com >> hp >> hpl >> jena >> reasoner >> rulesys >> [ impl overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
com.hp.hpl.jena.reasoner.rulesys.impl.Generator