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)
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 movementT
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
-
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:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-
copy
Returns a new instance of Coordinateswith exact same values - Returns:
- new Coordinates
-