|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.javaranch.common.IPoint
A very lean serialized point type where X and Y are of type int.
- - - - - - - - - - - - - - - - -
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 | |
IPoint()
Create an int point object initialized to 0,0. |
|
IPoint(int x,
int y)
Create an int point object initialized to x,y. |
|
IPoint(IPoint p)
Create a new int point object containing the same value and another int point object. |
Method Summary | |
boolean |
equals(java.lang.Object obj)
|
int |
getX()
|
int |
getY()
|
void |
inc(IPoint p)
Increment the X value and the Y value with the x and y (respectively) of p. |
void |
incX(int val)
Increment the X value without modifying Y. |
void |
incY(int val)
Increment the Y value without modifying X. |
void |
set(int x,
int y)
|
void |
set(IPoint p)
|
void |
setX(int x)
|
void |
setY(int y)
|
java.lang.String |
toString()
returns something like "(35,20)". |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public IPoint()
public IPoint(int x, int y)
x
- The x coordinate. y
- The y coordinate. public IPoint(IPoint p)
Method Detail |
public void set(IPoint p)
public void setX(int x)
public int getX()
public void setY(int y)
public int getY()
public void set(int x, int y)
public void incX(int val)
public void incY(int val)
public void inc(IPoint p)
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 |