byucc.jhdl.synth.graph
Class EdgeIterator

java.lang.Object
  extended bybyucc.jhdl.synth.graph.VectorIterator
      extended bybyucc.jhdl.synth.graph.EdgeIterator
All Implemented Interfaces:
GenericIterator, IndexedIterator

public class EdgeIterator
extends VectorIterator

A class to allow a GenericIterator for Edge objects in an EdgeVector. This class simply extends VectorIterator. The constructor guarantees that this will only be constructed with an EdgeVector. The method getEdge is also added to avoid the cast from getElt.

Author:
Carl Worth

Constructor Summary
EdgeIterator(EdgeVector edges)
          Construct a new EdgeIterator from an existing EdgeVector.
 
Method Summary
 boolean deleteEdge()
          Delete the Edge currently pointed at by the iterator.
 boolean deleteEdgeAt(int index)
          Delete the edge that has the given index
 boolean deleteElt()
          Delete the object currently pointed at by the iterator.
 boolean deleteEltAt(int index)
          Delete the Edge that has the given index.
 Edge getEdge()
          Get the Edge at which the Iterator currently points.
 Edge getEdgeAt(int index)
          Get the Edge that has the given index.
 
Methods inherited from class byucc.jhdl.synth.graph.VectorIterator
first, getElt, getEltAt, isValid, last, moveTo, moveTo, next, prev, size, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EdgeIterator

public EdgeIterator(EdgeVector edges)
Construct a new EdgeIterator from an existing EdgeVector.

Method Detail

getEdge

public Edge getEdge()
Get the Edge at which the Iterator currently points.

Returns:
the current Edge

getEdgeAt

public Edge getEdgeAt(int index)
Get the Edge that has the given index. (The current pointer will not be moved.)

Parameters:
index - an index in the range of 0 <= index < size()
Returns:
the Edge in the series with the given index, null if index is out of bounds.

deleteElt

public boolean deleteElt()
Delete the object currently pointed at by the iterator. This call will remove the current Edge from its graph as well as from this iterator's vector.

After calling delete, this iterator's current "pointer" will be at an undefined position, (it may even be invalid). However, calling next() will move it to the element originally after the deleted element and calling prev() will move it to the element originally before element.

Also Note: Any modifications of the series of elements, (ie. deletes or modifications), other than through this iterator may cause undefined effects on the state of this iterator.

Specified by:
deleteElt in interface GenericIterator
Overrides:
deleteElt in class VectorIterator
Returns:
true if the object was deleted false if the current pointer is not valid.

deleteEltAt

public boolean deleteEltAt(int index)
Delete the Edge that has the given index. This call will remove the Edge at the given index from its graph as well as from this iterator's vector.

After calling delete, this iterator's current "pointer" will not be moved. That is, if the object being deleted is not the "current" object then the pointer will still be pointing to the same element it was before the delete. If, however, the current object is deleted then the pointer will be at an undefined position, (it may even be invalid) -- however, calling next() will move it to the element originally after the deleted element and calling prev() will move it to the element originally before element.

Also Note: Any modifications of the series of elements, (ie. deletes or modifications), other than through this iterator may cause undefined effects on the state of this iterator.

Specified by:
deleteEltAt in interface IndexedIterator
Overrides:
deleteEltAt in class VectorIterator
Parameters:
index - the index of an element in the series to delete, index should be in the range 0 <= index < size()
Returns:
true if the Edge was deleted false if the index is out of bounds

deleteEdge

public boolean deleteEdge()
Delete the Edge currently pointed at by the iterator. This call will remove the current Edge from its graph as well as from this iterator's series of elements.

After calling delete, this iterator's current "pointer" will be at an undefined position, (it may even be invalid). However, calling next() will move it to the element originally after the deleted element and calling prev() will move it to the element originally before element.

Also Note: Any modifications of the series of elements, (ie. deletes or modifications), other than through this iterator may cause undefined effects on the state of this iterator.

Returns:
true if the object was deleted false if the current pointer is not valid.
See Also:
deleteElt

deleteEdgeAt

public boolean deleteEdgeAt(int index)
Delete the edge that has the given index

This methid is the same as deleteEltAt. I'm including it here to maintain naming consistencies. (ie. getElt & getEdge, deleteElt, & deleteEdge etc.)

Parameters:
index - the index of the edge to delete index should be in the range 0 <= index < size()
Returns:
true if the object was deleted false if the current pointer is not valid.
See Also:
deleteEltAt


Copyright ? 2006 Brigham Young University, Configurable Computing Laboratory. All Rights Reserved.