org.tigris.gef.util
Class EnumerationPredicate

java.lang.Object
  extended by org.tigris.gef.util.EnumerationPredicate
All Implemented Interfaces:
java.io.Serializable, java.util.Enumeration

public class EnumerationPredicate
extends java.lang.Object
implements java.util.Enumeration, java.io.Serializable

Step through the elements of some other enumeration, but skip over any elements that do not satisfy the given predicate.

See Also:
Serialized Form

Field Summary
protected  java.util.Enumeration _enum
          The normal enumeration that this EnumerationPredicate is moving through.
protected  Predicate _filter
          The predicate that must be satisfied in order for a given element to be returned by nextElement().
protected  java.lang.Object _nextElement
          The element that will be returned on the next call to nextElement().
 
Constructor Summary
EnumerationPredicate(java.util.Enumeration e, Predicate p)
           
 
Method Summary
protected  void findNext()
          Internal method to find the next element that satisfies the predicate and store it in _nextElement.
 boolean hasMoreElements()
          Reply true iff there are more elements in the given enumeration that satisfy the given predicate.
 java.lang.Object nextElement()
          Reply the next element in the given enumeration that satisfies the given predicate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_enum

protected java.util.Enumeration _enum
The normal enumeration that this EnumerationPredicate is moving through.


_filter

protected Predicate _filter
The predicate that must be satisfied in order for a given element to be returned by nextElement().


_nextElement

protected java.lang.Object _nextElement
The element that will be returned on the next call to nextElement(). This element is "on deck".

Constructor Detail

EnumerationPredicate

public EnumerationPredicate(java.util.Enumeration e,
                            Predicate p)
Method Detail

hasMoreElements

public boolean hasMoreElements()
Reply true iff there are more elements in the given enumeration that satisfy the given predicate.

Specified by:
hasMoreElements in interface java.util.Enumeration

nextElement

public java.lang.Object nextElement()
Reply the next element in the given enumeration that satisfies the given predicate.

Specified by:
nextElement in interface java.util.Enumeration

findNext

protected void findNext()
Internal method to find the next element that satisfies the predicate and store it in _nextElement.