org.opencyc.cycobject
Class CycListVisitor

java.lang.Object
  |
  +--org.opencyc.cycobject.CycListVisitor
All Implemented Interfaces:
java.util.Enumeration

public class CycListVisitor
extends java.lang.Object
implements java.util.Enumeration

Implements an Enumeration for CycList objects which traverses recursively into embedded CycLists, in a depth-first fashion, returning the objects which are both non-CycList and non-nil.

Author:
Stephen L. Reed

Copyright 2001 Cycorp, Inc., license is open source GNU LGPL.

the license

www.opencyc.org

OpenCyc at SourceForge

THIS SOFTWARE AND KNOWLEDGE BASE CONTENT ARE PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OPENCYC ORGANIZATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE AND KNOWLEDGE BASE CONTENT, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


Field Summary
protected  java.util.Stack iterators
          Stack of CycList Iterators
protected  java.lang.Object nextElement
          Contains the next Object in the sequence of non-CycList elements of the CycList tree structure.
 
Constructor Summary
CycListVisitor(CycList cycList)
          Constructs a new CycListEnumeration object.
 
Method Summary
protected  void getNextElement()
          Gets the next element in the sequence.
 boolean hasMoreElements()
          Tests if this enumeration contains more elements.
 java.lang.Object nextElement()
          Returns the next element of this enumeration if this enumeration object has at least one more element to provide.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nextElement

protected java.lang.Object nextElement
Contains the next Object in the sequence of non-CycList elements of the CycList tree structure.

iterators

protected java.util.Stack iterators
Stack of CycList Iterators
Constructor Detail

CycListVisitor

public CycListVisitor(CycList cycList)
Constructs a new CycListEnumeration object.
Parameters:
the - CycList for recursive enumeration.
Method Detail

hasMoreElements

public boolean hasMoreElements()
Tests if this enumeration contains more elements.
Specified by:
hasMoreElements in interface java.util.Enumeration
Returns:
true if and only if this enumeration object contains at least one more element to provide; false otherwise.

nextElement

public java.lang.Object nextElement()
Returns the next element of this enumeration if this enumeration object has at least one more element to provide.
Specified by:
nextElement in interface java.util.Enumeration
Returns:
the next element of this Enumeration.
Throws:
NoSuchElementException - if no more elements exist.

getNextElement

protected void getNextElement()
Gets the next element in the sequence. This method uses recursive descent.