Class L1PointComparator

  • All Implemented Interfaces:
    Serializable, Comparator<L1Point>

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

      • m_UseY

        protected boolean m_UseY
        whether to compare Y as well.
    • Constructor Detail

      • L1PointComparator

        public L1PointComparator()
        The default constructor uses comparison by X in ascending manner.
      • L1PointComparator

        public L1PointComparator​(boolean useY,
                                 boolean ascending)
        This constructor initializes the comparator either with comparison by X or Y as well. Either in ascending manner or descending.
        Parameters:
        useY - 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

      • isUsingY

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

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