|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.saxon.value.Value
net.sf.saxon.value.AtomicValue
net.sf.saxon.value.DurationValue
public class DurationValue
A value of type xs:duration
Field Summary |
---|
Fields inherited from class net.sf.saxon.value.Value |
---|
EMPTY_CLASS_ARRAY, INDETERMINATE_ORDERING |
Fields inherited from interface net.sf.saxon.om.ValueRepresentation |
---|
EMPTY_VALUE_ARRAY |
Constructor Summary | |
---|---|
DurationValue(boolean positive,
int years,
int months,
int days,
int hours,
int minutes,
int seconds,
int microseconds)
|
|
DurationValue(boolean positive,
int years,
int months,
int days,
int hours,
int minutes,
int seconds,
int microseconds,
AtomicType type)
|
|
DurationValue(CharSequence s)
Constructor: create a duration value from a supplied string, in ISO 8601 format [-]PnYnMnDTnHnMnS |
Method Summary | |
---|---|
DurationValue |
add(DurationValue other)
Add two durations |
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) |
AtomicValue |
copy(AtomicType typeLabel)
Create a copy of this atomic value, with a different type label |
DecimalValue |
divide(DurationValue other)
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 normalized value |
int |
getDays()
Get the days component |
int |
getHours()
Get the hours component |
double |
getLengthInSeconds()
Get length of duration in seconds, assuming an average length of month. |
int |
getMicroseconds()
Get the microseconds component |
int |
getMinutes()
Get the minutes component |
int |
getMonths()
Get the months component |
BuiltInAtomicType |
getPrimitiveType()
Determine the primitive type of the value. |
Comparable |
getSchemaComparable()
Get a Comparable value that implements the XML Schema ordering comparison semantics for this value. |
static Comparable |
getSchemaComparable(DurationValue value)
Get a Comparable value that implements the XML Schema ordering comparison semantics for this value. |
int |
getSeconds()
Get the seconds component |
String |
getStringValue()
Convert the value to a string, using the serialization rules. |
CharSequence |
getStringValueCS()
Convert to string |
Comparable |
getXPathComparable()
Get a Comparable value that implements the XPath ordering comparison semantics for this value. |
int |
getYears()
Get the year component |
int |
hashCode()
Return a hash code to support the equals() function |
DurationValue |
multiply(double factor)
Multiply a duration by a number |
DurationValue |
negate()
Negate a duration (same as subtracting from zero, but it preserves the type of the original duration) |
DurationValue |
normalizeDuration()
Normalize the duration, so that months<12, hours<24, minutes<60, seconds<60. |
int |
signum()
Return the signum of the value |
DurationValue |
subtract(DurationValue other)
Subtract two durations |
Methods inherited from class net.sf.saxon.value.AtomicValue |
---|
checkPermittedContents, convert, convert, effectiveBooleanValue, getCardinality, getItemType, getLength, getTypedValue, getTypeLabel, hasBuiltInType, isMultiValued, itemAt, iterate, process, setTypeLabel, toString |
Methods inherited from class net.sf.saxon.value.Value |
---|
asItem, asItem, asIterator, asValue, compareTo, convert, convertJavaObjectToXPath, fromItem, getCanonicalLexicalRepresentation, getIterator, iterate, makeQNameValue, reduce, stringToNumber |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public DurationValue(boolean positive, int years, int months, int days, int hours, int minutes, int seconds, int microseconds)
public DurationValue(boolean positive, int years, int months, int days, int hours, int minutes, int seconds, int microseconds, AtomicType type)
public DurationValue(CharSequence s) throws XPathException
XPathException
Method Detail |
---|
public AtomicValue copy(AtomicType typeLabel)
copy
in class AtomicValue
typeLabel
- the type label of the new copy. The caller is responsible for checking that
the value actually conforms to this type.public BuiltInAtomicType getPrimitiveType()
getPrimitiveType
in class AtomicValue
public AtomicValue convertPrimitive(BuiltInAtomicType requiredType, boolean validate, XPathContext context)
convertPrimitive
in class AtomicValue
requiredType
- an integer identifying the required atomic typevalidate
- if set to false, the caller asserts that the value is known to be validcontext
-
ValidationErrorValue
if
the value cannot be converted.public DurationValue normalizeDuration()
public int signum()
public int getYears()
public int getMonths()
public int getDays()
public int getHours()
public int getMinutes()
public int getSeconds()
public int getMicroseconds()
public String getStringValue()
getStringValue
in interface Item
getStringValue
in interface ValueRepresentation
getStringValue
in class AtomicValue
Item.getStringValueCS()
public CharSequence getStringValueCS()
getStringValueCS
in interface Item
getStringValueCS
in interface ValueRepresentation
getStringValueCS
in class AtomicValue
Item.getStringValue()
public double getLengthInSeconds()
public Object convertToJava(Class target, XPathContext context) throws XPathException
convertToJava
in class Value
XPathException
public AtomicValue getComponent(int component) throws XPathException
getComponent
in class AtomicValue
XPathException
public boolean equals(Object other)
equals
in class Value
ClassCastException
- if the other value is not an xs:duration or subtype thereofpublic int hashCode()
Value
hashCode
in class Value
public DurationValue add(DurationValue other) throws XPathException
XPathException
public DurationValue subtract(DurationValue other) throws XPathException
XPathException
public DurationValue negate()
public DurationValue multiply(double factor) throws XPathException
XPathException
public DecimalValue divide(DurationValue other) throws XPathException
XPathException
public Comparable getXPathComparable()
getXPathComparable
in class AtomicValue
public Comparable getSchemaComparable()
getSchemaComparable
in class Value
public static Comparable getSchemaComparable(DurationValue value)
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |