JHotDraw 6.0b1

org.jhotdraw.standard
Class SingleFigureEnumerator

java.lang.Object
  extended by org.jhotdraw.standard.SingleFigureEnumerator
All Implemented Interfaces:
FigureEnumeration

public final class SingleFigureEnumerator
extends java.lang.Object
implements FigureEnumeration

An Enumeration that contains only a single Figures. An instance of this enumeration can be used only once to retrieve the figure as the figure is forgotten after the first retrieval.


Constructor Summary
SingleFigureEnumerator(Figure newSingleFigure)
           
 
Method Summary
 boolean hasNextFigure()
          Returns true if the enumeration contains more elements; false if its empty.
 Figure nextFigure()
          Returns the next element of the enumeration.
 void reset()
          Reset the enumeration so it can be reused again.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SingleFigureEnumerator

public SingleFigureEnumerator(Figure newSingleFigure)
Method Detail

hasNextFigure

public boolean hasNextFigure()
Returns true if the enumeration contains more elements; false if its empty.

Specified by:
hasNextFigure in interface FigureEnumeration

nextFigure

public Figure nextFigure()
Returns the next element of the enumeration. Calls to this method will enumerate successive elements.

Specified by:
nextFigure in interface FigureEnumeration
Throws:
java.util.NoSuchElementException - If no more elements exist.

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 FigureEnumeration

JHotDraw 6.0b1