Class ComparableObjectItem

    • Constructor Detail

      • ComparableObjectItem

        public ComparableObjectItem​(Comparable x,
                                    Object y)
        Constructs a new data item.
        Parameters:
        x - the x-value (null NOT permitted).
        y - the y-value (null permitted).
    • Method Detail

      • getComparable

        protected Comparable getComparable()
        Returns the x-value.
        Returns:
        The x-value (never null).
      • getObject

        protected Object getObject()
        Returns the y-value.
        Returns:
        The y-value (possibly null).
      • setObject

        protected void setObject​(Object y)
        Sets the y-value for this data item. Note that there is no corresponding method to change the x-value.
        Parameters:
        y - the new y-value (null permitted).
      • compareTo

        public int compareTo​(Object o1)
        Returns an integer indicating the order of this object relative to another object.

        For the order we consider only the x-value: negative == "less-than", zero == "equal", positive == "greater-than".

        Specified by:
        compareTo in interface Comparable
        Parameters:
        o1 - the object being compared to.
        Returns:
        An integer indicating the order of this data pair object relative to another object.
      • equals

        public boolean equals​(Object obj)
        Tests if this object is equal to another.
        Overrides:
        equals in class Object
        Parameters:
        obj - the object to test against for equality (null permitted).
        Returns:
        A boolean.
      • hashCode

        public int hashCode()
        Returns a hash code.
        Overrides:
        hashCode in class Object
        Returns:
        A hash code.