|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.moyoman.module.loosegroups.simplelgimpl.StoneDistance
This class is used to represent the distance between two stones. It implements the Comparable interface, so objects of this type can be automatically sorted by a SortedSet object.
Field Summary | |
private short |
distance
The square of the distance between two stones. |
private short |
hor
The horizontal distance between the two stones. |
private Stone |
stone1
One of the stones. |
private Stone |
stone2
The other stone. |
private short |
vert
The vertical distance between the two stones. |
Constructor Summary | |
protected |
StoneDistance(Stone s1,
Stone s2)
Create the StoneDistance object. |
Method Summary | |
protected int |
compare(int h,
int v)
Compare the distance of the current object with that specified by the two parameters. |
int |
compareTo(Object o)
This method implements the Comparable interface. |
private short |
getDistance()
Get the square of the distance between the two stones. |
protected short |
getHorizontal()
Get the horizontal distance between the two stones. |
protected Stone |
getStone1()
Get the first stone. |
protected Stone |
getStone2()
Get the second stone. |
protected short |
getVertical()
Get the vertical distance between the two stones. |
String |
toString()
Return a String representation of this object. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private short hor
private short vert
private short distance
private Stone stone1
private Stone stone2
Constructor Detail |
protected StoneDistance(Stone s1, Stone s2)
s1
- One of the stones.s2
- The other stone.Method Detail |
protected Stone getStone1()
protected Stone getStone2()
protected short getHorizontal()
protected short getVertical()
private short getDistance()
protected int compare(int h, int v)
h
- The horizontal distance between two stones.v
- The vertical distance between two stones.
public String toString()
toString
in class Object
public int compareTo(Object o)
compareTo
in interface Comparable
o
- The object being compared with this one.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |