Package org.opentrafficsim.base
Record Class StripeElement
java.lang.Object
java.lang.Record
org.opentrafficsim.base.StripeElement
- Record Components:
width- widthcolor- colordashes- dashes
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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumMethod to determine how stripes synchronize within a link. -
Constructor Summary
ConstructorsConstructorDescriptionStripeElement(Length width, Color color, LengthVector dashes) Constructor checks. -
Method Summary
Modifier and TypeMethodDescriptioncolor()Returns the value of thecolorrecord component.static StripeElementcontinuous(Length width, Color color) Creates a continuous stripe element.static StripeElementdashed(Length width, Color color, LengthVector dashes) Creates a dashed stripe element.dashes()Returns the value of thedashesrecord component.final booleanIndicates whether some other object is "equal to" this one.static StripeElementCreates a gap stripe element.final inthashCode()Returns a hash code value for this object.booleanReturns whether this is a continuous stripe element (i.e. a line without dashes).booleanisDashed()Returns whether this is a dashed stripe element.booleanisGap()Returns whether this is a gap stripe element.final StringtoString()Returns a string representation of this record class.width()Returns the value of thewidthrecord component.
-
Constructor Details
-
StripeElement
Constructor checks.- Parameters:
width- widthcolor- colordashes- dashes
-
-
Method Details
-
continuous
Creates a continuous stripe element.- Parameters:
width- widthcolor- color- Returns:
- continuous stripe element
-
dashed
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
Returns the value of thewidthrecord component.- Returns:
- the value of the
widthrecord component
-
color
Returns the value of thecolorrecord component.- Returns:
- the value of the
colorrecord component
-
dashes
Returns the value of thedashesrecord component.- Returns:
- the value of the
dashesrecord component
-