Search this API

y.base
Interface YCursor

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

public interface YCursor

A general interface for iterating over a collection of objects. It can be regarded as a read-only view of such a collection.

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 cursor itself. (That's why the cursor presents a read-only view.)

Implementations of this interface do not need to support operations marked "optional."

 

Method Summary
 java.lang.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

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


next

void next()
Moves this cursor one position forward.


prev

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


toFirst

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


toLast

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


current

java.lang.Object current()
Returns the object currently pointed on.


size

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


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