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.oldCode
Class TopGoalIterator  view TopGoalIterator download TopGoalIterator.java

java.lang.Object
  extended bycom.hp.hpl.jena.reasoner.rulesys.impl.oldCode.TopGoalIterator
All Implemented Interfaces:
java.util.Iterator

public class TopGoalIterator
extends java.lang.Object
implements java.util.Iterator

Wraps up the backward chaining engine as an iterator-like object that can be used in InfGraphs to implement a "find" operation. It creates a top level GoalState and pumps that for results until the agenda is empty.

Version:
$Revision: 1.4 $ on $Date: 2005/02/21 12:18:06 $

Field Summary
(package private)  BRuleEngine engine
          The parent backward chaining engine
(package private)  GoalState goalState
          The GoalState which is traversing the top level derivation tree
(package private)  java.lang.Object lookAhead
          The next result to be returned, or null if we have finished
 
Constructor Summary
TopGoalIterator(BRuleEngine engine, com.hp.hpl.jena.reasoner.TriplePattern goal)
          Constructor.
 
Method Summary
 void close()
           
 boolean hasNext()
          Tests whether there are elements remaining in the collection.
private  void moveForward()
          Find the next result in the goal state and put it in the lookahead buffer.
 java.lang.Object next()
          Obtain the next element in the collection.
 void remove()
          Remove from the underlying collection the last element returned by next (optional operation).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

goalState

GoalState goalState
The GoalState which is traversing the top level derivation tree


lookAhead

java.lang.Object lookAhead
The next result to be returned, or null if we have finished


engine

BRuleEngine engine
The parent backward chaining engine

Constructor Detail

TopGoalIterator

public TopGoalIterator(BRuleEngine engine,
                       com.hp.hpl.jena.reasoner.TriplePattern goal)
Constructor. Wraps a top level goal state as an iterator

Method Detail

moveForward

private void moveForward()
Find the next result in the goal state and put it in the lookahead buffer.


close

public void close()

hasNext

public boolean hasNext()
Description copied from interface: java.util.Iterator
Tests whether there are elements remaining in the collection. In other words, calling next() will not throw an exception.

Specified by:
hasNext in interface java.util.Iterator

next

public java.lang.Object next()
Description copied from interface: java.util.Iterator
Obtain the next element in the collection.

Specified by:
next in interface java.util.Iterator

remove

public void remove()
Description copied from interface: java.util.Iterator
Remove from the underlying collection the last element returned by next (optional operation). This method can be called only once after each call to next(). It does not affect what will be returned by subsequent calls to next.

Specified by:
remove in interface java.util.Iterator