|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object Point2D
public class Point2D
Utility class for managing points in 2D
Constructor Summary | |
---|---|
Point2D()
Sets coordinates to (0.0, 0.0) |
|
Point2D(double[] c)
Sets coordinates to (c[0],c[1]) |
|
Point2D(double x,
double y)
Sets coordinates to (x,y) |
Method Summary | |
---|---|
double |
getCoordinate(int i)
Accessor method used to retrieve specific coordinate |
double[] |
getCoordinates()
Accessor method used to retrieve coordinate array |
void |
setCoordinate(int i,
double value)
Modifier method allows client (or this) to set a new value for either coordinate |
void |
setCoordinates(double[] c)
Sets coordinates to (c[0],c[1]) |
void |
setCoordinates(Point2D other)
Modifier methood that sets coordinates of this object to the same as the Point2D parameter |
void |
setLocation(double x,
double y)
Modifier method allows client (or this) to set new coordinates |
java.lang.String |
toString()
Composes and returns meaningful string representation of the ordered pair |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Point2D()
public Point2D(double x, double y)
x
- the abscissa (x value)y
- the ordinate (y value)public Point2D(double[] c)
c
- array containing the new coordinatesMethod Detail |
---|
public void setLocation(double x, double y)
x
- the new abscissa (x value)y
- the new ordinate (y value)public void setCoordinate(int i, double value)
i
- the index of the new coordinate (0 for x, 1 for y)value
- the new coordinatepublic void setCoordinates(double[] c)
c
- array containing the new coordinatespublic void setCoordinates(Point2D other)
other
- Point2D object to be duplicatedpublic double[] getCoordinates()
public double getCoordinate(int i)
i
- the index of the coordinate to be retrieved (0 for x, 1 for y)public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |