Package org.goplanit.demands
Class Demands
- java.lang.Object
- 
- org.goplanit.component.PlanitComponent<Demands>
- 
- org.goplanit.demands.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 SummaryFields Modifier and Type Field Description DemandsModifierdemandModifiermodifier features for demandsprotected TreeMap<Long,TreeMap<Mode,OdDemands>>odDemandsByTimePeriodAndModeTrip demand matricesTimePeriodstimePeriodsinternal class instance containing all time periods on this demand instanceTravellerTypestravelerTypesinternal class instance containing all traveler types on this demand instanceUserClassesuserClassesinternal class instance containing all user classes on this demand instance
 - 
Constructor SummaryConstructors Constructor Description Demands(Demands other, boolean deepCopy)Copy constructorDemands(IdGroupingToken groupId)Constructor
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 entityDemandsdeepClone()deep clone on planit component should attempt to also update internal dependencies between deep cloned containers where possibleOdDemandsget(Mode mode, TimePeriod timePeriod)Get an OdDemand by mode and time period in pcu/hourDemandsModifiergetDemandsModifier()access to modifier featuresSet<Mode>getRegisteredModesForTimePeriod(TimePeriod timePeriod)Get modes registered for the given time periodvoidlogInfo(String prefix)Log general information on this demands to the userOdDemandsregisterOdDemandPcuHour(TimePeriod timePeriod, Mode mode, OdDemands odDemandsPcuHour)Register provided odDemandvoidreset()reset all demands, traveler types, time periods and user classesDemandsshallowClone()Create a shallow copy of this entityvoidupdateUserClassTravellerTypes(Function<TravellerType,TravellerType> ttToTtMapping, boolean removeMissingMappings)Update the traveller type of all user classes based on the mapping provided (if any)- 
Methods inherited from class org.goplanit.component.PlanitComponentequals, getComponentType, getExternalId, getId, getIdGroupingToken, getKnownSupportedEventTypes, getXmlId, hashCode, onPlanitComponentEvent, setExternalId, setXmlId
 - 
Methods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface org.goplanit.utils.event.EventListenerhasKnownSupportedEventTypes
 - 
Methods inherited from interface org.goplanit.utils.id.ExternalIdAbleappendExternalId, appendExternalId, getIdsAsString, getSplitExternalId, getSplitExternalId, hasExternalId, hasXmlId, setXmlId
 - 
Methods inherited from interface org.goplanit.utils.id.IdAblecompareTo, idEquals, idHashCode
 
- 
 
- 
- 
- 
Field Detail- 
odDemandsByTimePeriodAndModeprotected final TreeMap<Long,TreeMap<Mode,OdDemands>> odDemandsByTimePeriodAndMode Trip demand matrices
 - 
timePeriodspublic final TimePeriods timePeriods internal class instance containing all time periods on this demand instance
 - 
userClassespublic final UserClasses userClasses internal class instance containing all user classes on this demand instance
 - 
travelerTypespublic final TravellerTypes travelerTypes internal class instance containing all traveler types on this demand instance
 - 
demandModifierpublic final DemandsModifier demandModifier modifier features for demands
 
- 
 - 
Constructor Detail- 
Demandspublic Demands(IdGroupingToken groupId) Constructor- Parameters:
- groupId- contiguous id generation within this group for instances of this class
 
 - 
Demandspublic Demands(Demands other, boolean deepCopy) Copy constructor- Parameters:
- other- to copy
- deepCopy- when true, create a deep copy, shallow copy otherwise
 
 
- 
 - 
Method Detail- 
updateUserClassTravellerTypespublic 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
 
 - 
registerOdDemandPcuHourpublic 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
 
 - 
getpublic 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
 
 - 
getRegisteredModesForTimePeriodpublic 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
 
 - 
shallowClonepublic Demands shallowClone() Create a shallow copy of this entity- Specified by:
- shallowClonein interface- IdAble
- Specified by:
- shallowClonein class- PlanitComponent<Demands>
- Returns:
- shallow copy of entity
 
 - 
deepClonepublic Demands deepClone() deep clone on planit component should attempt to also update internal dependencies between deep cloned containers where possible- Specified by:
- deepClonein interface- IdAble
- Specified by:
- deepClonein class- PlanitComponent<Demands>
- Returns:
- deep copy of entity
 
 - 
logInfopublic void logInfo(String prefix) Log general information on this demands to the user- Parameters:
- prefix- to use
 
 - 
resetpublic void reset() reset all demands, traveler types, time periods and user classes- Specified by:
- resetin class- PlanitComponent<Demands>
 
 - 
getDemandsModifierpublic DemandsModifier getDemandsModifier() access to modifier features- Returns:
- demand modifier
 
 - 
collectSettingsAsKeyValueMappublic 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:
- collectSettingsAsKeyValueMapin class- PlanitComponent<Demands>
- Returns:
- name-value map of all (user configurable) settings
 
 
- 
 
-