astro
Class StarDescription.StarComparator<T extends StarDescription>

java.lang.Object
  extended by astro.StarDescription.StarComparator<T>
All Implemented Interfaces:
Comparator<T>
Enclosing class:
StarDescription

public static class StarDescription.StarComparator<T extends StarDescription>
extends Object
implements Comparator<T>

Gets a star definition comparator linked to the named property of the star.


Field Summary
(package private)  int ascending
           
(package private)  String field
           
 
Constructor Summary
StarDescription.StarComparator(String id)
          We compare the star for the field given.
StarDescription.StarComparator(String id, boolean asc)
          We compare the star for the field given.
 
Method Summary
 int compare(T o1, T o2)
          Two stars are compared for their property named by the constructor field.
 
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
 

Field Detail

field

String field

ascending

int ascending
Constructor Detail

StarDescription.StarComparator

public StarDescription.StarComparator(String id)
We compare the star for the field given. If those are not comparable, we get them as a property.


StarDescription.StarComparator

public StarDescription.StarComparator(String id,
                                      boolean asc)
We compare the star for the field given. If those are not comparable, we get them as a property.

Method Detail

compare

public int compare(T o1,
                   T o2)
Two stars are compared for their property named by the constructor field. If this is StarDescription.RA, we sort ascending for RA, if this is StarDescription.MAG, we sort for brightness.

Specified by:
compare in interface Comparator<T extends StarDescription>