Package org.planit.demands
Class Demands
- java.lang.Object
-
- org.djutils.event.EventProducer
-
- org.planit.trafficassignment.TrafficAssignmentComponent<Demands>
-
- org.planit.demands.Demands
-
- All Implemented Interfaces:
Serializable
,org.djutils.event.EventProducerInterface
public class Demands extends TrafficAssignmentComponent<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,ODDemandMatrix>>
odDemands
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-
Fields inherited from class org.planit.trafficassignment.TrafficAssignmentComponent
groupId, id, trafficComponentType
-
-
Constructor Summary
Constructors Constructor Description Demands(IdGroupingToken groupId)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ODDemandMatrix
get(Mode mode, TimePeriod timePeriod)
Get an ODDemand by mode and time periodSet<Mode>
getRegisteredModesForTimePeriod(TimePeriod timePeriod)
Get modes registered for the given time periodODDemandMatrix
registerODDemand(TimePeriod timePeriod, Mode mode, ODDemandMatrix odDemandMatrix)
Register provided odDemand-
Methods inherited from class org.planit.trafficassignment.TrafficAssignmentComponent
getId, getIdGroupingtoken, getSourceId, getTrafficComponentType
-
Methods inherited from class org.djutils.event.EventProducer
addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, getEventTypesWithListeners, hasListeners, numberOfListeners, removeAllListeners, removeAllListeners, removeListener
-
-
-
-
Field Detail
-
odDemands
protected final TreeMap<Long,TreeMap<Mode,ODDemandMatrix>> odDemands
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
-
-
Method Detail
-
registerODDemand
public ODDemandMatrix registerODDemand(TimePeriod timePeriod, Mode mode, ODDemandMatrix odDemandMatrix)
Register provided odDemand- Parameters:
timePeriod
- the time period for this origin-demand objectmode
- the mode for this origin-demand objectodDemandMatrix
- the origin-demand object to be registered- Returns:
- oldODDemand if there already existed an odDemand for the given mode and time period, the overwritten entry is returned
-
get
public ODDemandMatrix get(Mode mode, TimePeriod timePeriod)
Get an ODDemand by mode and time period- 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
-
-