edu.nrao.sss.measure
Class EquatorialArcSortKey<A extends EquatorialArc<A>>

java.lang.Object
  extended by edu.nrao.sss.measure.EquatorialArcSortKey<A>
All Implemented Interfaces:
Orderable, Comparator<A>

public class EquatorialArcSortKey<A extends EquatorialArc<A>>
extends Object
implements Orderable, Comparator<A>

A sort key and comparator that works with equatorial arcs, such as latitude or longitude.

Because this class is a SortKey, you may configure its instances with a particular SortOrder. This class adds additional configurability by letting clients decide to compare angles as they are or, instead, in normalized form. You may place instances of this class in a CompoundComparator.

Version Info:

$Revision: 1707 $
$Date: 2008-11-14 10:23:59 -0700 (Fri, 14 Nov 2008) $
$Author: dharland $

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

Constructor Summary
EquatorialArcSortKey()
          Creates a new instance.
 
Method Summary
 int compare(A a1, A a2)
           
 SortOrder getOrder()
          Returns the sort order.
 void setOrder(SortOrder newOrder)
          Sets the order to newOrder.
 
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

EquatorialArcSortKey

public EquatorialArcSortKey()
Creates a new instance.

Method Detail

setOrder

public void setOrder(SortOrder newOrder)
Description copied from interface: Orderable
Sets the order to newOrder.

Implementing classes should handle a null parameter in some way other than merely saving it and waiting for a downstream NullPointerException. Typical responses would be to replace null with some valid value, such as SortOrder.NATURAL, or to throw an IllegalArgumentException.

Specified by:
setOrder in interface Orderable
Parameters:
newOrder - the new order for sorting.

getOrder

public SortOrder getOrder()
Description copied from interface: Orderable
Returns the sort order.

Implementing classes should guarantee that the returned value will never be null.

Specified by:
getOrder in interface Orderable
Returns:
the sort order.

compare

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


Copyright © 2009. All Rights Reserved.