edu.nrao.sss.measure
Class AngleSortKey

java.lang.Object
  extended by edu.nrao.sss.sort.SortKey<Double>
      extended by edu.nrao.sss.sort.DoubleSortKey
          extended by edu.nrao.sss.measure.AngleSortKey
All Implemented Interfaces:
Orderable, Comparator<Angle>

public class AngleSortKey
extends DoubleSortKey
implements Comparator<Angle>

A sort key and comparator that works with angles.

Because this class is a SortKey, you may configure its instances with a particular SortOrder. You may place instances of this class in a CompoundComparator.

Version Info:

$Revision: 1239 $
$Date: 2008-04-25 10:34:57 -0600 (Fri, 25 Apr 2008) $
$Author: dharland $

Since:
2007-05-07
Author:
David M. Harland

Constructor Summary
AngleSortKey()
          Creates a new instance.
 
Method Summary
 int compare(Angle a1, Angle a2)
           
 void setNormalized(boolean normalizeBeforeComparing)
          Tells this key whether or not it should work with the raw angles fed to it or with normalized versions thereof.
 
Methods inherited from class edu.nrao.sss.sort.DoubleSortKey
compareAscending, compareNatural
 
Methods inherited from class edu.nrao.sss.sort.SortKey
compareObjects, compareObjects, getOrder, nullOrdering, objectsAreEqual, setOrder
 
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

AngleSortKey

public AngleSortKey()
Creates a new instance.

Method Detail

setNormalized

public void setNormalized(boolean normalizeBeforeComparing)
Tells this key whether or not it should work with the raw angles fed to it or with normalized versions thereof. Note that even if normalizeBeforeComparing is true, this class will not alter the actual angles sent to it. It will instead, though, work with normalized copies of those angles.

Parameters:
normalizeBeforeComparing - true if the caller wants this key to do a comparison on normalized angles. For example, the angle 400 degrees is greater than 90 degrees if not normalized, but less than 90 degrees if normalized. (The normalized value of 400 degrees is 60 degrees.)

compare

public int compare(Angle a1,
                   Angle a2)
Specified by:
compare in interface Comparator<Angle>


Copyright © 2009. All Rights Reserved.