Class L2PointComparator

  • All Implemented Interfaces:
    Serializable, Comparator<L2Point>

    public class L2PointComparator
    extends adams.data.container.DataPointComparator<L2Point>
    A comparator for level 2 points.
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • m_UseData

        protected boolean m_UseData
        whether to compare data as well as z.
    • Constructor Detail

      • L2PointComparator

        public L2PointComparator()
        The default constructor uses comparison by x in ascending manner.
      • L2PointComparator

        public L2PointComparator​(boolean useData,
                                 boolean ascending)
        This constructor initializes the comparator either with comparison by x or by y as well. Either in ascending manner or descending.
        Parameters:
        useData - if true then y is used for comparison as well as x
        ascending - if true then the ordering is done in ascending manner, otherwise descending
    • Method Detail

      • isUsingData

        public boolean isUsingData()
        Returns whether the data is used for ordering as well.
        Returns:
        true if data is used for ordering as well
      • compare

        public int compare​(L2Point o1,
                           L2Point 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<L2Point>
        Specified by:
        compare in class adams.data.container.DataPointComparator<L2Point>
        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.