Package org.planit.cost.physical.initial
Class InitialLinkSegmentCost
- java.lang.Object
-
- org.djutils.event.EventProducer
-
- org.planit.assignment.TrafficAssignmentComponent<InitialPhysicalCost>
-
- org.planit.cost.physical.initial.InitialPhysicalCost
-
- org.planit.cost.physical.initial.InitialLinkSegmentCost
-
- All Implemented Interfaces:
Serializable
,Comparable<Idable>
,org.djutils.event.EventProducerInterface
,Cost<MacroscopicLinkSegment>
,PhysicalCost
,Idable
- Direct Known Subclasses:
InitialLinkSegmentCostPeriod
,ManualInitialLinkSegmentCost
public class InitialLinkSegmentCost extends InitialPhysicalCost
Initial Link Segment Costs stored by mode- Author:
- gman6028, markr
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<Long,Map<Long,Double>>
costPerModeAndLinkSegment
Map to store initial cost for each mode and link segment-
Fields inherited from class org.planit.assignment.TrafficAssignmentComponent
id, tokenId, trafficComponentType
-
Fields inherited from interface org.djutils.event.EventProducerInterface
FIRST_POSITION, LAST_POSITION
-
Fields inherited from interface org.planit.cost.physical.PhysicalCost
BPR
-
-
Constructor Summary
Constructors Constructor Description InitialLinkSegmentCost(IdGroupingToken groupId)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
getId()
Collect initial cost iddouble
getSegmentCost(Mode mode, MacroscopicLinkSegment linkSegment)
Returns the initial cost for each link segment and mode.boolean
isSegmentCostsSetForMode(Mode mode)
Are link segment costs available for the given modevoid
setSegmentCost(Mode mode, long linkSegmentId, double cost)
Sets the initial cost for each link segment and modevoid
setSegmentCost(Mode mode, MacroscopicLinkSegment linkSegment, double cost)
Sets the initial cost for each link segment and mode-
Methods inherited from class org.planit.assignment.TrafficAssignmentComponent
equals, getIdGroupingToken, getSourceId, getTrafficComponentType, hashCode
-
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
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.planit.utils.id.Idable
compareTo, idEquals, idHashCode
-
-
-
-
Constructor Detail
-
InitialLinkSegmentCost
public InitialLinkSegmentCost(IdGroupingToken groupId)
Constructor- Parameters:
groupId
- , contiguous id generation within this group for instances of this class
-
-
Method Detail
-
isSegmentCostsSetForMode
public boolean isSegmentCostsSetForMode(Mode mode)
Are link segment costs available for the given mode- Parameters:
mode
- the mode- Returns:
- true when available, false otherwise
-
getSegmentCost
public double getSegmentCost(Mode mode, MacroscopicLinkSegment linkSegment)
Returns the initial cost for each link segment and mode. When absent but mode is not allowed, positive infinity is used, otherwise we revert to free flow travel time and a warning is logged.- Parameters:
mode
- the current modelinkSegment
- the current link segment- Returns:
- the cost for this link segment and mode
-
setSegmentCost
public void setSegmentCost(Mode mode, MacroscopicLinkSegment linkSegment, double cost)
Sets the initial cost for each link segment and mode- Specified by:
setSegmentCost
in classInitialPhysicalCost
- Parameters:
mode
- the current modelinkSegment
- the current link segmentcost
- the initial cost for this link segment and mode
-
setSegmentCost
public void setSegmentCost(Mode mode, long linkSegmentId, double cost)
Sets the initial cost for each link segment and mode- Parameters:
mode
- the current modelinkSegmentId
- the id of the current link segmentcost
- the initial cost for this link segment and mode At present this method is only used in unit tests.
-
getId
public long getId()
Collect initial cost id- Specified by:
getId
in interfaceIdable
- Overrides:
getId
in classTrafficAssignmentComponent<InitialPhysicalCost>
- Returns:
- id
-
-