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 aPositionrecord class. -
Method Summary
Modifier and TypeMethodDescriptioncoords()Returns the value of thecoordsrecord component.Returns the value of thedirectionrecord component.intdistance()Returns the value of thedistancerecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intmanhattan(SquareCoord coords) inttick()Returns the value of thetickrecord component.final StringtoString()Returns a string representation of this record class.walls()Returns the value of thewallsrecord component.intx()inty()intz()
-
Constructor Details
-
Position
public Position(SquareCoord coords, Direction direction, int distance, int tick, EnumMap<Direction, BorderStatus> walls) Creates an instance of aPositionrecord class.- Parameters:
coords- the value for thecoordsrecord componentdirection- the value for thedirectionrecord componentdistance- the value for thedistancerecord componenttick- the value for thetickrecord componentwalls- the value for thewallsrecord 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 thecomparemethod from their corresponding wrapper classes. -
coords
Returns the value of thecoordsrecord component.- Returns:
- the value of the
coordsrecord component
-
direction
Returns the value of thedirectionrecord component.- Returns:
- the value of the
directionrecord component
-
distance
public int distance()Returns the value of thedistancerecord component.- Returns:
- the value of the
distancerecord component
-
tick
public int tick()Returns the value of thetickrecord component.- Returns:
- the value of the
tickrecord component
-
walls
Returns the value of thewallsrecord component.- Returns:
- the value of the
wallsrecord component
-