Record Class Position
java.lang.Object
java.lang.Record
zombie.pathfind.extra.Position
public record Position(SquareCoord coords, Direction direction, int distance, int tick, EnumMap<Direction,BorderStatus> walls)
extends Record
-
Constructor Summary
ConstructorsConstructorDescriptionPosition
(SquareCoord coords, Direction direction, int distance, int tick, EnumMap<Direction, BorderStatus> walls) Creates an instance of aPosition
record class. -
Method Summary
Modifier and TypeMethodDescriptioncoords()
Returns the value of thecoords
record component.Returns the value of thedirection
record component.int
distance()
Returns the value of thedistance
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.int
manhattan
(SquareCoord squareCoord) int
tick()
Returns the value of thetick
record component.final String
toString()
Returns a string representation of this record class.walls()
Returns the value of thewalls
record component.int
x()
int
y()
int
z()
-
Constructor Details
-
Position
public Position(SquareCoord coords, Direction direction, int distance, int tick, EnumMap<Direction, BorderStatus> walls) Creates an instance of aPosition
record class.- Parameters:
coords
- the value for thecoords
record componentdirection
- the value for thedirection
record componentdistance
- the value for thedistance
record componenttick
- the value for thetick
record componentwalls
- the value for thewalls
record component
-
-
Method Details
-
x
public int x() -
y
public int y() -
z
public int z() -
manhattan
-
isWall
-
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. Reference components are compared withObjects::equals(Object,Object)
; primitive components are compared with thecompare
method from their corresponding wrapper classes. -
coords
Returns the value of thecoords
record component.- Returns:
- the value of the
coords
record component
-
direction
Returns the value of thedirection
record component.- Returns:
- the value of the
direction
record component
-
distance
public int distance()Returns the value of thedistance
record component.- Returns:
- the value of the
distance
record component
-
tick
public int tick()Returns the value of thetick
record component.- Returns:
- the value of the
tick
record component
-
walls
Returns the value of thewalls
record component.- Returns:
- the value of the
walls
record component
-