|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.ObjectPoint
public class Point
Final draft of the Point class for a 2D mathematical point. Created in class on Jan 26, improved on Jan 31, and finished Feb 2.
| Field Summary | |
|---|---|
private int |
xCoord
|
private int |
yCoord
X coordinate of the Point |
| Constructor Summary | |
|---|---|
Point()
Default constructor. |
|
Point(int x,
int y)
Point Constructor with initialization |
|
| Method Summary | |
|---|---|
double |
distanceBetween(Point otherPoint)
Compute 2D distance between this and otherPoint. |
double |
distanceTo()
Compute 2D distance from origin to point. |
int |
getX()
Get the X value of the point |
int |
getY()
Get the Y value of the point |
void |
setPosition(int x,
int y)
Set the position of the point |
void |
translate(int deltaX,
int deltaY)
Translate the point to a new location |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private int xCoord
private int yCoord
| Constructor Detail |
|---|
public Point()
public Point(int x,
int y)
x - initial X location of pointy - initial Y location of point| Method Detail |
|---|
public void setPosition(int x,
int y)
x - new X positiony - new Y position
public void translate(int deltaX,
int deltaY)
deltaX - amount to move in XdeltaY - amount to move in Ypublic int getX()
public int getY()
public double distanceTo()
public double distanceBetween(Point otherPoint)
otherPoint - second point in distance calculation
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||