jdsl.graph.ref
Class VertexIteratorAdapter

java.lang.Object
  |
  +--jdsl.graph.ref.VertexIteratorAdapter
All Implemented Interfaces:
ObjectIterator, PositionIterator, VertexIterator

public class VertexIteratorAdapter
extends java.lang.Object
implements VertexIterator

Takes an ObjectIterator known to be iterating over things that are Vertices, and makes it appear as an VertexIterator.

Version:
$Id: VertexIteratorAdapter.java,v 1.1 1999/08/31 21:07:47 mdh Exp $
Author:
Mark Handy

Constructor Summary
VertexIteratorAdapter(ObjectIterator pi)
           
 
Method Summary
 java.lang.Object element()
          Shortcut for position().element().
 boolean hasNext()
           
 java.lang.Object nextObject()
           
 Position nextPosition()
           
 Vertex nextVertex()
           
 java.lang.Object object()
           
 Position position()
           
 void reset()
          Puts the iterator back in its initial, before-the-first state
 Vertex vertex()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VertexIteratorAdapter

public VertexIteratorAdapter(ObjectIterator pi)
Method Detail

hasNext

public boolean hasNext()
Specified by:
hasNext in interface ObjectIterator
Following copied from interface: jdsl.core.api.ObjectIterator
Returns:
Whether there is at least one object still unseen

nextObject

public java.lang.Object nextObject()
Specified by:
nextObject in interface ObjectIterator
Following copied from interface: jdsl.core.api.ObjectIterator
Returns:
Next object to consider
Throws:
java.util.NoSuchElementException - if iterator has moved past the last object

nextPosition

public Position nextPosition()
Specified by:
nextPosition in interface PositionIterator
Following copied from interface: jdsl.core.api.PositionIterator
Returns:
Next position to consider
Throws:
java.util.NoSuchElementException - if iterator has moved past the last position to be seen

nextVertex

public Vertex nextVertex()
Specified by:
nextVertex in interface VertexIterator
Following copied from interface: jdsl.graph.api.VertexIterator
Returns:
Next vertex to consider
Throws:
java.util.NoSuchElementException - if iterator has moved past the last vertex to be seen

object

public java.lang.Object object()
Specified by:
object in interface ObjectIterator
Following copied from interface: jdsl.core.api.ObjectIterator
Returns:
The object returned by the most recent next()
Throws:
java.util.NoSuchElementException - When the iterator is in its initial, before-the-first-object state

position

public Position position()
Specified by:
position in interface PositionIterator
Following copied from interface: jdsl.core.api.PositionIterator
Returns:
The position returned by the most recent next()
Throws:
java.util.NoSuchElementException - When the iterator is in its initial, before-the-first-position state

vertex

public Vertex vertex()
Specified by:
vertex in interface VertexIterator
Following copied from interface: jdsl.graph.api.VertexIterator
Returns:
The vertex returned by the most recent next()
Throws:
java.util.NoSuchElementException - When the iterator is in its initial, before-the-first-vertex state

element

public java.lang.Object element()
Description copied from interface: PositionIterator
Shortcut for position().element(). Same as the inherited object() method.
Specified by:
element in interface PositionIterator
Following copied from interface: jdsl.core.api.PositionIterator
Returns:
Element of the position that would be returned by position()
Throws:
java.util.NoSuchElementException - When the iterator is in its initial, before-the-first-position state

reset

public void reset()
Description copied from interface: ObjectIterator
Puts the iterator back in its initial, before-the-first state
Specified by:
reset in interface ObjectIterator