Class OdMatrixIterator<T,​U>

  • Type Parameters:
    T - type of values in matrix
    U - type of matrix container used
    All Implemented Interfaces:
    Iterator<T>, OdDataIterator<T>
    Direct Known Subclasses:
    OdNonPrimitiveMatrixIterator, OdPrimitiveMatrixIterator

    public abstract class OdMatrixIterator<T,​U>
    extends Object
    implements OdDataIterator<T>
    BAse matrix oriented Iterator which runs through rows and columns of some matrix type of container, making the value, row and column of each cell available
    Author:
    gman6028, markr
    • 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 OdZones zones
        Zones object to store travel analysis zones (from Zoning object)
    • Constructor Detail

      • OdMatrixIterator

        public OdMatrixIterator​(U matrixContents,
                                OdZones zones)
        Constructor
        Parameters:
        matrixContents - matrix object containing the data to be iterated through
        zones - Zones object defining the zones in the network
    • Method Detail

      • updateCurrentLocation

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

        protected U getMatrixContent()
        Collect contents as type
        Returns:
        matrix content value
      • 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
      • next

        public T next()
        Specified by:
        next in interface Iterator<T>