|
Algorithm Development Kit 1.0 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectalgs.model.twod.TwoDPoint
public class TwoDPoint
Standard two-dimensional implementation of IPoint.
For compatibility with other n-dimensional implementations, this class also
implements IMultiPoint
IMultiPoint
,
IPoint
Field Summary |
---|
Fields inherited from interface algs.model.IPoint |
---|
xy_sorter |
Constructor Summary | |
---|---|
TwoDPoint(double x,
double y)
Construct a TwoDPoint from the given (x,y) values. |
|
TwoDPoint(IPoint pt)
Construct when given an IPoint. |
|
TwoDPoint(java.lang.String s)
Construct when given a comma-separated string of x,y values as double. |
Method Summary | |
---|---|
int |
dimensionality()
Return the dimensionality of this point. |
double |
distance(IMultiPoint imp)
Return the Euclidean distance between the given multipoint. |
boolean |
equals(java.lang.Object o)
Provides the required equals method. |
double |
getCoordinate(int d)
Return the coordinate value in the given dimension for the given point. |
double |
getX()
return the x-coordinate value for the given point. |
double |
getY()
return the y-coordinate value for the given point. |
int |
hashCode()
|
double[] |
raw()
Returns the raw representation of this point as an array of two values. |
java.lang.String |
toString()
Reasonable toString() implementation. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public TwoDPoint(double x, double y)
x
- value of x-coordinate.y
- value of y-coordinate.public TwoDPoint(IPoint pt)
pt
- point whose values are extracted and used to initialize this.public TwoDPoint(java.lang.String s)
No serious error handling is considered, so be wary of passing in invalid values.
s
- A comma-separated string of doubles used to initialize this
two-dimensional point.Method Detail |
---|
public double getX()
IPoint
getX
in interface IPoint
IPoint.getX()
public double getY()
IPoint
getY
in interface IPoint
IPoint.getY()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- the object against which to compare.FloatingPoint
public java.lang.String toString()
toString
in class java.lang.Object
public int dimensionality()
IMultiPoint
dimensionality
in interface IMultiPoint
IMultiPoint.dimensionality()
public double getCoordinate(int d)
IMultiPoint
getCoordinate
in interface IMultiPoint
d
- the dimension 1 ≤ dx ≤ dimensionality() for the desired coordinate.IMultiPoint.getCoordinate(int)
public double distance(IMultiPoint imp)
distance
in interface IMultiPoint
imp
- the point against from which the distance is computed.
java.lang.IllegalArgumentException
- if invoked with an argument that
does not represent a two-dimensional point.public int hashCode()
hashCode
in class java.lang.Object
public double[] raw()
raw
in interface IMultiPoint
|
Algorithm Development Kit 1.0 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |