net.sf.saxon.value
Class SecondsDurationValue

java.lang.Object
  extended bynet.sf.saxon.value.Value
      extended bynet.sf.saxon.value.AtomicValue
          extended bynet.sf.saxon.value.DurationValue
              extended bynet.sf.saxon.value.SecondsDurationValue
All Implemented Interfaces:
Comparable, Expression, Item, Serializable

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
 
Constructor Summary
SecondsDurationValue(CharSequence s)
          Constructor: create a duration value from a supplied string, in ISO 8601 format [+|-]PnDTnHnMnS
 
Method Summary
 DurationValue add(DurationValue other)
          Add two dayTime-durations
 int conversionPreference(Class required)
          Get conversion preference for this value to a Java class.
 Object convertToJava(Class target)
          Convert to Java object (for passing to external functions)
 void display(int level, NamePool pool)
          Diagnostic print of expression structure
static SecondsDurationValue fromSeconds(double seconds)
          Construct a duration value as a number of seconds.
 ItemType getItemType()
          Determine the data type of the exprssion
 double getLengthInSeconds()
          Get length of duration in seconds, assuming an average length of month
 String getStringValue()
          Convert to string
 DurationValue multiply(double n)
          Multiply duration by a number
 void normalize()
          Normalize the value, for example 90M becomes 1H30M
 DurationValue subtract(DurationValue other)
          Subtract two dayTime-durations
 
Methods inherited from class net.sf.saxon.value.DurationValue
badDuration, compareTo, convert, equals, getComponent, hashCode
 
Methods inherited from class net.sf.saxon.value.AtomicValue
convert, convert, effectiveBooleanValue, evaluateAsString, evaluateItem, getCardinality, getPrimitiveValue, getTypedValue, iterate
 
Methods inherited from class net.sf.saxon.value.Value
analyze, asItem, asValue, collapseWhitespace, getDependencies, getSpecialProperties, getSubExpressions, inverse, normalizeWhitespace, promote, simplify, stringToInteger, stringToNumber, trimWhitespace
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SecondsDurationValue

public SecondsDurationValue(CharSequence s)
                     throws XPathException
Constructor: create a duration value from a supplied string, in ISO 8601 format [+|-]PnDTnHnMnS

Method Detail

getStringValue

public 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 XPathException.Dynamic
Normalize the value, for example 90M becomes 1H30M

Throws:
XPathException.Dynamic

getLengthInSeconds

public double getLengthInSeconds()
Get length of duration in seconds, assuming an average length of month

Overrides:
getLengthInSeconds in class DurationValue

fromSeconds

public static SecondsDurationValue fromSeconds(double seconds)
                                        throws XPathException
Construct a duration value as a number of seconds.

Throws:
XPathException

multiply

public DurationValue multiply(double n)
                       throws XPathException
Multiply duration by a number

Overrides:
multiply in class DurationValue
Throws:
XPathException

add

public DurationValue add(DurationValue other)
                  throws XPathException
Add two dayTime-durations

Overrides:
add in class DurationValue
Throws:
XPathException

subtract

public DurationValue subtract(DurationValue other)
                       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,

conversionPreference

public int conversionPreference(Class required)
Get conversion preference for this value to a Java class. A low result indicates higher preference.

Overrides:
conversionPreference in class DurationValue

convertToJava

public Object convertToJava(Class target)
                     throws XPathException
Convert to Java object (for passing to external functions)

Overrides:
convertToJava in class DurationValue
Throws:
XPathException

display

public void display(int level,
                    NamePool pool)
Diagnostic print of expression structure

Specified by:
display in interface Expression
Overrides:
display in class DurationValue