goldman.collection.spatial
Interface XYComparator<T>

All Superinterfaces:
Comparator<T>
All Known Implementing Classes:
DefaultXYComparator, TaggedElementXYComparator

public interface XYComparator<T>
extends Comparator<T>

The XYComparator interface is used by the quad tree implementation to determine which quadrant a point belongs.


Method Summary
 double compareX(T a, T b)
          Compares a and b according to their x-coordinates.
 double compareY(T a, T b)
          Compares a and b according to their y-coordinates.
 double getX(T item)
          Returns the x-coordinate of the given item.
 double getY(T item)
          Returns the y-coordinate of the given item.
 int quadrant(T origin, T item)
          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 interface java.util.Comparator
compare, equals
 

Method Detail

getX

double getX(T item)
Returns the x-coordinate of the given item.


getY

double getY(T item)
Returns the y-coordinate of the given item.


compareX

double compareX(T a,
                T b)
Compares a and b according to their x-coordinates.


compareY

double compareY(T a,
                T b)
Compares a and b according to their y-coordinates.


quadrant

int quadrant(T origin,
             T item)
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.