net.sf.saxon.value
public class DurationValue extends AtomicValue
Field Summary | |
---|---|
protected int | days |
protected int | hours |
protected int | microseconds |
protected int | minutes |
protected int | months |
protected boolean | negative |
protected int | seconds |
protected int | years |
Constructor Summary | |
---|---|
protected | DurationValue()
Private constructor for internal use |
DurationValue(boolean positive, int years, int months, int days, int hours, int minutes, int seconds, int microseconds) | |
DurationValue(CharSequence s)
Constructor: create a duration value from a supplied string, in
ISO 8601 format [-]PnYnMnDTnHnMnS |
Method Summary | |
---|---|
DurationValue | add(DurationValue other, XPathContext context)
Add two durations |
protected void | badDuration(String msg, CharSequence s) |
AtomicValue | convertPrimitive(BuiltInAtomicType requiredType, boolean validate, XPathContext context)
Convert to target data type |
Object | convertToJava(Class target, XPathContext context)
Convert to Java object (for passing to external functions) |
DecimalValue | divide(DurationValue other, XPathContext context)
Divide a duration by a another duration |
boolean | equals(Object other)
Test if the two durations are of equal length. |
AtomicValue | getComponent(int component)
Get a component of the value |
ItemType | getItemType(TypeHierarchy th)
Determine the data type of the exprssion |
double | getLengthInSeconds()
Get length of duration in seconds, assuming an average length of month. |
String | getStringValue()
Convert the value to a string, using the serialization rules.
|
CharSequence | getStringValueCS()
Convert to string |
int | hashCode() |
DurationValue | multiply(double factor, XPathContext context)
Multiply a duration by a number |
DurationValue | normalizeDuration()
Normalize the duration, so that months<12, hours<24, minutes<60, seconds<60.
|
protected void | normalizeZeroDuration() |
boolean | schemaEquals(Value obj)
Compare two values for equality. |
DurationValue | subtract(DurationValue other, XPathContext context)
Subtract two durations |
Parameters: requiredType an integer identifying the required atomic type validate if set to false, the caller asserts that the value is known to be valid context
Returns: an AtomicValue, a value of the required type; or a ValidationErrorValue if the value cannot be converted.
Parameters: th
Returns: Type.DURATION,
Returns: ISO 8601 representation.