|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gishur.core.CursorAdapter | +--gishur.graph.core.GraphCursor | +--gishur.graph.core.TraverseCursor
A traversal-cursor, that extends GraphCursor
and uses a given
TraverseAlgorithmCursor
for navigation.
For an example we use the BFSCursor
class that implements the
BFSCursor bfs=new BFCursor(graph); TraverseCursor cursor=new TraverseCursor(bfs); for (cursor.top();cursor.valid();cursor.next()) { ... // do something }
Constructor Summary | |
TraverseCursor(TraverseAlgorithmCursor cursor)
Constructs a new TraverseCursor that uses the traversal algorithm
specified via the given TraverseAlgorithmCursor . |
Method Summary | |
java.lang.Object |
element()
Returns the element to which this Cursor points at the moment. |
Graph |
graph()
Returns the Graph , on which the Cursor works. |
void |
invalidate()
Sets the Cursor to an invalid position. |
int |
length()
Returns the number of elements in the underlying structure of this Cursor . |
void |
relative(int step)
Moves the Cursor step positions within the underlying
structure. |
java.lang.String |
toString()
Overrides java.lang.Object.toString() . |
boolean |
valid()
Checks if the Cursor's actual position is valid. |
Methods inherited from class gishur.graph.core.GraphCursor |
addFilter, edge, filter, graphElement, isEdge, isNode, node, removeFilter, set, validElement |
Methods inherited from class gishur.core.CursorAdapter |
bottom, getBookmark, hasMoreElements, next, next, nextElement, prev, prev, set, set, top |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public TraverseCursor(TraverseAlgorithmCursor cursor)
TraverseCursor
that uses the traversal algorithm
specified via the given TraverseAlgorithmCursor
.cursor
- the TraverseAlgorithmCursor
used for navigationMethod Detail |
public java.lang.String toString()
java.lang.Object.toString()
.toString
in class java.lang.Object
Object.toString()
public Graph graph()
Graph
, on which the Cursor
works.graph
in class GraphCursor
Graph
, on which the Cursor
works.public java.lang.Object element()
Cursor
points at the moment.Cursor
public void relative(int step)
Cursor
step
positions within the underlying
structure.step
- the number of elements to movepublic boolean valid()
Cursor's
actual position is valid.true
, if the Cursor
points to a
valid position, and false
otherwisepublic void invalidate()
Cursor
to an invalid position.public int length()
Cursor
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |