edu.iastate.metnet.birdseyeview.cellview
Class CentricComparator

java.lang.Object
  extended by edu.iastate.metnet.birdseyeview.cellview.CentricComparator
All Implemented Interfaces:
java.util.Comparator

public class CentricComparator
extends java.lang.Object
implements java.util.Comparator

The CentricComparator Class compares 2 different points based on their distance from the center point of a given rectangle.

Author:
Matt Studham Created May 24, 2005

Constructor Summary
CentricComparator(java.awt.Rectangle rec, java.awt.Dimension elementSize)
          Constructor.
 
Method Summary
 int compare(java.lang.Object arg0, java.lang.Object arg1)
           
static void main(java.lang.String[] args)
          This method tests the CentricComparator class.
 
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

CentricComparator

public CentricComparator(java.awt.Rectangle rec,
                         java.awt.Dimension elementSize)
Constructor. Sets the center points. If the comparison will be used to center elements other than points (e.g. squares) then the offset parameters should be used so the elements can be properly compared.

Parameters:
rec - Rectangle whose center will be used
xOffset - Difference between the desired horizontal center and the actual horizontal center
yOffset - Difference between the desired vertical center and the actual vertical center
elementSize - Size of element which will be used to fill the rectangle
Method Detail

compare

public int compare(java.lang.Object arg0,
                   java.lang.Object arg1)
Specified by:
compare in interface java.util.Comparator

main

public static void main(java.lang.String[] args)
This method tests the CentricComparator class.

Parameters:
args -