org.jhotdraw.standard
Class HandleEnumerator
java.lang.Object
org.jhotdraw.standard.HandleEnumerator
- All Implemented Interfaces:
- HandleEnumeration
public class HandleEnumerator
- extends java.lang.Object
- implements HandleEnumeration
- Version:
- <$CURRENT_VERSION$>
- Author:
- Wolfram Kaiser
|
Method Summary |
static HandleEnumeration |
getEmptyEnumeration()
|
boolean |
hasNextHandle()
Returns true if the enumeration contains more elements; false
if its empty. |
Handle |
nextHandle()
Returns the next element of the enumeration. |
void |
reset()
Reset the enumeration so it can be reused again. |
java.util.List |
toList()
Returns a list with all elements currently available in the enumeration. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
myIterator
private java.util.Iterator myIterator
myInitialCollection
private java.util.Collection myInitialCollection
singletonEmptyEnumerator
private static HandleEnumerator singletonEmptyEnumerator
HandleEnumerator
public HandleEnumerator(java.util.Collection c)
hasNextHandle
public boolean hasNextHandle()
- Returns true if the enumeration contains more elements; false
if its empty.
- Specified by:
hasNextHandle in interface HandleEnumeration
nextHandle
public Handle nextHandle()
- Returns the next element of the enumeration. Calls to this
method will enumerate successive elements.
- Specified by:
nextHandle in interface HandleEnumeration
- Throws:
java.util.NoSuchElementException - If no more elements exist.
toList
public java.util.List toList()
- Returns a list with all elements currently available in the enumeration.
That means, elements retrieved already by calling nextHandle() are not
contained. This method does not change the position of the enumeration.
Warning: this method is not necessarily synchronized so this enumeration should not
be modified at the same time!
- Specified by:
toList in interface HandleEnumeration
- Returns:
- list with all elements currently available in the enumeration.
reset
public void reset()
- Reset the enumeration so it can be reused again. However, the
underlying collection might have changed since the last usage
so the elements and the order may vary when using an enumeration
which has been reset.
- Specified by:
reset in interface HandleEnumeration
getEmptyEnumeration
public static HandleEnumeration getEmptyEnumeration()