Package adams.data.spectrum
Class SpectrumPointComparator
- java.lang.Object
-
- adams.data.container.DataPointComparator<SpectrumPoint>
-
- adams.data.spectrum.SpectrumPointComparator
-
- All Implemented Interfaces:
Serializable
,Comparator<SpectrumPoint>
public class SpectrumPointComparator extends adams.data.container.DataPointComparator<SpectrumPoint>
A comparator for SpectrumPoint points.- Version:
- $Revision: 11831 $
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
m_UseAmplitude
whether to compare amplitude or wave number.
-
Constructor Summary
Constructors Constructor Description SpectrumPointComparator()
The default constructor uses comparison by wave number in ascending manner.SpectrumPointComparator(boolean useAmplitude, boolean ascending)
This constructor initializes the comparator either with comparison by wave number or by amplitude.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compare(SpectrumPoint o1, SpectrumPoint o2)
Compares its two arguments for order.boolean
isUsingAmplitude()
Returns whether the amplitude or the wave number is used for ordering.-
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, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
-
-
-
Constructor Detail
-
SpectrumPointComparator
public SpectrumPointComparator()
The default constructor uses comparison by wave number in ascending manner.
-
SpectrumPointComparator
public SpectrumPointComparator(boolean useAmplitude, boolean ascending)
This constructor initializes the comparator either with comparison by wave number or by amplitude. Either in ascending manner or descending.- Parameters:
useAmplitude
- if true then amplitude is used for comparison otherwise the wave numberascending
- if true then the ordering is done in ascending manner, otherwise descending
-
-
Method Detail
-
isUsingAmplitude
public boolean isUsingAmplitude()
Returns whether the amplitude or the wave number is used for ordering.- Returns:
- true if amplitude is used for ordering
-
compare
public int compare(SpectrumPoint o1, SpectrumPoint o2)
Compares its two arguments for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.- Specified by:
compare
in interfaceComparator<SpectrumPoint>
- Specified by:
compare
in classadams.data.container.DataPointComparator<SpectrumPoint>
- Parameters:
o1
- the first objecto2
- the second object- Returns:
- a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
-
-