Record Class StripeElement

java.lang.Object
java.lang.Record
org.opentrafficsim.base.StripeElement
Record Components:
width - width
color - color
dashes - dashes
All Implemented Interfaces:
Serializable

public record StripeElement(org.djunits.value.vdouble.scalar.Length width, Color color, org.djunits.value.vdouble.vector.LengthVector dashes) extends Record implements Serializable
Data container for an element of a stripe road marking. Elements can be continuous lines, dashed lines, or gaps between lines. For example, this can entail a complicated road marking consisting of a continuous line, a narrow gap, a colored wide area (included as a wide line), a narrow gap, and a dashed line.

Copyright (c) 2024-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.

Author:
Wouter Schakel
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    Method to determine how stripes synchronize within a link.
  • Constructor Summary

    Constructors
    Constructor
    Description
    StripeElement(org.djunits.value.vdouble.scalar.Length width, Color color, org.djunits.value.vdouble.vector.LengthVector dashes)
    Constructor checks.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the value of the color record component.
    continuous(org.djunits.value.vdouble.scalar.Length width, Color color)
    Creates a continuous stripe element.
    dashed(org.djunits.value.vdouble.scalar.Length width, Color color, org.djunits.value.vdouble.vector.LengthVector dashes)
    Creates a dashed stripe element.
    org.djunits.value.vdouble.vector.LengthVector
    Returns the value of the dashes record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    gap(org.djunits.value.vdouble.scalar.Length width)
    Creates a gap stripe element.
    final int
    Returns a hash code value for this object.
    boolean
    Returns whether this is a continuous stripe element (i.e. a line without dashes).
    boolean
    Returns whether this is a dashed stripe element.
    boolean
    Returns whether this is a gap stripe element.
    final String
    Returns a string representation of this record class.
    org.djunits.value.vdouble.scalar.Length
    Returns the value of the width record component.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • StripeElement

      public StripeElement(org.djunits.value.vdouble.scalar.Length width, Color color, org.djunits.value.vdouble.vector.LengthVector dashes)
      Constructor checks.
      Parameters:
      width - width
      color - color
      dashes - dashes
  • Method Details

    • continuous

      public static StripeElement continuous(org.djunits.value.vdouble.scalar.Length width, Color color)
      Creates a continuous stripe element.
      Parameters:
      width - width
      color - color
      Returns:
      continuous stripe element
    • dashed

      public static StripeElement dashed(org.djunits.value.vdouble.scalar.Length width, Color color, org.djunits.value.vdouble.vector.LengthVector dashes)
      Creates a dashed stripe element.
      Parameters:
      width - width
      color - color
      dashes - dashes (gap, dash, gap, dash, ...)
      Returns:
      dashed stripe element
    • gap

      public static StripeElement gap(org.djunits.value.vdouble.scalar.Length width)
      Creates a gap stripe element.
      Parameters:
      width - width
      Returns:
      gap stripe element
    • isContinuous

      public boolean isContinuous()
      Returns whether this is a continuous stripe element (i.e. a line without dashes).
      Returns:
      whether this is a continuous stripe element
    • isGap

      public boolean isGap()
      Returns whether this is a gap stripe element.
      Returns:
      whether this is a gap stripe element
    • isDashed

      public boolean isDashed()
      Returns whether this is a dashed stripe element.
      Returns:
      whether this is a dashed stripe element
    • 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.
    • width

      public org.djunits.value.vdouble.scalar.Length width()
      Returns the value of the width record component.
      Returns:
      the value of the width record component
    • color

      public Color color()
      Returns the value of the color record component.
      Returns:
      the value of the color record component
    • dashes

      public org.djunits.value.vdouble.vector.LengthVector dashes()
      Returns the value of the dashes record component.
      Returns:
      the value of the dashes record component