Package org.planit.od

Class ODDataIteratorImpl<T>

  • Type Parameters:
    T - the type of data to be stored for each origin-destination cell
    All Implemented Interfaces:
    Iterator<T>, ODDataIterator<T>
    Direct Known Subclasses:
    ODMatrixIterator, ODPathIterator

    public abstract class ODDataIteratorImpl<T>
    extends Object
    implements ODDataIterator<T>
    Base class containing common methods required by all classes which implement ODDataIterator
    Author:
    gman6028
    • Field Detail

      • originId

        protected int originId
        Id of the origin zone
      • destinationId

        protected int destinationId
        Id of the destination zone
      • currentLocation

        protected int currentLocation
        Marker used to store the current position in the OD matrix (used internally, not accessible from other classes)
      • zones

        protected Zones<?> zones
        Zones object to store travel analysis zones (from Zoning object)
    • Constructor Detail

      • ODDataIteratorImpl

        public ODDataIteratorImpl​(Zones<?> zones)
        Constructor
        Parameters:
        zones - zones considered in the matrix
    • Method Detail

      • updateCurrentLocation

        protected void updateCurrentLocation()
        Increment the location cursor for the next iteration
      • hasNext

        public boolean hasNext()
        Tests whether there are any more cells to iterate through
        Specified by:
        hasNext in interface Iterator<T>
        Returns:
        true if there are more cells to iterate through, false otherwise
      • getCurrentOrigin

        public Zone getCurrentOrigin()
        Returns the origin zone object for the current cell
        Specified by:
        getCurrentOrigin in interface ODDataIterator<T>
        Returns:
        the origin zone object at the current cell
      • getCurrentDestination

        public Zone getCurrentDestination()
        Returns the destination zone object for the current cell
        Specified by:
        getCurrentDestination in interface ODDataIterator<T>
        Returns:
        the destination zone object for the current cell