## net.sf.saxon.value
Class SecondsDurationValue

    java.lang.Object
      net.sf.saxon.value.Value
          net.sf.saxon.value.AtomicValue
              net.sf.saxon.value.DurationValue
                  net.sf.saxon.value.SecondsDurationValue

All Implemented Interfaces:
  java.lang.Comparable, Expression, Item, java.io.Serializable, ValueRepresentation

public final class SecondsDurationValue
extends DurationValue

A value of type xsd:dayTimeDuration

See Also:
  Serialized Form

Field Summary

Fields inherited from class net.sf.saxon.value.DurationValue
`days, hours, milliseconds, minutes, months, negative, seconds, years`

Fields inherited from interface net.sf.saxon.expr.Expression
`EVALUATE_METHOD, ITERATE_METHOD, PROCESS_METHOD`

Constructor Summary
`SecondsDurationValue(java.lang.CharSequence s)` Constructor: create a duration value from a supplied string, in ISO 8601 format [+|-]PnDTnHnMnS
`SecondsDurationValue(int sign, int days, int hours, int minutes, int seconds, int milliseconds)` Create a dayTimeDuration given the number of days, hours, minutes, and seconds

Method Summary
`DurationValue` `add(DurationValue other, XPathContext context)` Add two dayTimeDurations
`java.lang.Object` `convertToJava(java.lang.Class target, XPathContext context)` Convert to Java object (for passing to external functions)
`DoubleValue` `divide(DurationValue other, XPathContext context)` Find the ratio between two durations
`static SecondsDurationValue` `fromMilliseconds(long milliseconds)` Construct a duration value as a number of milliseconds.
`static SecondsDurationValue` `fromSeconds(double seconds)` Construct a duration value as a number of seconds.
`ItemType` `getItemType()` Determine the data type of the exprssion
`long` `getLengthInMilliseconds()` Get length of duration in milliseconds, as a long
`double` `getLengthInSeconds()` Get length of duration in seconds
`java.lang.String` `getStringValue()` Convert to string
`DurationValue` `multiply(double n, XPathContext context)` Multiply duration by a number
`void` `normalize()` Normalize the value, for example 90M becomes 1H30M
`DurationValue` `subtract(DurationValue other, XPathContext context)` Subtract two dayTime-durations

Methods inherited from class net.sf.saxon.value.DurationValue
`badDuration, compareTo, convertPrimitive, equals, getComponent, hashCode`

Methods inherited from class net.sf.saxon.value.AtomicValue
`checkPermittedContents, convert, convert, display, effectiveBooleanValue, evaluateAsString, evaluateItem, getCardinality, getImplementationMethod, getLength, getPrimitiveValue, getStringValueCS, getTypedValue, hasBuiltInType, iterate, process, toString`

Methods inherited from class net.sf.saxon.value.Value
`analyze, asItem, asValue, collapseWhitespace, convert, convertJavaObjectToXPath, getDependencies, getIterator, getParentExpression, getSpecialProperties, itemAt, iterateSubExpressions, makeQNameValue, normalizeWhitespace, promote, simplify, stringToNumber, trimWhitespace`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### SecondsDurationValue

    public SecondsDurationValue(java.lang.CharSequence s)
                         throws XPathException

  Constructor: create a duration value from a supplied string, in ISO 8601 format [+|-]PnDTnHnMnS

### SecondsDurationValue

    public SecondsDurationValue(int sign,
                                int days,
                                int hours,
                                int minutes,
                                int seconds,
                                int milliseconds)

  Create a dayTimeDuration given the number of days, hours, minutes, and seconds

Method Detail

### getStringValue

    public java.lang.String getStringValue()

  Convert to string

  Specified by:
    `getStringValue` in interface `Item`
  Overrides:
    `getStringValue` in class `DurationValue`
  Returns:
    ISO 8601 representation.

### normalize

    public void normalize()
                   throws DynamicError

  Normalize the value, for example 90M becomes 1H30M

  Throws:
    `DynamicError`

### getLengthInSeconds

    public double getLengthInSeconds()

  Get length of duration in seconds

  Overrides:
    `getLengthInSeconds` in class `DurationValue`

### getLengthInMilliseconds

    public long getLengthInMilliseconds()

  Get length of duration in milliseconds, as a long

### fromSeconds

    public static SecondsDurationValue fromSeconds(double seconds)
                                            throws XPathException

  Construct a duration value as a number of seconds.

  Throws:
    `XPathException`

### fromMilliseconds

    public static SecondsDurationValue fromMilliseconds(long milliseconds)
                                                 throws XPathException

  Construct a duration value as a number of milliseconds.

  Throws:
    `XPathException`

### multiply

    public DurationValue multiply(double n,
                                  XPathContext context)
                           throws XPathException

  Multiply duration by a number

  Overrides:
    `multiply` in class `DurationValue`
  Throws:
    `XPathException`

### divide

    public DoubleValue divide(DurationValue other,
                              XPathContext context)
                       throws XPathException

  Find the ratio between two durations

  Overrides:
    `divide` in class `DurationValue`
  Parameters:
    `other` - the dividend
  Returns:
    the ratio, as a double
  Throws:
    `XPathException`

### add

    public DurationValue add(DurationValue other,
                             XPathContext context)
                      throws XPathException

  Add two dayTimeDurations

  Overrides:
    `add` in class `DurationValue`
  Throws:
    `XPathException`

### subtract

    public DurationValue subtract(DurationValue other,
                                  XPathContext context)
                           throws XPathException

  Subtract two dayTime-durations

  Overrides:
    `subtract` in class `DurationValue`
  Throws:
    `XPathException`

### getItemType

    public ItemType getItemType()

  Determine the data type of the exprssion

  Specified by:
    `getItemType` in interface `Expression`
  Overrides:
    `getItemType` in class `DurationValue`
  Returns:
    Type.DAY_TIME_DURATION,

### convertToJava

    public java.lang.Object convertToJava(java.lang.Class target,
                                          XPathContext context)
                                   throws XPathException

  Convert to Java object (for passing to external functions)

  Overrides:
    `convertToJava` in class `DurationValue`
  Throws:
    `XPathException`