Class Interval

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

    public final class Interval
    extends java.lang.Object
    implements java.lang.Comparable<Interval>
    An interval data type.
    • Constructor Summary

      Constructors 
      Constructor Description
      Interval​(int years, int months, int days, int hours, int minutes, int seconds, int microseconds)
      Creates an interval value from a number of years, months, days, hours, minutes, seconds, and microseconds.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compareTo​(Interval other)
      Compares this interval with the specified interval for order.
      boolean equals​(java.lang.Object that)
      Checks two intervals for equality.
      int getDays()
      Gets the days.
      int getHours()
      Gets the hours.
      int getMicroseconds()
      Gets the microseconds.
      int getMinutes()
      Gets the minutes.
      int getMonths()
      Gets the months.
      int getSeconds()
      Gets the seconds.
      int getYears()
      Gets the years.
      int hashCode()
      Computes a hash code.
      java.lang.String toString()
      Gets a string representation that matches the ISO 8601 duration representation (https://en.wikipedia .org/wiki/ISO_8601#Durations).
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Interval

        public Interval​(int years,
                        int months,
                        int days,
                        int hours,
                        int minutes,
                        int seconds,
                        int microseconds)
        Creates an interval value from a number of years, months, days, hours, minutes, seconds, and microseconds.
        Parameters:
        years - The years.
        months - The months.
        days - The days.
        hours - The hours.
        minutes - The minutes.
        seconds - The seconds.
        microseconds - The microseconds.
        Throws:
        HyperException - If column is not defined as HYPER_Interval.
    • Method Detail

      • getYears

        public int getYears()
        Gets the years.
        Returns:
        The years.
      • getMonths

        public int getMonths()
        Gets the months.
        Returns:
        The months.
      • getDays

        public int getDays()
        Gets the days.
        Returns:
        The days.
      • getHours

        public int getHours()
        Gets the hours.
        Returns:
        The hours.
      • getMinutes

        public int getMinutes()
        Gets the minutes.
        Returns:
        The minutes.
      • getSeconds

        public int getSeconds()
        Gets the seconds.
        Returns:
        The seconds.
      • getMicroseconds

        public int getMicroseconds()
        Gets the microseconds.
        Returns:
        The microseconds.
      • toString

        public java.lang.String toString()
        Gets a string representation that matches the ISO 8601 duration representation (https://en.wikipedia .org/wiki/ISO_8601#Durations).
        Overrides:
        toString in class java.lang.Object
        Returns:
        The ISO 8601 duration representation.
      • equals

        public boolean equals​(java.lang.Object that)
        Checks two intervals for equality.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        that - The other interval.
        Returns:
        Whether the two intervals are equal.
      • hashCode

        public int hashCode()
        Computes a hash code.
        Overrides:
        hashCode in class java.lang.Object
      • compareTo

        public int compareTo​(Interval other)
        Compares this interval with the specified interval for order.
        Specified by:
        compareTo in interface java.lang.Comparable<Interval>
        Parameters:
        other - The other interval.
        Returns:
        A negative integer, zero, or a positive integer as this interval is less than, equal to, or greater than the other interval.