Package org.opentrafficsim.base.geometry
Record Class FractionalProjectionHelper.Helper
java.lang.Object
java.lang.Record
org.opentrafficsim.base.geometry.FractionalProjectionHelper.Helper
- Record Components:
hasCenter- whether this is a center helpercx- center x coordinatecy- center y coordinatedx- direction x componentdy- direction y component
- Enclosing class:
- FractionalProjectionHelper
public static record FractionalProjectionHelper.Helper(boolean hasCenter, double cx, double cy, double dx, double dy)
extends Record
Value object: per-segment helper, either center or direction.
-
Constructor Summary
ConstructorsConstructorDescriptionHelper(boolean hasCenter, double cx, double cy, double dx, double dy) Creates an instance of aHelperrecord class. -
Method Summary
Modifier and TypeMethodDescriptioncenter(double cx, double cy) Factory for a center-based helper.doublecx()Returns the value of thecxrecord component.doublecy()Returns the value of thecyrecord component.direction(double dx, double dy) Factory for a direction-based helper.doubledx()Returns the value of thedxrecord component.doubledy()Returns the value of thedyrecord component.final booleanIndicates whether some other object is "equal to" this one.booleanReturns the value of thehasCenterrecord component.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Helper
public Helper(boolean hasCenter, double cx, double cy, double dx, double dy) Creates an instance of aHelperrecord class.
-
-
Method Details
-
center
Factory for a center-based helper.- Parameters:
cx- center x coordinatecy- center y coordinate- Returns:
- center-based helper
-
direction
Factory for a direction-based helper.- Parameters:
dx- direction x componentdy- direction y component- Returns:
- direction-based helper
-
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 with '=='. -
hasCenter
public boolean hasCenter()Returns the value of thehasCenterrecord component.- Returns:
- the value of the
hasCenterrecord component
-
cx
public double cx()Returns the value of thecxrecord component.- Returns:
- the value of the
cxrecord component
-
cy
public double cy()Returns the value of thecyrecord component.- Returns:
- the value of the
cyrecord component
-
dx
public double dx()Returns the value of thedxrecord component.- Returns:
- the value of the
dxrecord component
-
dy
public double dy()Returns the value of thedyrecord component.- Returns:
- the value of the
dyrecord component
-