Class Coordinates<T extends java.lang.Number>

java.lang.Object
fr.r1r0r0.deltaengine.model.Coordinates<T>
Type Parameters:
T - the type of Number used, example : Integer, Double..

public final class Coordinates<T extends java.lang.Number>
extends java.lang.Object
Coordinates of a point, or object, coded by two doubles for 2D position.
  • Field Summary

    Fields
    Modifier and Type Field Description
    private T x  
    private T y  
  • Constructor Summary

    Constructors
    Constructor Description
    Coordinates​(T x, T y)
    Default constructor.
  • Method Summary

    Modifier and Type Method Description
    Coordinates<T> copy()
    Returns a new instance of Coordinates with exact same values
    static Coordinates<java.lang.Integer> doubleToInteger​(Coordinates<java.lang.Double> coordinates)  
    boolean equals​(java.lang.Object o)  
    Coordinates<java.lang.Double> getNextCoordinates​(Direction direction, double multiplier)
    Calc and returns the next coordinates matching to the current coordinate, a direction, and a delta of movement
    T getX()
    Get saved x position.
    T getY()
    Get saved y position.
    int hashCode()  
    java.lang.String toString()  

    Methods inherited from class java.lang.Object

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

    • x

      private final T extends java.lang.Number x
    • y

      private final T extends java.lang.Number y
  • Constructor Details

    • Coordinates

      public Coordinates​(T x, T y)
      Default constructor. Creates a Coordinates given x and y positions.
      Parameters:
      x - horizontal position
      y - vertical position
  • Method Details

    • getX

      public T getX()
      Get saved x position.
      Returns:
      x double current x of an element
    • getY

      public T getY()
      Get saved y position.
      Returns:
      y double current y of an element
    • getNextCoordinates

      public Coordinates<java.lang.Double> getNextCoordinates​(Direction direction, double multiplier)
      Calc and returns the next coordinates matching to the current coordinate, a direction, and a delta of movement
      Parameters:
      direction - the direction where the movement will be applied
      multiplier - the multiplier apply to the movement
      Returns:
      the next coordinate
    • doubleToInteger

      public static Coordinates<java.lang.Integer> doubleToInteger​(Coordinates<java.lang.Double> coordinates)
    • equals

      public boolean equals​(java.lang.Object o)
      Overrides:
      equals in class java.lang.Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class java.lang.Object
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object
    • copy

      public Coordinates<T> copy()
      Returns a new instance of Coordinates with exact same values
      Returns:
      new Coordinates