Record Class DemandPattern

java.lang.Object
java.lang.Record
org.opentrafficsim.road.gtu.generator.headway.DemandPattern
Record Components:
demandVector - FrequencyVector; demand vector
timeVector - TimeVector; time vector
interpolation - 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

    Constructors
    Constructor
    Description
    DemandPattern(org.djunits.value.vdouble.vector.FrequencyVector demandVector, org.djunits.value.vdouble.vector.TimeVector timeVector, Interpolation interpolation)
    Creates an instance of a DemandPattern record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.djunits.value.vdouble.vector.FrequencyVector
    Returns the value of the demandVector 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
    Returns a hash code value for this object.
    Returns the value of the interpolation 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 or null if no such slice exists.
    org.djunits.value.vdouble.vector.TimeVector
    Returns the value of the timeVector record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • 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 a DemandPattern record class.
      Parameters:
      demandVector - the value for the demandVector record component
      timeVector - the value for the timeVector record component
      interpolation - the value for the interpolation 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 input sliceStart is used to resolve the value at a time slice boundary in case of a stepwise (discontinuous) demand pattern. If sliceStart = true and time 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 after time, hence it's the slice start. If sliceStart = false the demand value of before the slice boundary should be returned. For continuous demand patterns, sliceStart can be ignored.
      Specified by:
      getFrequency in interface Arrivals
      Parameters:
      time - Time; simulation time
      sliceStart - 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 or null 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. If time is equal to a time slice boundary, the next value should be returned.
      Specified by:
      nextTimeSlice in interface Arrivals
      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

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • demandVector

      public org.djunits.value.vdouble.vector.FrequencyVector demandVector()
      Returns the value of the demandVector record component.
      Returns:
      the value of the demandVector record component
    • timeVector

      public org.djunits.value.vdouble.vector.TimeVector timeVector()
      Returns the value of the timeVector record component.
      Returns:
      the value of the timeVector record component
    • interpolation

      public Interpolation interpolation()
      Returns the value of the interpolation record component.
      Returns:
      the value of the interpolation record component