Record Class Vector2
java.lang.Object
java.lang.Record
com.expedient.adventofcodejade.common.Vector2
- Record Components:
rowDiff- the difference in rowscolDiff- the difference in columns
Represents a 2D vector between two Coordinates
-
Constructor Summary
ConstructorsConstructorDescriptionVector2(int rowDiff, int colDiff) Creates an instance of aVector2record class.Vector2(Coordinate one, Coordinate two) -
Method Summary
Modifier and TypeMethodDescriptionapply(Coordinate src) Applies the Vector2 to a given CoordinateapplyWithWraparound(Coordinate src, int rowCount, int colCount) intcolDiff()Returns the value of thecolDiffrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.multiply(int multiple) Multiplies the magnitude of the Vector2reverse()Reverses the direction of the Vector2introwDiff()Returns the value of therowDiffrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Vector2
-
Vector2
-
-
Method Details
-
reverse
-
multiply
Multiplies the magnitude of the Vector2- Parameters:
multiple- magnitude- Returns:
- the multiplied Vector2
-
apply
Applies the Vector2 to a given Coordinate- Parameters:
src- the source Coordinate- Returns:
- a Coordinate that is the Vector2 away from the given Coordinate
-
applyWithWraparound
-
toString
-
hashCode
-
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 thecomparemethod from their corresponding wrapper classes. -
rowDiff
-
colDiff
-