net.sf.saxon.value
public final class YearMonthDurationValue extends DurationValue implements Comparable
Method Summary | |
---|---|
DurationValue | add(DurationValue other)
Add two year-month-durations |
int | compareTo(Object other)
Compare the value to another duration value
|
AtomicValue | copyAsSubType(AtomicType typeLabel)
Create a copy of this atomic value, with a different type label
|
DecimalValue | divide(DurationValue other)
Find the ratio between two durations
|
static YearMonthDurationValue | fromMonths(int months)
Construct a duration value as a number of months.
|
int | getLengthInMonths()
Get the number of months in the duration
|
CharSequence | getPrimitiveStringValue()
Convert to string
|
BuiltInAtomicType | getPrimitiveType()
Determine the primitive type of the value. |
Object | getXPathComparable(boolean ordered, StringCollator collator, XPathContext context)
Get a Comparable value that implements the XPath ordering comparison semantics for this value.
|
static ConversionResult | makeYearMonthDurationValue(CharSequence s)
Static factory: create a duration value from a supplied string, in
ISO 8601 format [+|-]PnYnM
|
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) |
DurationValue | subtract(DurationValue other)
Subtract two year-month-durations |
Parameters: other The other dateTime value
Returns: negative value if this one is the earler, 0 if they are chronologically equal, positive value if this one is the later. For this purpose, dateTime values with an unknown timezone are considered to be UTC values (the Comparable interface requires a total ordering).
Throws: ClassCastException if the other value is not a DateTimeValue (the parameter is declared as Object to satisfy the Comparable interface)
Parameters: typeLabel the type label of the new copy. The caller is responsible for checking that the value actually conforms to this type.
Parameters: other the dividend
Returns: the ratio, as a decimal
Throws: XPathException
Parameters: months the number of months (may be negative)
Returns: the corresponding xs:yearMonthDuration value
Returns: the number of months in the duration
Returns: ISO 8601 representation.
Parameters: ordered collator context
Parameters: s a string in the lexical space of xs:yearMonthDuration.
Returns: either a YearMonthDurationValue, or a ValidationFailure if the string was not in the lexical space of xs:yearMonthDuration.