Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.hp.hpl.jena.reasoner.rulesys.impl
Class ConsumerChoicePointFrame  view ConsumerChoicePointFrame download ConsumerChoicePointFrame.java

java.lang.Object
  extended bycom.hp.hpl.jena.reasoner.rulesys.impl.FrameObject
      extended bycom.hp.hpl.jena.reasoner.rulesys.impl.GenericChoiceFrame
          extended bycom.hp.hpl.jena.reasoner.rulesys.impl.GenericTripleMatchFrame
              extended bycom.hp.hpl.jena.reasoner.rulesys.impl.ConsumerChoicePointFrame
All Implemented Interfaces:
LPAgendaEntry, LPInterpreterState

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.

Version:
$Revision: 1.9 $ on $Date: 2005/04/12 17:01:41 $

Field Summary
protected  LPInterpreterContext context
          The generator or top iterator we are producting results for
protected  Generator generator
          The generator whose tabled results we are selecting over
protected  com.hp.hpl.jena.graph.Node[] pVars
          The preserved permanent registers for the pickled interpreter
protected  int resultIndex
          The index in the generator's result set that we have reached so far.
protected  int trailLength
          The length of the preserved trail
protected  com.hp.hpl.jena.graph.Node[] trailValues
          The preserved trail bound values for the picked interpreter
protected  com.hp.hpl.jena.reasoner.rulesys.Node_RuleVariable[] trailVars
          The preserved trail variables for the picked interpreter
 
Fields inherited from class com.hp.hpl.jena.reasoner.rulesys.impl.GenericTripleMatchFrame
goal, objectFunctor, objectVar, predicateVar, subjectVar
 
Fields inherited from class com.hp.hpl.jena.reasoner.rulesys.impl.GenericChoiceFrame
cac, cpc, envFrame, trailIndex
 
Fields inherited from class com.hp.hpl.jena.reasoner.rulesys.impl.FrameObject
link
 
Constructor Summary
ConsumerChoicePointFrame(LPInterpreter interpreter)
          Constructor.
 
Method Summary
 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(java.util.List 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.
 
Methods inherited from class com.hp.hpl.jena.reasoner.rulesys.impl.GenericTripleMatchFrame
bindResult, functorMatch
 
Methods inherited from class com.hp.hpl.jena.reasoner.rulesys.impl.GenericChoiceFrame
setContinuation
 
Methods inherited from class com.hp.hpl.jena.reasoner.rulesys.impl.FrameObject
close, fastLinkTo, getLink, linkTo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

generator

protected Generator generator
The generator whose tabled results we are selecting over


resultIndex

protected int resultIndex
The index in the generator's result set that we have reached so far.


pVars

protected com.hp.hpl.jena.graph.Node[] pVars
The preserved permanent registers for the pickled interpreter


trailVars

protected com.hp.hpl.jena.reasoner.rulesys.Node_RuleVariable[] trailVars
The preserved trail variables for the picked interpreter


trailValues

protected com.hp.hpl.jena.graph.Node[] trailValues
The preserved trail bound values for the picked interpreter


trailLength

protected int trailLength
The length of the preserved trail


context

protected LPInterpreterContext context
The generator or top iterator we are producting results for

Constructor Detail

ConsumerChoicePointFrame

public ConsumerChoicePointFrame(LPInterpreter interpreter)
Constructor.

Method Detail

init

public void init(LPInterpreter interpreter)
Initialize the choice point state.

Overrides:
init in class GenericTripleMatchFrame

preserveState

public void preserveState(java.util.List trail)
Preserve the state of an interpreter into this frame.


restoreState

public void restoreState(LPInterpreter interp)
Restore the state of an interpreter from this frame


nextMatch

public StateFlag nextMatch(LPInterpreter interpreter)
Find the next result triple and bind the result vars appropriately.


isReady

public boolean isReady()
Return true if this choice point could usefully be restarted.

Specified by:
isReady in interface LPAgendaEntry

setReady

public void setReady()
Called by generator when there are more results available.


setFinished

public void setFinished()
Notify that this consumer choice point has finished consuming all the results of a closed generator.


pump

public void pump()
Reactivate this choice point to return new results.

Specified by:
pump in interface LPAgendaEntry

getGenerator

public Generator getGenerator()
Return the generator associated with this entry (might be the entry itself)

Specified by:
getGenerator in interface LPAgendaEntry

getConsumingContext

public LPInterpreterContext getConsumingContext()
Return the interpeter context which is reading the results of this consumer.