Record Class CellSize

java.lang.Object
java.lang.Record
dev.despical.mazeengine.api.model.CellSize
Record Components:
width - the number of cells along X, at least two
depth - the number of cells along Z, at least two

public record CellSize(int width, int depth) extends Record
Describes the dimensions of a logical maze grid.

Each axis contains at least two cells. The total cell count must fit in a signed int because graph storage and routing use integer cell indices.

This value counts graph cells, not Minecraft blocks. The occupied block volume also depends on the preset's corridor width, wall thickness, wall height, and roof. Configured server limits are checked at submission.

  • Constructor Summary

    Constructors
    Constructor
    Description
    CellSize(int width, int depth)
    Constructs grid dimensions supported by the graph representation.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the total number of cells in the logical grid.
    int
    Returns the value of the depth record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    final String
    Returns a string representation of this record class.
    int
    Returns the value of the width record component.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • CellSize

      public CellSize(int width, int depth)
      Constructs grid dimensions supported by the graph representation.
      Parameters:
      width - the number of columns
      depth - the number of rows
      Throws:
      IllegalArgumentException - if either axis is smaller than two or the total cell count exceeds Integer.MAX_VALUE
  • Method Details

    • count

      public int count()
      Returns the total number of cells in the logical grid.

      The constructor ensures the product fits in an int. This count is unrelated to the number of blocks written by generation.

      Returns:
      width * depth
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • width

      public int width()
      Returns the value of the width record component.
      Returns:
      the value of the width record component
    • depth

      public int depth()
      Returns the value of the depth record component.
      Returns:
      the value of the depth record component