java.io.Serializable
, java.lang.Comparable
, Expression
, Item
, ValueRepresentation
public final class SecondsDurationValue extends DurationValue implements java.lang.Comparable
days, hours, microseconds, minutes, months, negative, normalized, seconds, years
EVALUATE_METHOD, ITERATE_METHOD, PROCESS_METHOD
EMPTY_CLASS_ARRAY
EMPTY_VALUE_ARRAY
Constructor | Description |
---|---|
SecondsDurationValue(int sign,
int days,
int hours,
int minutes,
int seconds,
int microseconds) |
Create a dayTimeDuration given the number of days, hours, minutes, and seconds
|
SecondsDurationValue(java.lang.CharSequence s) |
Constructor: create a duration value from a supplied string, in
ISO 8601 format [-]PnDTnHnMnS
|
Modifier and Type | Method | Description |
---|---|---|
DurationValue |
add(DurationValue other) |
Add two dayTimeDurations
|
int |
compareTo(java.lang.Object other) |
Compare the value to another duration value
|
java.lang.Object |
convertToJava(java.lang.Class target,
XPathContext context) |
Convert to Java object (for passing to external functions)
|
DecimalValue |
divide(DurationValue other) |
Find the ratio between two durations
|
static SecondsDurationValue |
fromMicroseconds(long microseconds) |
Construct a duration value as a number of microseconds.
|
static SecondsDurationValue |
fromMilliseconds(long milliseconds) |
Construct a duration value as a number of milliseconds.
|
static SecondsDurationValue |
fromSeconds(java.math.BigDecimal seconds) |
Construct a duration value as a number of seconds.
|
ItemType |
getItemType(TypeHierarchy th) |
Determine the data type of the exprssion
|
long |
getLengthInMicroseconds() |
Get length of duration in microseconds, as a long
|
long |
getLengthInMilliseconds() |
Get length of duration in milliseconds, as a long
|
double |
getLengthInSeconds() |
Get length of duration in seconds
|
java.lang.CharSequence |
getStringValueCS() |
Convert to string
|
DurationValue |
multiply(double n) |
Multiply duration by a number.
|
DurationValue |
negate() |
Negate a duration (same as subtracting from zero, but it preserves the type of the original duration)
|
void |
normalize() |
Normalize the value, for example 90M becomes 1H30M
|
DurationValue |
subtract(DurationValue other) |
Subtract two dayTime-durations
|
checkPermittedContents, convert, convert, display, effectiveBooleanValue, evaluateAsString, evaluateItem, getCardinality, getImplementationMethod, getLength, getPrimitiveValue, getTypedValue, hasBuiltInType, iterate, process, toString
badDuration, convertPrimitive, equals, getComponent, getStringValue, hashCode, normalizeDuration, normalizeZeroDuration, signum
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
asItem, asIterator, asValue, convert, convertJavaObjectToXPath, getDependencies, getIterator, getParentExpression, getSpecialProperties, itemAt, iterateSubExpressions, makeQNameValue, optimize, promote, reduce, simplify, stringToNumber, typeCheck
public SecondsDurationValue(java.lang.CharSequence s) throws XPathException
XPathException
public SecondsDurationValue(int sign, int days, int hours, int minutes, int seconds, int microseconds) throws ValidationException
ValidationException
public java.lang.CharSequence getStringValueCS()
getStringValueCS
in interface Item
getStringValueCS
in interface ValueRepresentation
getStringValueCS
in class DurationValue
Item.getStringValue()
public void normalize() throws ValidationException
ValidationException
public double getLengthInSeconds()
getLengthInSeconds
in class DurationValue
public long getLengthInMilliseconds()
public long getLengthInMicroseconds()
public static SecondsDurationValue fromSeconds(java.math.BigDecimal seconds) throws XPathException
XPathException
public static SecondsDurationValue fromMilliseconds(long milliseconds) throws XPathException
XPathException
public static SecondsDurationValue fromMicroseconds(long microseconds) throws XPathException
XPathException
public DurationValue multiply(double n) throws XPathException
multiply
in class DurationValue
XPathException
public DecimalValue divide(DurationValue other) throws XPathException
divide
in class DurationValue
other
- the dividendXPathException
public DurationValue add(DurationValue other) throws XPathException
add
in class DurationValue
XPathException
public DurationValue subtract(DurationValue other) throws XPathException
subtract
in class DurationValue
XPathException
public DurationValue negate()
negate
in class DurationValue
public int compareTo(java.lang.Object other)
compareTo
in interface java.lang.Comparable
other
- The other dateTime valuejava.lang.ClassCastException
- if the other value is not a DateTimeValue (the parameter
is declared as Object to satisfy the Comparable interface)public ItemType getItemType(TypeHierarchy th)
getItemType
in interface Expression
getItemType
in class DurationValue
th
- public java.lang.Object convertToJava(java.lang.Class target, XPathContext context) throws XPathException
convertToJava
in class DurationValue
XPathException