|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgoldman.collection.spatial.DefaultXYComparator<E>
public class DefaultXYComparator<E extends XYPoint>
The DefaultXYComparator class provides an implementation of
the XYComparator
interface that simply uses the x and y coordinates.
Constructor Summary | |
---|---|
DefaultXYComparator()
|
Method Summary | |
---|---|
int |
compare(E a,
E b)
|
double |
compareX(E a,
E b)
Compares a and b according to their x-coordinates. |
double |
compareY(E a,
E b)
Compares a and b according to their y-coordinates. |
double |
getX(E item)
Returns the x-coordinate of the given item. |
double |
getY(E item)
Returns the y-coordinate of the given item. |
int |
quadrant(E origin,
E target)
Returns the quadrant for the given item with respect to the given origin where 0 indicates lower left, 1 indicates lower right, 2 indicates upper right, 3 indicates upper left, and 4 indicates the item is at the origin. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.util.Comparator |
---|
equals |
Constructor Detail |
---|
public DefaultXYComparator()
Method Detail |
---|
public double compareX(E a, E b)
XYComparator
compareX
in interface XYComparator<E extends XYPoint>
public double compareY(E a, E b)
XYComparator
compareY
in interface XYComparator<E extends XYPoint>
public double getX(E item)
XYComparator
getX
in interface XYComparator<E extends XYPoint>
public double getY(E item)
XYComparator
getY
in interface XYComparator<E extends XYPoint>
public int compare(E a, E b)
compare
in interface Comparator<E extends XYPoint>
public int quadrant(E origin, E target)
XYComparator
quadrant
in interface XYComparator<E extends XYPoint>
origin
- the element that defines
the origintarget
- the target element
origin
) that contains the target.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |