Class 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 Detail

      • m_UseAmplitude

        protected boolean m_UseAmplitude
        whether to compare amplitude or wave number.
    • 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 number
        ascending - 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 interface Comparator<SpectrumPoint>
        Specified by:
        compare in class adams.data.container.DataPointComparator<SpectrumPoint>
        Parameters:
        o1 - the first object
        o2 - 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.