Class Time

    • Constructor Summary

      Constructors 
      Constructor Description
      Time()
      Creates a new Time object representing the actual time.
      Time​(int _hours, int _minutes, int _seconds)
      Creates a new time object.
      Time​(String literal)
      Parses a literal and creates a corresponding new time object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Time add​(Duration duration)
      Adds some Duration to this Time object.
      Time clone()
      Creates a clone of this object.
      int compareTo​(Time otherTime)
      Compares two Time objects.
      boolean equals​(Object object)
      Test for equality.
      String format()
      Formats this Time object with default format.
      The default format is defined in the configuration under Formats > Time > default.
      String format​(String formatName)
      Formats this Time object with given format.
      int getHours()
      Returns the hours of this time object.
      int getMinutes()
      Returns the minutes of this time object.
      int getSeconds()
      Returns the seconds of this time object.
      int hashCode()
      Same as toNumber().
      Time minus​(Duration duration)
      Subtracts some Duration from this Time object.
      Duration minus​(Time time)
      Returns a normalized Duration representing the difference between this Time and the argument.
      int toNumber()
      Converts the Time object in a number; this number correspond the seconds after 00:00:00.
      String toString()
      Returns this time as a String in the format hh:mm:ss
    • Field Detail

      • UNINITIALIZED_TIME

        public static final Time UNINITIALIZED_TIME
        An uninitialized time object.
        API:
        This public API is available in IvyScript and Java. It has the visibility EXPERT.
      • INVALID

        public static final Time INVALID
        An invalid time object. Used by the widget validation
        API:
        This public API is available in IvyScript and Java. It has the visibility EXPERT.
    • Constructor Detail

      • Time

        public Time​(int _hours,
                    int _minutes,
                    int _seconds)
        Creates a new time object.
        Parameters:
        _hours -
        _minutes -
        _seconds -
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • Time

        public Time()
        Creates a new Time object representing the actual time.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • Time

        public Time​(String literal)
        Parses a literal and creates a corresponding new time object. If the format of the argument is not correct, an uninitialized Object is created.
        Parameters:
        literal - A literal to parse in the format hh:mm:ss or hh:mm.
        Throws:
        IllegalArgumentException - if the argument has an illegal format.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
    • Method Detail

      • getHours

        public int getHours()
        Returns the hours of this time object.
        Returns:
        The hours of this time object.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • getMinutes

        public int getMinutes()
        Returns the minutes of this time object.
        Returns:
        The minutes of this time object.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • getSeconds

        public int getSeconds()
        Returns the seconds of this time object.
        Returns:
        The seconds of this time object.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • add

        public Time add​(Duration duration)
        Adds some Duration to this Time object.
        Parameters:
        duration - A duration.
        Returns:
        The time after adding the duration.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • minus

        public Time minus​(Duration duration)
        Subtracts some Duration from this Time object.
        Parameters:
        duration - A duration.
        Returns:
        The time after adding the duration.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • minus

        public Duration minus​(Time time)
        Returns a normalized Duration representing the difference between this Time and the argument.
        Parameters:
        time -
        Returns:
        A normalized Duration
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • toNumber

        public int toNumber()
        Converts the Time object in a number; this number correspond the seconds after 00:00:00.
        Returns:
        The number of seconds of this time object.
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • equals

        public boolean equals​(Object object)
        Test for equality.
        Parameters:
        object - Another object.
        Returns:
        true if the two time objects represents the same time.
        API:
        This public API is available in IvyScript and Java. It has the visibility EXPERT.
      • hashCode

        public int hashCode()
        Same as toNumber().
        Returns:
        The same as toNumber().
        API:
        This public API is available in IvyScript and Java. It has the visibility EXPERT.
      • format

        public String format()
        Formats this Time object with default format.
        The default format is defined in the configuration under Formats > Time > default.
        Returns:
        formatted string
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • format

        public String format​(String formatName)
        Formats this Time object with given format.
        Parameters:
        formatName - Name of a configuration under Formats > Time.
        E.g. "default", "medium", "short" etc.
        Returns:
        formatted string
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • compareTo

        public int compareTo​(Time otherTime)
        Compares two Time objects.
        Parameters:
        otherTime - Some time object.
        Returns:
        -1 if the receiver is earlier than the argument, 0 if the receiver and the argument are equal, 1 if the receiver is after the argument.
        See Also:
        Comparable.compareTo(T)
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • toString

        public String toString()
        Returns this time as a String in the format hh:mm:ss
        Returns:
        this time as a String in the format hh:mm:ss
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • clone

        public Time clone()
        Creates a clone of this object.
        Specified by:
        clone in interface IIvyDataObject
        Returns:
        A shallow clone.
        API:
        This public API is available in IvyScript and Java. It has the visibility EXPERT.