Class BlossomVNode.IncidentEdgeIterator

  • All Implemented Interfaces:
    java.util.Iterator<BlossomVEdge>
    Enclosing class:
    BlossomVNode

    public class BlossomVNode.IncidentEdgeIterator
    extends java.lang.Object
    implements java.util.Iterator<BlossomVEdge>
    An iterator for traversing the edges incident to this node.

    This iterator has a feature that during every step it knows the next edge it'll return to the caller. That's why it is safe to modify the current edge (move it to another node, for example).

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int currentDir
      The direction of the current edge
      private int nextDir
      Direction of the nextEdge
      private BlossomVEdge nextEdge
      The edge that will be returned after the next call to next().
    • Constructor Summary

      Constructors 
      Constructor Description
      IncidentEdgeIterator()
      Constructs a new instance of the IncidentEdgeIterator.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private void advance()
      Advances this iterator to the next incident edge.
      int getDir()
      Returns the direction of the edge returned by this iterator
      boolean hasNext()  
      BlossomVEdge next()  
      • 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

        forEachRemaining, remove
    • Field Detail

      • currentDir

        private int currentDir
        The direction of the current edge
      • nextDir

        private int nextDir
        Direction of the nextEdge
      • nextEdge

        private BlossomVEdge nextEdge
        The edge that will be returned after the next call to next(). Is null if all incident edges of the current node have been traversed.
    • Constructor Detail

      • IncidentEdgeIterator

        public IncidentEdgeIterator()
        Constructs a new instance of the IncidentEdgeIterator.
    • Method Detail

      • getDir

        public int getDir()
        Returns the direction of the edge returned by this iterator
        Returns:
        the direction of the edge returned by this iterator
      • hasNext

        public boolean hasNext()
        Specified by:
        hasNext in interface java.util.Iterator<BlossomVEdge>
      • advance

        private void advance()
        Advances this iterator to the next incident edge. If previous edge was the last one with direction 0, then the direction of this iterator changes. If previous edge was the last incident edge, then nextEdge becomes null.