Record Class CellPosition
java.lang.Object
java.lang.Record
dev.despical.mazeengine.api.model.CellPosition
- Record Components:
x- the nonnegative column indexz- the nonnegative row index
Identifies one cell in a maze's logical graph.
The X coordinate is the zero-based column and Z is the zero-based row. These indices are independent of world block coordinates, corridor width, wall thickness, and the maze's world origin.
Construction rejects negative indices. A position is not tied to one maze;
MazeRegistry.route(MazeId, CellPosition, CellPosition) checks its upper bounds
against the selected maze when a route is requested.
-
Constructor Summary
ConstructorsConstructorDescriptionCellPosition(int x, int z) Constructs a cell position with nonnegative indices. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.intx()Returns the value of thexrecord component.intz()Returns the value of thezrecord component.
-
Constructor Details
-
CellPosition
public CellPosition(int x, int z) Constructs a cell position with nonnegative indices.No maze-specific upper bound is checked here. The same position can be used with any maze whose grid contains the selected column and row.
- Parameters:
x- the zero-based column indexz- the zero-based row index- Throws:
IllegalArgumentException- if either index is negative
-
-
Method Details
-
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. -
x
-
z
-