public final class MonthDurationValue extends DurationValue implements Comparable
days, hours, microseconds, minutes, months, negative, seconds, yearsEMPTY_CLASS_ARRAYEMPTY_VALUE_ARRAYEVALUATE_METHOD, ITERATE_METHOD, PROCESS_METHOD| Constructor and Description |
|---|
MonthDurationValue(CharSequence s)
Constructor: create a duration value from a supplied string, in
ISO 8601 format [+|-]PnYnM
|
| Modifier and Type | Method and Description |
|---|---|
DurationValue |
add(DurationValue other,
XPathContext context)
Add two year-month-durations
|
int |
compareTo(Object other)
Compare the value to another duration value
|
Object |
convertToJava(Class target,
XPathContext context)
Convert to Java object (for passing to external functions)
|
DecimalValue |
divide(DurationValue other,
XPathContext context)
Find the ratio between two durations
|
static MonthDurationValue |
fromMonths(int months)
Construct a duration value as a number of months.
|
ItemType |
getItemType(TypeHierarchy th)
Determine the data type of the exprssion
|
int |
getLengthInMonths()
Get the number of months in the duration
|
CharSequence |
getStringValueCS()
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 year-month-durations
|
badDuration, convertPrimitive, equals, getComponent, getLengthInSeconds, getStringValue, hashCode, normalizeDuration, normalizeZeroDuration, schemaEqualscheckPermittedContents, convert, convert, display, effectiveBooleanValue, evaluateAsString, evaluateItem, getCardinality, getImplementationMethod, getLength, getPrimitiveValue, getTypedValue, hasBuiltInType, iterate, process, toStringasItem, asIterator, asValue, collapseWhitespace, convert, convertJavaObjectToXPath, getDependencies, getIterator, getParentExpression, getSpecialProperties, itemAt, iterateSubExpressions, makeQNameValue, normalizeWhitespace, optimize, promote, reduce, simplify, stringToNumber, trimWhitespace, typeCheckpublic MonthDurationValue(CharSequence s) throws XPathException
XPathExceptionpublic CharSequence getStringValueCS()
getStringValueCS in interface ItemgetStringValueCS in class DurationValueItem.getStringValue()public void normalize()
public int getLengthInMonths()
public static MonthDurationValue fromMonths(int months)
public DurationValue multiply(double n, XPathContext context) throws XPathException
multiply in class DurationValueXPathExceptionpublic DecimalValue divide(DurationValue other, XPathContext context) throws XPathException
divide in class DurationValueother - the dividendXPathExceptionpublic DurationValue add(DurationValue other, XPathContext context) throws XPathException
add in class DurationValueXPathExceptionpublic DurationValue subtract(DurationValue other, XPathContext context) throws XPathException
subtract in class DurationValueXPathExceptionpublic ItemType getItemType(TypeHierarchy th)
getItemType in interface ExpressiongetItemType in class DurationValueth - public Object convertToJava(Class target, XPathContext context) throws XPathException
convertToJava in class DurationValueXPathExceptionpublic int compareTo(Object other)
compareTo in interface Comparableother - The other dateTime valueClassCastException - if the other value is not a DateTimeValue (the parameter
is declared as Object to satisfy the Comparable interface)