Class SlotPos

java.lang.Object
net.tnemc.menu.core.utils.SlotPos

public class SlotPos extends Object
Represents a slot as a position in a grid of slots with rows and columns. The class provides methods for creating a position with row and column values, creating a position from a slot number, retrieving the slot number, as well as getting the row and column values.
Since:
1.5.0.0
Author:
creatorfromhell
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final int
    The column index in the grid.
    private final int
    The row index in the grid.
  • Constructor Summary

    Constructors
    Constructor
    Description
    SlotPos(int slot)
    Constructs a SlotPos from a slot number.
    SlotPos(int row, int column)
    Constructs a SlotPos with specified row and column values.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
     
    int
     
    int
    Calculates and returns the slot number based on the current row and column values.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • row

      private final int row
      The row index in the grid.
    • column

      private final int column
      The column index in the grid.
  • Constructor Details

    • SlotPos

      public SlotPos(int row, int column)
      Constructs a SlotPos with specified row and column values.
      Parameters:
      row - The row index.
      column - The column index.
    • SlotPos

      public SlotPos(int slot)
      Constructs a SlotPos from a slot number.
      Parameters:
      slot - The slot number.
  • Method Details

    • slot

      public int slot()
      Calculates and returns the slot number based on the current row and column values.
      Returns:
      The slot number.
    • getRow

      public int getRow()
    • getColumn

      public int getColumn()
    • toString

      public String toString()
      Overrides:
      toString in class Object