org.jgrapht.traverse

## Class AbstractGraphIterator<V,E>

- java.lang.Object
- - org.jgrapht.traverse.AbstractGraphIterator<V,E>

- All Implemented Interfaces:
    Iterator<V>, GraphIterator<V,E>
  Direct Known Subclasses:
    CrossComponentIterator

      public abstract class AbstractGraphIterator<V,E>
      extends Object
      implements GraphIterator<V,E>

  An empty implementation of a graph iterator to minimize the effort required to implement graph iterators.
  Since:
    Jul 19, 2003
  Author:
    Barak Naveh

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected int` | `nListeners`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractGraphIterator()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addTraversalListener(TraversalListener<V,E> l)` Adds the specified traversal listener to this iterator.
    `protected void` | `fireConnectedComponentFinished(ConnectedComponentTraversalEvent e)` Informs all listeners that the traversal of the current connected component finished.
    `protected void` | `fireConnectedComponentStarted(ConnectedComponentTraversalEvent e)` Informs all listeners that a traversal of a new connected component has started.
    `protected void` | `fireEdgeTraversed(EdgeTraversalEvent<V,E> e)` Informs all listeners that a the specified edge was visited.
    `protected void` | `fireVertexFinished(VertexTraversalEvent<V> e)` Informs all listeners that a the specified vertex was finished.
    `protected void` | `fireVertexTraversed(VertexTraversalEvent<V> e)` Informs all listeners that a the specified vertex was visited.
    `boolean` | `isCrossComponentTraversal()` Test whether this iterator is set to traverse the graph across connected components.
    `boolean` | `isReuseEvents()` Tests whether the `reuseEvents` flag is set.
    `void` | `remove()` Unsupported.
    `void` | `removeTraversalListener(TraversalListener<V,E> l)` Removes the specified traversal listener from this iterator.
    `void` | `setCrossComponentTraversal(boolean crossComponentTraversal)` Sets the cross component traversal flag - indicates whether to traverse the graph across connected components.
    `void` | `setReuseEvents(boolean reuseEvents)` Sets a value the `reuseEvents` flag.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface java.util.Iterator

      `hasNext, next`

- - ### Field Detail

    - #### nListeners

          protected int nListeners

  - ### Constructor Detail

    - #### AbstractGraphIterator

          public AbstractGraphIterator()

  - ### Method Detail

    - #### setCrossComponentTraversal

          public void setCrossComponentTraversal(boolean crossComponentTraversal)

      Sets the cross component traversal flag - indicates whether to traverse the graph across connected components.
      Parameters:
        `crossComponentTraversal` - if `true` traverses across connected components.

    - #### isCrossComponentTraversal

          public boolean isCrossComponentTraversal()

      Test whether this iterator is set to traverse the graph across connected components.
      Specified by:
        `isCrossComponentTraversal` in interface `GraphIterator<V,E>`
      Returns:
        `true` if traverses across connected components, otherwise `false`.

    - #### setReuseEvents

          public void setReuseEvents(boolean reuseEvents)

      Description copied from interface: `GraphIterator`
      Sets a value the `reuseEvents` flag. If the `reuseEvents` flag is set to `true` this class will reuse previously fired events and will not create a new object for each event. This option increases performance but should be used with care, especially in multithreaded environment.
      Specified by:
        `setReuseEvents` in interface `GraphIterator<V,E>`
      Parameters:
        `reuseEvents` - whether to reuse previously fired event objects instead of creating a new event object for each event.
      See Also:
        `GraphIterator.setReuseEvents(boolean)`

    - #### isReuseEvents

          public boolean isReuseEvents()

      Description copied from interface: `GraphIterator`
      Tests whether the `reuseEvents` flag is set. If the flag is set to `true` this class will reuse previously fired events and will not create a new object for each event. This option increases performance but should be used with care, especially in multithreaded environment.
      Specified by:
        `isReuseEvents` in interface `GraphIterator<V,E>`
      Returns:
        the value of the `reuseEvents` flag.
      See Also:
        `GraphIterator.isReuseEvents()`

    - #### addTraversalListener

          public void addTraversalListener(TraversalListener<V,E> l)

      Adds the specified traversal listener to this iterator.
      Specified by:
        `addTraversalListener` in interface `GraphIterator<V,E>`
      Parameters:
        `l` - the traversal listener to be added.

    - #### remove

          public void remove()

      Unsupported.
      Specified by:
        `remove` in interface `Iterator<V>`
      Specified by:
        `remove` in interface `GraphIterator<V,E>`
      Throws:
        `UnsupportedOperationException`

    - #### removeTraversalListener

          public void removeTraversalListener(TraversalListener<V,E> l)

      Removes the specified traversal listener from this iterator.
      Specified by:
        `removeTraversalListener` in interface `GraphIterator<V,E>`
      Parameters:
        `l` - the traversal listener to be removed.

    - #### fireConnectedComponentFinished

          protected void fireConnectedComponentFinished(ConnectedComponentTraversalEvent e)

      Informs all listeners that the traversal of the current connected component finished.
      Parameters:
        `e` - the connected component finished event.

    - #### fireConnectedComponentStarted

          protected void fireConnectedComponentStarted(ConnectedComponentTraversalEvent e)

      Informs all listeners that a traversal of a new connected component has started.
      Parameters:
        `e` - the connected component started event.

    - #### fireEdgeTraversed

          protected void fireEdgeTraversed(EdgeTraversalEvent<V,E> e)

      Informs all listeners that a the specified edge was visited.
      Parameters:
        `e` - the edge traversal event.

    - #### fireVertexTraversed

          protected void fireVertexTraversed(VertexTraversalEvent<V> e)

      Informs all listeners that a the specified vertex was visited.
      Parameters:
        `e` - the vertex traversal event.

    - #### fireVertexFinished

          protected void fireVertexFinished(VertexTraversalEvent<V> e)

      Informs all listeners that a the specified vertex was finished.
      Parameters:
        `e` - the vertex traversal event.

Copyright © 2016. All rights reserved.