Record Class DemandPattern
java.lang.Object
java.lang.Record
org.opentrafficsim.road.gtu.generator.headway.DemandPattern
- Record Components:
demandVector
- FrequencyVector; demand vectortimeVector
- TimeVector; time vectorinterpolation
- Interpolation; interpolation
- All Implemented Interfaces:
Arrivals
public record DemandPattern(org.djunits.value.vdouble.vector.FrequencyVector demandVector, org.djunits.value.vdouble.vector.TimeVector timeVector, Interpolation interpolation)
extends Record
implements Arrivals
Demand pattern defined by a frequency vector, time vector and interpolation.
Copyright (c) 2013-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
-
Constructor Summary
ConstructorDescriptionDemandPattern
(org.djunits.value.vdouble.vector.FrequencyVector demandVector, org.djunits.value.vdouble.vector.TimeVector timeVector, Interpolation interpolation) Creates an instance of aDemandPattern
record class. -
Method Summary
Modifier and TypeMethodDescriptionorg.djunits.value.vdouble.vector.FrequencyVector
Returns the value of thedemandVector
record component.final boolean
Indicates whether some other object is "equal to" this one.org.djunits.value.vdouble.scalar.Frequency
getFrequency
(org.djunits.value.vdouble.scalar.Time time, boolean sliceStart) Returns the demand at given time, which may be the sum of child objects.final int
hashCode()
Returns a hash code value for this object.Returns the value of theinterpolation
record component.org.djunits.value.vdouble.scalar.Time
nextTimeSlice
(org.djunits.value.vdouble.scalar.Time time) Returns the start time of the next time slice after the given time ornull
if no such slice exists.org.djunits.value.vdouble.vector.TimeVector
Returns the value of thetimeVector
record component.final String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
DemandPattern
public DemandPattern(org.djunits.value.vdouble.vector.FrequencyVector demandVector, org.djunits.value.vdouble.vector.TimeVector timeVector, Interpolation interpolation) Creates an instance of aDemandPattern
record class.- Parameters:
demandVector
- the value for thedemandVector
record componenttimeVector
- the value for thetimeVector
record componentinterpolation
- the value for theinterpolation
record component
-
-
Method Details
-
getFrequency
public org.djunits.value.vdouble.scalar.Frequency getFrequency(org.djunits.value.vdouble.scalar.Time time, boolean sliceStart) Returns the demand at given time, which may be the sum of child objects. The inputsliceStart
is used to resolve the value at a time slice boundary in case of a stepwise (discontinuous) demand pattern. IfsliceStart = true
andtime
is a slice boundary, the demand value for after the slice boundary should be returned. In that case, the caller is processing a time slice aftertime
, hence it's the slice start. IfsliceStart = false
the demand value of before the slice boundary should be returned. For continuous demand patterns,sliceStart
can be ignored.- Specified by:
getFrequency
in interfaceArrivals
- Parameters:
time
- Time; simulation timesliceStart
- boolean; whether the time is at the start of an arbitrary time slice- Returns:
- Frequency; returns the total demand for branching nodes, or the demand at a leaf node, at the given time
-
nextTimeSlice
public org.djunits.value.vdouble.scalar.Time nextTimeSlice(org.djunits.value.vdouble.scalar.Time time) Returns the start time of the next time slice after the given time ornull
if no such slice exists. The next time slice starts as soon as the current slice ends, where each slice has it's own linear (or constant) demand. Thus, any change of slope in the demand pattern initiates a new slice. Iftime
is equal to a time slice boundary, the next value should be returned.- Specified by:
nextTimeSlice
in interfaceArrivals
- Parameters:
time
- Time; time after which the first slice start time is requested- Returns:
- start time of the next time slice after the given time or
null
if no such slice exists
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object)
. -
demandVector
public org.djunits.value.vdouble.vector.FrequencyVector demandVector()Returns the value of thedemandVector
record component.- Returns:
- the value of the
demandVector
record component
-
timeVector
public org.djunits.value.vdouble.vector.TimeVector timeVector()Returns the value of thetimeVector
record component.- Returns:
- the value of the
timeVector
record component
-
interpolation
Returns the value of theinterpolation
record component.- Returns:
- the value of the
interpolation
record component
-