|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.starhope.appius.geometry.Tuple2D<T>
T
- WRITEMEpublic abstract class Tuple2D<T extends Tuple2D<T>>
Base coordinate pair type
Field Summary | |
---|---|
private static long |
serialVersionUID
Java serialisation unique ID |
protected double |
x
X |
protected double |
y
Y |
Constructor Summary | |
---|---|
Tuple2D(double x0,
double y0)
Create a new coordinate pair |
|
Tuple2D(T t)
Create a new coordinate pair from an existing coordinate pair |
Method Summary | |
---|---|
T |
add(double x0,
double y0)
Adds the coordinate pair to the tuple together |
T |
add(T p)
Adds two tuples together |
protected Object |
clone()
|
T |
divide(double factor)
Divides the tuple by the value NOTE: Will happily try to divide by zero! |
boolean |
equals(Object o)
|
double |
getX()
Gets the X coordinate |
double |
getY()
Gets the Y coordinate |
int |
hashCode()
|
T |
multiply(double factor)
Multiplies the tuple by the value |
protected abstract T |
newInstance(double x0,
double y0)
Method used to create a new object of the child's type while getting around downcasting problems in Java |
T |
subtract(double x2,
double y2)
Subtracts the coordinate pair from this tuple |
T |
subtract(T p)
Subtracts a tuple from this tuple |
org.json.JSONObject |
toJSON()
This returns a copy of the object's data cast into a JSON form. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final long serialVersionUID
protected final double x
protected final double y
Constructor Detail |
---|
public Tuple2D(double x0, double y0)
x0
- WRITEMEy0
- WRITEMEpublic Tuple2D(T t)
t
- WRITEMEMethod Detail |
---|
public T add(double x0, double y0)
x0
- WRITEMEy0
- WRITEME
public T add(T p)
p
- WRITEME
protected Object clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
Object.clone()
public T divide(double factor)
factor
- Amount to divide the tuple by
public boolean equals(Object o)
equals
in class Object
Object.equals(java.lang.Object)
public double getX()
public double getY()
public int hashCode()
hashCode
in class Object
public T multiply(double factor)
factor
- Amount to multiply the tuple by
protected abstract T newInstance(double x0, double y0)
x0
- xy0
- y
public T subtract(double x2, double y2)
x2
- Coordinate pair to subtract from this tupley2
- Coordinate pair to subtract from this tuple
public T subtract(T p)
p
- Tuple to subtract from this tuple
public org.json.JSONObject toJSON()
CastsToJSON
toJSON
in interface CastsToJSON
CastsToJSON.toJSON()
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |