Class Demands

  • All Implemented Interfaces:
    Serializable, Comparable<IdAble>, EventListener, PlanitComponentListener, EventListener, ExternalIdAble, IdAble

    public class Demands
    extends PlanitComponent<Demands>
    implements Serializable
    Container class for all demands registered on the project. In PlanIt we assume that all traffic flows between an origin and destination. Hence all demand for a given time period and mode is provided between an origin and destination via ODDemand. Further, unlike other components, we let anyone register OdDemand compatible instances on this class to provide maximum flexibility in the underlying container since depending on the od data different containers might be preferred for optimizing memory usage. Also not all OdDemand instances on the same Demands instance might utilize the same data structure, hence the need to avoid a general approach across all entries within a Demands instance
    Author:
    markr
    See Also:
    Serialized Form
    • Field Detail

      • timePeriods

        public final TimePeriods timePeriods
        internal class instance containing all time periods on this demand instance
      • userClasses

        public final UserClasses userClasses
        internal class instance containing all user classes on this demand instance
      • travelerTypes

        public final TravellerTypes travelerTypes
        internal class instance containing all traveler types on this demand instance
      • demandModifier

        public final DemandsModifier demandModifier
        modifier features for demands
    • Constructor Detail

      • Demands

        public Demands​(IdGroupingToken groupId)
        Constructor
        Parameters:
        groupId - contiguous id generation within this group for instances of this class
      • Demands

        public Demands​(Demands other,
                       boolean deepCopy)
        Copy constructor
        Parameters:
        other - to copy
        deepCopy - when true, create a deep copy, shallow copy otherwise
    • Method Detail

      • updateUserClassTravellerTypes

        public void updateUserClassTravellerTypes​(Function<TravellerType,​TravellerType> ttToTtMapping,
                                                  boolean removeMissingMappings)
        Update the traveller type of all user classes based on the mapping provided (if any)
        Parameters:
        ttToTtMapping - to use should contain original travellerType as currently used on user class and then the value is the new traveller type to replace it
        removeMissingMappings - when true if there is no mapping, the traveller type is nullified, otherwise they are left in-tact
      • registerOdDemandPcuHour

        public OdDemands registerOdDemandPcuHour​(TimePeriod timePeriod,
                                                 Mode mode,
                                                 OdDemands odDemandsPcuHour)
        Register provided odDemand
        Parameters:
        timePeriod - the time period for this origin-demand object
        mode - the mode for this origin-demand object
        odDemandsPcuHour - the origin-demand object to be registered in pcu/hour
        Returns:
        oldOdDemand if there already existed an odDemand for the given mode and time period, the overwritten entry is returned
      • get

        public OdDemands get​(Mode mode,
                             TimePeriod timePeriod)
        Get an OdDemand by mode and time period in pcu/hour
        Parameters:
        mode - the mode for which the ODDemand object is required
        timePeriod - the time period for which the ODDemand object is required
        Returns:
        ODDemand object if found, otherwise null
      • getRegisteredModesForTimePeriod

        public Set<Mode> getRegisteredModesForTimePeriod​(TimePeriod timePeriod)
        Get modes registered for the given time period
        Parameters:
        timePeriod - the specified time period
        Returns:
        Set of modes for this time period
      • deepClone

        public Demands deepClone()
        deep clone on planit component should attempt to also update internal dependencies between deep cloned containers where possible
        Specified by:
        deepClone in interface IdAble
        Specified by:
        deepClone in class PlanitComponent<Demands>
        Returns:
        deep copy of entity
      • logInfo

        public void logInfo​(String prefix)
        Log general information on this demands to the user
        Parameters:
        prefix - to use
      • reset

        public void reset()
        reset all demands, traveler types, time periods and user classes
        Specified by:
        reset in class PlanitComponent<Demands>
      • getDemandsModifier

        public DemandsModifier getDemandsModifier()
        access to modifier features
        Returns:
        demand modifier
      • collectSettingsAsKeyValueMap

        public Map<String,​String> collectSettingsAsKeyValueMap()
        Provide all the settings of this particular component by name and value, where each value is a string representation of the underlying entity
        Specified by:
        collectSettingsAsKeyValueMap in class PlanitComponent<Demands>
        Returns:
        name-value map of all (user configurable) settings