net.talvi.puffinplot.data
Class DatumComparator

java.lang.Object
  extended by net.talvi.puffinplot.data.DatumComparator
All Implemented Interfaces:
java.util.Comparator<Datum>

public class DatumComparator
extends java.lang.Object
implements java.util.Comparator<Datum>

This class implements a specific type of comparison for datum objects. It compares the magnetic moment measurements by looking only at one of the orthogonal components of the magnetic moment. It also allows a correction (for e.g. sample orientation) to be applied before the comparison.

The intended use for this class is to determine the maximum extent of an orthogonal projection of a set of data (e.g. in a Zijderveld plot) in order to scale the plot appropriately.


Constructor Summary
DatumComparator(MeasurementAxis axis, Correction corr)
          Creates a comparator which will compare magnetic moments along the specified axis after applying the specified correction.
 
Method Summary
 int compare(Datum datum1, Datum datum2)
          Compares the magnetic moments of the supplied datum objects using the criteria specified in the constructor.
 
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

DatumComparator

public DatumComparator(MeasurementAxis axis,
                       Correction corr)
Creates a comparator which will compare magnetic moments along the specified axis after applying the specified correction.

Parameters:
axis -
corr -
Method Detail

compare

public int compare(Datum datum1,
                   Datum datum2)
Compares the magnetic moments of the supplied datum objects using the criteria specified in the constructor.

Specified by:
compare in interface java.util.Comparator<Datum>
Parameters:
datum1 - the first datum to be compared
datum2 - the second datum to be compared
Returns:
the result of the comparison (less than 0, 0, or greater than 0, according as the value from the first datum is less than, equal to, or greater than the corresponding value from the second datum)
See Also:
Double.compare(double, double)