Class OdNonPrimitiveMatrix<T>

  • All Implemented Interfaces:
    Cloneable, Comparable<IdAble>, Iterable<T>, IdAble, OdData<T>, OdMatrix<T,​T[][]>
    Direct Known Subclasses:
    OdPathMatrix

    public abstract class OdNonPrimitiveMatrix<T>
    extends OdMatrixImpl<T,​T[][]>
    This class contains common methods for handling origin-demand matrices where values are non primitive types, i.e. Objects of some type. Data container used is a raw array of a fixed size based on the Od number of zones. Cells that have no value entry will still take up space in this implementation. If the matrix is dense and contains very little empty cells, this is likely the most computationally efficient implementation, if not, consider other implementations that deal better with sparse matrices in terms of memory usage.
    Author:
    gman6028m, markr
    • Constructor Detail

      • OdNonPrimitiveMatrix

        public OdNonPrimitiveMatrix​(Class<? extends IdAble> idTokenClass,
                                    IdGroupingToken idToken,
                                    OdZones zones,
                                    T[][] matrixContents)
        Constructor for full Od matrix containing non-primitives, i.e. object based
        Parameters:
        idTokenClass - to use for id generation
        idToken - to use for the matrix id
        zones - holder for zones considered in the matrix
        matrixContents - container for the matrix contents
      • OdNonPrimitiveMatrix

        public OdNonPrimitiveMatrix​(OdNonPrimitiveMatrix<T> other)
        Copy constructor
        Parameters:
        other - to copy from
    • Method Detail

      • setValue

        public void setValue​(Zone origin,
                             Zone destination,
                             T value)
        Sets the value for a specified origin and destination
        Parameters:
        origin - specified origin
        destination - specified destination
        value - value at the specified cell
      • getValue

        public T getValue​(Zone origin,
                          Zone destination)
        Returns the value for a specified origin and destination
        Parameters:
        origin - specified origin
        destination - specified destination
        Returns:
        value at the specified cell
      • getValue

        public T getValue​(long originId,
                          long destinationId)
        Returns the value for a specified origin and destination by their internal id
        Parameters:
        originId - specified origin
        destinationId - specified destination
        Returns:
        value at the specified cell