y.base
Interface YCursor

All Known Subinterfaces:
BendCursor, EdgeCursor, EdgePairCursor, FaceCursor, NodeCursor, YLineSegmentCursor, YPointCursor
All Known Implementing Classes:
YList.ListCursorImpl

public interface YCursor

YCursor is a general interface for iterating over a collection of objects. It can be regarded as a read-only view of a collection of elements. A YCursor acts like a movable pointer on the elements of a collection. The pointer can be moved forward and backward and the element currently pointed on can be accessed. The removal of elements can only be performed on the provider of the cursor, not on the read-only cursor itself. Implementations of this interface do not need to support the optional operations of this interface.


Method Summary
 Object current()
          Returns the Object currently pointed on.
 void next()
          Moves this cursor one position forward.
 boolean ok()
          Returns true if the current cursor position is valid.
 void prev()
          Moves this cursor one position backward (optional)
 int size()
          Returns the number of elements that can be accessed with this cursor.
 void toFirst()
          Moves this cursor to the first valid cursor position (optional).
 void toLast()
          Moves this cursor to the last valid cursor position (optional).
 

Method Detail

ok

public boolean ok()
Returns true if the current cursor position is valid.


next

public void next()
Moves this cursor one position forward.


prev

public void prev()
Moves this cursor one position backward (optional)


toFirst

public void toFirst()
Moves this cursor to the first valid cursor position (optional).


toLast

public void toLast()
Moves this cursor to the last valid cursor position (optional).


current

public Object current()
Returns the Object currently pointed on.


size

public int size()
Returns the number of elements that can be accessed with this cursor.


© Copyright 2000-2003,
yWorks GmbH.
All rights reserved.

2003