Class XSDDuration

java.lang.Object
org.apache.jena.datatypes.xsd.AbstractDateTime
org.apache.jena.datatypes.xsd.XSDDuration
All Implemented Interfaces:
Comparable<AbstractDateTime>

public class XSDDuration extends AbstractDateTime
Represent an XSD duration value. We use a seven dimensional space with years, months, days, hours, minutes, seconds and fractional seconds. This deviates from the spec which allows arbitrary position decimals for seconds.
  • Constructor Details

    • XSDDuration

      public XSDDuration(Object value)
      Constructor - should only be used by the internals but public scope because the internals spread across multiple packages.
      Parameters:
      value - the date/time value returned by the parsing
  • Method Details

    • getYears

      public int getYears()
      Return the number of years in the duration
    • getMonths

      public int getMonths()
      Return the number of months in the duration
    • getDays

      public int getDays()
      Return the number of years in the duration
    • getHours

      public int getHours()
      Return the number of hours in the duration
    • getMinutes

      public int getMinutes()
      Return the number of minutes in the duration
    • getFullSeconds

      public int getFullSeconds()
      Return the number of full seconds in the duration
    • getSeconds

      public double getSeconds()
      Return the number of seconds in the duration, including fractional part
    • getBigSeconds

      public BigDecimal getBigSeconds()
      Return the number of seconds in the duration, including the fractional part, in a lossless but expensive notation - i.e. a BigDecimal.
    • getTimePart

      public double getTimePart()
      Return the time component of the duration - i.e. just the hours/mins/seconds, and returns the values in seconds.
    • toString

      public String toString()
      Serializer
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object obj)
      Equality function (value based).
      Overrides:
      equals in class AbstractDateTime
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class AbstractDateTime