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
ConstructorsConstructorDescriptionDemandPattern(org.djunits.value.vdouble.vector.FrequencyVector demandVector, org.djunits.value.vdouble.vector.TimeVector timeVector, Interpolation interpolation) Creates an instance of aDemandPatternrecord class. -
Method Summary
Modifier and TypeMethodDescriptionorg.djunits.value.vdouble.vector.FrequencyVectorReturns the value of thedemandVectorrecord component.final booleanIndicates whether some other object is "equal to" this one.org.djunits.value.vdouble.scalar.FrequencygetFrequency(org.djunits.value.vdouble.scalar.Time time, boolean sliceStart) Returns the demand at given time, which may be the sum of child objects.final inthashCode()Returns a hash code value for this object.Returns the value of theinterpolationrecord component.org.djunits.value.vdouble.scalar.TimenextTimeSlice(org.djunits.value.vdouble.scalar.Time time) Returns the start time of the next time slice after the given time ornullif no such slice exists.org.djunits.value.vdouble.vector.TimeVectorReturns the value of thetimeVectorrecord component.final StringtoString()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 aDemandPatternrecord class.- Parameters:
demandVector- the value for thedemandVectorrecord componenttimeVector- the value for thetimeVectorrecord componentinterpolation- the value for theinterpolationrecord 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 inputsliceStartis used to resolve the value at a time slice boundary in case of a stepwise (discontinuous) demand pattern. IfsliceStart = trueandtimeis 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 = falsethe demand value of before the slice boundary should be returned. For continuous demand patterns,sliceStartcan be ignored.- Specified by:
getFrequencyin 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 ornullif 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. Iftimeis equal to a time slice boundary, the next value should be returned.- Specified by:
nextTimeSlicein 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
nullif 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 thedemandVectorrecord component.- Returns:
- the value of the
demandVectorrecord component
-
timeVector
public org.djunits.value.vdouble.vector.TimeVector timeVector()Returns the value of thetimeVectorrecord component.- Returns:
- the value of the
timeVectorrecord component
-
interpolation
Returns the value of theinterpolationrecord component.- Returns:
- the value of the
interpolationrecord component
-