Record Class Bounds

java.lang.Object
java.lang.Record
dev.despical.mazeengine.core.Bounds

public record Bounds(int x, int y, int z, int width, int height, int depth) extends Record
Describes an inclusive block volume and its indexed traversal coordinates.

The origin is the minimum block corner and dimensions count blocks, including the maximum faces. Construction requires positive dimensions and checks maximum-coordinate arithmetic so a region cannot wrap around integer limits.

Indexed conversion visits X within each Z row, then advances the Y layer. Grid sizing helpers convert between logical cell counts and structural block spans. Bounds contains no world identity; callers compare worlds separately when checking overlap or locating a saved maze.

  • Constructor Summary

    Constructors
    Constructor
    Description
    Bounds(int x, int y, int z, int width, int height, int depth)
    Creates an instance of a Bounds record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the value of the depth record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    static int
    fit(int blocks, int path, int wall)
     
    final int
    Returns a hash code value for this object.
    int
    Returns the value of the height record component.
    int
    localX(long index)
     
    int
    localY(long index)
     
    int
    localZ(long index)
     
    int
     
    int
     
    int
     
    boolean
     
    static int
    span(int cells, int path, int wall)
     
    final String
    Returns a string representation of this record class.
    long
     
    int
    Returns the value of the width record component.
    int
    x()
    Returns the value of the x record component.
    int
    y()
    Returns the value of the y record component.
    int
    z()
    Returns the value of the z record component.

    Methods inherited from class Object

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

    • Bounds

      public Bounds(int x, int y, int z, int width, int height, int depth)
      Creates an instance of a Bounds record class.
      Parameters:
      x - the value for the x record component
      y - the value for the y record component
      z - the value for the z record component
      width - the value for the width record component
      height - the value for the height record component
      depth - the value for the depth record component
  • Method Details

    • volume

      public long volume()
    • maxX

      public int maxX()
    • maxY

      public int maxY()
    • maxZ

      public int maxZ()
    • overlaps

      public boolean overlaps(Bounds other)
    • localX

      public int localX(long index)
    • localZ

      public int localZ(long index)
    • localY

      public int localY(long index)
    • span

      public static int span(int cells, int path, int wall)
    • fit

      public static int fit(int blocks, int path, int wall)
    • 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.
    • x

      public int x()
      Returns the value of the x record component.
      Returns:
      the value of the x record component
    • y

      public int y()
      Returns the value of the y record component.
      Returns:
      the value of the y record component
    • z

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

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

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

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