code.space
Class EnumTerm

java.lang.Object
  extended by code.space.EnumTerm

public class EnumTerm
extends java.lang.Object

This class provides an enumerator of the maximal operation-rooted subterms of a term.

Since:
July 21, 2003
Author:
Sergio Antoy

Nested Class Summary
 class EnumTerm.FailureException
           
private  class EnumTerm.Tagger
           
 
Field Summary
private static int closureId
           
private  java.lang.Object current
           
private  boolean more
           
private  java.util.Stack stack
           
 
Constructor Summary
EnumTerm(Term term)
          Constructs an enumerator of the argument's elements.
 
Method Summary
private  void doit()
          This method maintains the values that the interface methods return.
 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

closureId

private static int closureId

stack

private java.util.Stack stack

current

private java.lang.Object current

more

private boolean more
Constructor Detail

EnumTerm

public EnumTerm(Term term)
Constructs an enumerator of the argument's elements.

Parameters:
term - The term whose maximal operation-rooted subterms will be enumerated.
Method Detail

hasMoreElements

public boolean hasMoreElements()
Tests if this enumeration contains more elements.

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()
                             throws EnumTerm.FailureException
Returns the next element of this enumeration if this enumeration object has at least one more element to provide.

Returns:
the next element of this enumeration.
Throws:
java.util.NoSuchElementException - if no more elements exist.
EnumTerm.FailureException

doit

private void doit()
           throws EnumTerm.FailureException
This method maintains the values that the interface methods return. It should be called by the constructor and after an element of the iteration is returned.

Execute a pre-order, left-to-right traversal.

Throws:
EnumTerm.FailureException