Class LocalDateDoublePoint

  • All Implemented Interfaces:
    java.lang.Comparable<LocalDateDoublePoint>

    public final class LocalDateDoublePoint
    extends java.lang.Object
    implements java.lang.Comparable<LocalDateDoublePoint>
    Immutable representation of a single point in a LocalDateDoubleTimeSeries.

    This implementation uses arrays internally.

    • Method Detail

      • of

        public static LocalDateDoublePoint of​(java.time.LocalDate date,
                                              double value)
        Obtains a point from date and value.
        Parameters:
        date - the date
        value - the value
        Returns:
        the point
      • getDate

        public java.time.LocalDate getDate()
        Gets the date.
        Returns:
        the date
      • getValue

        public double getValue()
        Gets the value.
        Returns:
        the value
      • withDate

        public LocalDateDoublePoint withDate​(java.time.LocalDate date)
        Returns a copy of this point with another date.
        Parameters:
        date - the date to change the point to
        Returns:
        a point based on this point with the date changed
      • withValue

        public LocalDateDoublePoint withValue​(double value)
        Returns a copy of this point with another value.
        Parameters:
        value - the value to change the point to
        Returns:
        a point based on this point with the value changed
      • compareTo

        public int compareTo​(LocalDateDoublePoint other)
        Compares this point to another.

        The sort order is by date, then by double. This is compatible with equals.

        Specified by:
        compareTo in interface java.lang.Comparable<LocalDateDoublePoint>
        Parameters:
        other - the other point
        Returns:
        negative if this is less than, zero if equal, positive if greater than
      • equals

        public boolean equals​(java.lang.Object obj)
        Checks if this point is equal to another point.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        obj - the object to check, null returns false
        Returns:
        true if this is equal to the other point
      • hashCode

        public int hashCode()
        A hash code for this point.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        a suitable hash code
      • toString

        public java.lang.String toString()
        Returns a string representation of the point.
        Overrides:
        toString in class java.lang.Object
        Returns:
        the string