Class Duration

  • All Implemented Interfaces:
    Serializable, Comparable<Duration>

    public class Duration
    extends Object
    implements Serializable, Comparable<Duration>
    Implementation of xs:duration.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      Duration​(boolean pNegative, int pYears, int pMonths, int pDays, int pHours, int pMinutes, int pSeconds, long pMillis)
      Creates a new instance with the given values.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compareTo​(Duration d)
      Actual implementation of Comparable.compareTo(Object).
      boolean equals​(Object o)  
      int getDays()
      Returns the number of days.
      int getHours()
      Returns the number of hours.
      long getMillis()
      Returns the number of milliseconds.
      int getMinutes()
      Returns the number of minutes.
      int getMonths()
      Returns the number of months.
      int getSeconds()
      Returns the number of seconds.
      int getYears()
      Returns the number of years.
      int hashCode()  
      String toString()
      Returns a string representation of this Duration.
      static Duration valueOf​(String pValue)
      Converts the given String representation into an instance of Duration.
      • Methods inherited from class Object

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

      • Duration

        public Duration​(boolean pNegative,
                        int pYears,
                        int pMonths,
                        int pDays,
                        int pHours,
                        int pMinutes,
                        int pSeconds,
                        long pMillis)
        Creates a new instance with the given values.
    • Method Detail

      • getYears

        public int getYears()
        Returns the number of years.
      • getMonths

        public int getMonths()
        Returns the number of months.
      • getDays

        public int getDays()
        Returns the number of days.
      • getHours

        public int getHours()
        Returns the number of hours.
      • getMinutes

        public int getMinutes()
        Returns the number of minutes.
      • getSeconds

        public int getSeconds()
        Returns the number of seconds.
      • getMillis

        public long getMillis()
        Returns the number of milliseconds.
      • toString

        public String toString()
        Returns a string representation of this Duration.
        Overrides:
        toString in class Object
      • valueOf

        public static Duration valueOf​(String pValue)
        Converts the given String representation into an instance of Duration.
        Throws:
        IllegalArgumentException - The String could not be parsed.
      • equals

        public boolean equals​(Object o)
        Overrides:
        equals in class Object
      • compareTo

        public int compareTo​(Duration d)
        Actual implementation of Comparable.compareTo(Object).
        Specified by:
        compareTo in interface Comparable<Duration>
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object