Package fr.r1r0r0.deltaengine.model
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
-
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 Coordinateswith exact same values static Coordinates<java.lang.Integer>doubleToInteger(Coordinates<java.lang.Double> coordinates)booleanequals(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 movementTgetX()Get saved x position.TgetY()Get saved y position.inthashCode()java.lang.StringtoString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Field Details
-
x
-
y
-
-
Constructor Details
-
Coordinates
Default constructor. Creates a Coordinates given x and y positions.- Parameters:
x- horizontal positiony- vertical position
-
-
Method Details
-
getX
Get saved x position.- Returns:
- x double current x of an element
-
getY
Get saved y position.- Returns:
- y double current y of an element
-
getNextCoordinates
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 appliedmultiplier- 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:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-
copy
Returns a new instance of Coordinateswith exact same values - Returns:
- new Coordinates
-