Class Offset


public class Offset extends SamePair<Integer>
A simple immutable class which stores an X and Y offset when converting between ScreenPoint and CartesianPoint using their offset overloads.
Author:
Lehlogonolo Poole
See Also:
  • Field Details

    • ZERO

      public static final Offset ZERO
      A constant identical to instantiating the class with 0 as both values.
  • Constructor Details

    • Offset

      public Offset(int x, int y)
      Default Constructor
      Parameters:
      x - The X offset
      y - The Y offset
    • Offset

      public Offset(SamePair<Integer> samePair)
      Constructor from a same pair of integers
      Parameters:
      samePair - The same pair
  • Method Details

    • getXOffset

      public int getXOffset()
      Returns the X offset
      Returns:
      The X offset component
    • getYOffset

      public int getYOffset()
      Returns the Y offset
      Returns:
      The Y offset component
    • fromMutablePair

      public static <T extends Integer> Offset fromMutablePair(MutablePair<T,T> mutablePair)
      Creates an Offset immutable class from a MutablePair who's types are both Integer
      Type Parameters:
      T - The type held by the MutablePair, in this case it has to be an Integer
      Parameters:
      mutablePair - The mutable pair of integers
      Returns:
      A new immutable Offset instance