Package org.goplanit.demands
Class Demands
- java.lang.Object
-
- org.goplanit.component.PlanitComponent<Demands>
-
- org.goplanit.demands.Demands
-
- All Implemented Interfaces:
Serializable
,Cloneable
,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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
Demands.TimePeriods
Inner class to register and store time periods for the current demand objectclass
Demands.TravelerTypes
Inner class to register and store traveler types for the current demand objectclass
Demands.UserClasses
Inner class to register and store user classes for the current demand object
-
Field Summary
Fields Modifier and Type Field Description protected TreeMap<Long,TreeMap<Mode,OdDemands>>
odDemandsByTimePeriodAndMode
Trip demand matricesDemands.TimePeriods
timePeriods
internal class instance containing all time periods on this demand instanceDemands.TravelerTypes
travelerTypes
internal class instance containing all traveler types on this demand instanceDemands.UserClasses
userClasses
internal class instance containing all user classes on this demand instance
-
Constructor Summary
Constructors Constructor Description Demands(Demands other)
Copy constructorDemands(IdGroupingToken groupId)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Demands
clone()
Create a shallow copy of this entityOdDemands
get(Mode mode, TimePeriod timePeriod)
Get an OdDemand by mode and time period in pcu/hourSet<Mode>
getRegisteredModesForTimePeriod(TimePeriod timePeriod)
Get modes registered for the given time periodOdDemands
registerOdDemandPcuHour(TimePeriod timePeriod, Mode mode, OdDemands odDemandsPcuHour)
Register provided odDemandvoid
reset()
reset all demands, traveler types, time periods and user classes-
Methods inherited from class org.goplanit.component.PlanitComponent
equals, getComponentType, getExternalId, getId, getIdGroupingToken, getKnownSupportedEventTypes, getXmlId, hashCode, onPlanitComponentEvent, setExternalId, setXmlId
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.goplanit.utils.event.EventListener
hasKnownSupportedEventTypes
-
Methods inherited from interface org.goplanit.utils.id.ExternalIdAble
hasExternalId, hasXmlId
-
Methods inherited from interface org.goplanit.utils.id.IdAble
compareTo, idEquals, idHashCode
-
-
-
-
Field Detail
-
odDemandsByTimePeriodAndMode
protected final TreeMap<Long,TreeMap<Mode,OdDemands>> odDemandsByTimePeriodAndMode
Trip demand matrices
-
timePeriods
public final Demands.TimePeriods timePeriods
internal class instance containing all time periods on this demand instance
-
userClasses
public final Demands.UserClasses userClasses
internal class instance containing all user classes on this demand instance
-
travelerTypes
public final Demands.TravelerTypes travelerTypes
internal class instance containing all traveler types on this demand instance
-
-
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)
Copy constructor- Parameters:
other
- to copy
-
-
Method Detail
-
registerOdDemandPcuHour
public OdDemands registerOdDemandPcuHour(TimePeriod timePeriod, Mode mode, OdDemands odDemandsPcuHour)
Register provided odDemand- Parameters:
timePeriod
- the time period for this origin-demand objectmode
- the mode for this origin-demand objectodDemandsPcuHour
- 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 requiredtimePeriod
- 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
-
clone
public Demands clone()
Create a shallow copy of this entity- Specified by:
clone
in interfaceIdAble
- Specified by:
clone
in classPlanitComponent<Demands>
- Returns:
- shallow copy of entity
-
reset
public void reset()
reset all demands, traveler types, time periods and user classes- Specified by:
reset
in classPlanitComponent<Demands>
-
-