Package org.opentrafficsim.base
Record Class StripeElement
java.lang.Object
java.lang.Record
org.opentrafficsim.base.StripeElement
- Record Components:
width
- widthcolor
- colordashes
- 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 ClassesModifier and TypeClassDescriptionstatic enum
Method to determine how stripes synchronize within a link. -
Constructor Summary
ConstructorsConstructorDescriptionStripeElement
(org.djunits.value.vdouble.scalar.Length width, Color color, org.djunits.value.vdouble.vector.LengthVector dashes) Constructor checks. -
Method Summary
Modifier and TypeMethodDescriptioncolor()
Returns the value of thecolor
record component.static StripeElement
continuous
(org.djunits.value.vdouble.scalar.Length width, Color color) Creates a continuous stripe element.static StripeElement
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
dashes()
Returns the value of thedashes
record component.final boolean
Indicates whether some other object is "equal to" this one.static StripeElement
gap
(org.djunits.value.vdouble.scalar.Length width) Creates a gap stripe element.final int
hashCode()
Returns a hash code value for this object.boolean
Returns whether this is a continuous stripe element (i.e. a line without dashes).boolean
isDashed()
Returns whether this is a dashed stripe element.boolean
isGap()
Returns whether this is a gap stripe element.final String
toString()
Returns a string representation of this record class.org.djunits.value.vdouble.scalar.Length
width()
Returns the value of thewidth
record component.
-
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
- widthcolor
- colordashes
- dashes
-
-
Method Details
-
continuous
Creates a continuous stripe element.- Parameters:
width
- widthcolor
- 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
- widthcolor
- colordashes
- dashes (gap, dash, gap, dash, ...)- Returns:
- dashed stripe element
-
gap
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
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)
. -
width
public org.djunits.value.vdouble.scalar.Length width()Returns the value of thewidth
record component.- Returns:
- the value of the
width
record component
-
color
Returns the value of thecolor
record component.- Returns:
- the value of the
color
record component
-
dashes
public org.djunits.value.vdouble.vector.LengthVector dashes()Returns the value of thedashes
record component.- Returns:
- the value of the
dashes
record component
-