|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.javaranch.common.DPoint
A very lean serialized point type where X and Y are of type double.
Should the day ever arise that everyone supports Java 1.2 or higher, this class should inherit Point2D.Double.
- - - - - - - - - - - - - - - - -
Copyright (c) 1998-2004 Paul Wheaton
You are welcome to do whatever you want to with this source file provided that you maintain this comment fragment (between the dashed lines). Modify it, change the package name, change the class name ... personal or business use ... sell it, share it ... add a copyright for the portions you add ...
My goal in giving this away and maintaining the copyright is to hopefully direct developers back to JavaRanch.
The original source can be found at JavaRanch
- - - - - - - - - - - - - - - - -
Constructor Summary | |
DPoint()
Create a double point object initialized to 0.0,0.0. |
|
DPoint(double x,
double y)
Create a double point object initialized to x,y. |
Method Summary | |
boolean |
equals(java.lang.Object obj)
|
double |
getX()
|
double |
getY()
|
void |
incX(double inc)
Increment x (negative numbers decrement x). |
void |
incY(double inc)
Increment y (negative numbers decrement y). |
void |
set(double x,
double y)
|
void |
setX(double x)
|
void |
setY(double y)
|
java.lang.String |
toString()
returns something like "(35.8765,20.0042)". |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public DPoint()
public DPoint(double x, double y)
x
- The x coordinate. y
- The y coordinate. Method Detail |
public void setX(double x)
public double getX()
public void setY(double y)
public double getY()
public void set(double x, double y)
public void incX(double inc)
inc
- The amount to adjust x. public void incY(double inc)
inc
- The amount to adjust y. public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |