Package org.planit.cost.physical.initial
Class InitialLinkSegmentCost
- java.lang.Object
-
- org.djutils.event.EventProducer
-
- org.planit.trafficassignment.TrafficAssignmentComponent<InitialPhysicalCost>
-
- org.planit.cost.physical.initial.InitialPhysicalCost
-
- org.planit.cost.physical.initial.InitialLinkSegmentCost
-
- All Implemented Interfaces:
Serializable
,org.djutils.event.EventProducerInterface
,Cost<LinkSegment>
,AbstractPhysicalCost
- Direct Known Subclasses:
InitialLinkSegmentCostPeriod
,ManualInitialLinkSegmentCost
public class InitialLinkSegmentCost extends InitialPhysicalCost
Initial Link Segment Costs stored by mode- Author:
- gman6028
- 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.trafficassignment.TrafficAssignmentComponent
groupId, id, trafficComponentType
-
-
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, LinkSegment linkSegment)
Returns the initial cost for each link segment and modeboolean
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, LinkSegment linkSegment, double cost)
Sets the initial cost for each link segment and mode-
Methods inherited from class org.planit.trafficassignment.TrafficAssignmentComponent
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
-
-
-
-
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, LinkSegment linkSegment)
Returns the initial cost for each link segment and mode- Parameters:
mode
- the current modelinkSegment
- the current link segment- Returns:
- the cost for this link segment and mode
-
setSegmentCost
public void setSegmentCost(Mode mode, LinkSegment 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- Overrides:
getId
in classTrafficAssignmentComponent<InitialPhysicalCost>
- Returns:
- id
-
-