net.sf.saxon.value
public final class MonthDurationValue extends DurationValue implements Comparable
Constructor Summary | |
---|---|
MonthDurationValue(CharSequence s)
Constructor: create a duration value from a supplied string, in
ISO 8601 format [+|-]PnYnM |
Method Summary | |
---|---|
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 |
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: other the dividend
Returns: the ratio, as a decimal
Throws: XPathException
Parameters: th
Returns: Type.YEAR_MONTH_DURATION,
Returns: ISO 8601 representation.