Class ZonesImpl<Z extends Zone>

  • Type Parameters:
    Z - zone type
    All Implemented Interfaces:
    Iterable<Z>, Zones<Z>
    Direct Known Subclasses:
    OdZonesImpl, TransferZonesImpl

    public abstract class ZonesImpl<Z extends Zone>
    extends Object
    implements Zones<Z>
    Partial implementation of the Zones <T> interface
    Author:
    markr
    • Field Detail

      • zoneMap

        protected final Map<Long,​Z extends Zone> zoneMap
        Map storing all the zones by their row/column in the OD matrix
    • Constructor Detail

      • ZonesImpl

        public ZonesImpl​(IdGroupingToken tokenId)
        Constructor
        Parameters:
        tokenId - to use for id generation
    • Method Detail

      • getGroupingTokenId

        protected IdGroupingToken getGroupingTokenId()
        access to the id generation token
        Returns:
        id grouping token
      • register

        public Z register​(Z zone)
        Add zone to the internal container. Use carefully to avoid issues with internal contiguous ids
        Specified by:
        register in interface Zones<Z extends Zone>
        Parameters:
        zone - the zone to be added
        Returns:
        the zone added
      • get

        public Z get​(long id)
        Retrieve zone by its Id
        Specified by:
        get in interface Zones<Z extends Zone>
        Parameters:
        id - the id of the zone
        Returns:
        zone the zone retrieved
      • size

        public int size()
        Collect number of zones
        Specified by:
        size in interface Zones<Z extends Zone>
        Returns:
        the number of zones