| java.lang.Object net.sf.saxon.value.Value net.sf.saxon.value.AtomicValue net.sf.saxon.value.DurationValue
All known Subclasses: net.sf.saxon.value.MonthDurationValue, net.sf.saxon.value.SecondsDurationValue,
DurationValue | public class DurationValue extends AtomicValue (Code) | | A value of type xs:duration
|
Method Summary | |
public DurationValue | add(DurationValue other, XPathContext context) | protected void | badDuration(String msg, CharSequence s) | public AtomicValue | convertPrimitive(BuiltInAtomicType requiredType, boolean validate, XPathContext context) | public Object | convertToJava(Class target, XPathContext context) | public DecimalValue | divide(DurationValue other, XPathContext context) | public boolean | equals(Object other) Test if the two durations are of equal length. | public AtomicValue | getComponent(int component) | public ItemType | getItemType(TypeHierarchy th) | public double | getLengthInSeconds() Get length of duration in seconds, assuming an average length of month. | public String | getStringValue() Convert the value to a string, using the serialization rules.
For atomic values this is the same as a cast; for sequence values
it gives a space-separated list. | public CharSequence | getStringValueCS() | public int | hashCode() | public DurationValue | multiply(double factor, XPathContext context) | public DurationValue | normalizeDuration() Normalize the duration, so that months<12, hours<24, minutes<60, seconds<60.
At present we do this when converting to a string. | public boolean | schemaEquals(Value obj) Compare two values for equality. | public DurationValue | subtract(DurationValue other, XPathContext context) |
hours | protected int hours(Code) | | |
microseconds | protected int microseconds(Code) | | |
minutes | protected int minutes(Code) | | |
months | protected int months(Code) | | |
negative | protected boolean negative(Code) | | |
seconds | protected int seconds(Code) | | |
years | protected int years(Code) | | |
DurationValue | protected DurationValue()(Code) | | Private constructor for internal use
|
DurationValue | public DurationValue(boolean positive, int years, int months, int days, int hours, int minutes, int seconds, int microseconds)(Code) | | |
DurationValue | public DurationValue(CharSequence s) throws XPathException(Code) | | Constructor: create a duration value from a supplied string, in
ISO 8601 format [+|-]PnYnMnDTnHnMnS
|
convertPrimitive | public AtomicValue convertPrimitive(BuiltInAtomicType requiredType, boolean validate, XPathContext context)(Code) | | Convert to target data type
Parameters: requiredType - an integer identifying the required atomic type Parameters: context - an AtomicValue, a value of the required type; or an ErrorValue |
equals | public boolean equals(Object other)(Code) | | Test if the two durations are of equal length. Note: this function is defined
in XPath 2.0, but its semantics are currently unclear.
|
getLengthInSeconds | public double getLengthInSeconds()(Code) | | Get length of duration in seconds, assuming an average length of month. (Note, this defines a total
ordering on durations which is different from the partial order defined in XML Schema; XPath 2.0
currently avoids defining an ordering at all. But the ordering here is consistent with the ordering
of the two duration subtypes in XPath 2.0.)
|
getStringValue | public String getStringValue()(Code) | | Convert the value to a string, using the serialization rules.
For atomic values this is the same as a cast; for sequence values
it gives a space-separated list. This method is refined for AtomicValues
so that it never throws an Exception.
|
getStringValueCS | public CharSequence getStringValueCS()(Code) | | Convert to string
ISO 8601 representation. |
hashCode | public int hashCode()(Code) | | |
normalizeDuration | public DurationValue normalizeDuration()(Code) | | Normalize the duration, so that months<12, hours<24, minutes<60, seconds<60.
At present we do this when converting to a string. It's possible that it should be done immediately
on constructing the duration (so that component extraction functions get the normalized value).
We're awaiting clarification of the spec...
|
schemaEquals | public boolean schemaEquals(Value obj)(Code) | | Compare two values for equality. This supports the matching rules in XML Schema, which say that two
durations are equal only if all six components are equal (thus 12 months does not equal one year).
|
Fields inherited from net.sf.saxon.value.Value | final public static Class[] EMPTY_CLASS_ARRAY(Code)(Java Doc)
|
Methods inherited from net.sf.saxon.value.Value | public static Item asItem(ValueRepresentation value, XPathContext context) throws XPathException(Code)(Java Doc) public static SequenceIterator asIterator(ValueRepresentation val, XPathContext context) throws XPathException(Code)(Java Doc) public static Value asValue(ValueRepresentation val)(Code)(Java Doc) public void checkPermittedContents(SchemaType parentType, StaticContext env, boolean whole) throws XPathException(Code)(Java Doc) public static CharSequence collapseWhitespace(CharSequence in)(Code)(Java Doc) public static Object convert(Item item) throws XPathException(Code)(Java Doc) public static Value convertJavaObjectToXPath(Object object, SequenceType requiredType, Configuration config) throws XPathException(Code)(Java Doc) public Object convertToJava(Class target, XPathContext context) throws XPathException(Code)(Java Doc) public void display(int level, NamePool pool, PrintStream out)(Code)(Java Doc) public boolean effectiveBooleanValue(XPathContext context) throws XPathException(Code)(Java Doc) public boolean equals(Object obj)(Code)(Java Doc) public String evaluateAsString(XPathContext context) throws XPathException(Code)(Java Doc) public Item evaluateItem(XPathContext context) throws XPathException(Code)(Java Doc) public int getCardinality()(Code)(Java Doc) final public int getDependencies()(Code)(Java Doc) public ItemType getItemType(TypeHierarchy th)(Code)(Java Doc) public static SequenceIterator getIterator(ValueRepresentation val) throws XPathException(Code)(Java Doc) public int getLength() throws XPathException(Code)(Java Doc) final public Container getParentExpression()(Code)(Java Doc) public int getSpecialProperties()(Code)(Java Doc) public String getStringValue() throws XPathException(Code)(Java Doc) public int hashCode()(Code)(Java Doc) public Item itemAt(int n) throws XPathException(Code)(Java Doc) final public Iterator iterateSubExpressions()(Code)(Java Doc) public static QNameValue makeQNameValue(Object object, Configuration config)(Code)(Java Doc) public static CharSequence normalizeWhitespace(CharSequence in)(Code)(Java Doc) final public Expression optimize(Optimizer opt, StaticContext env, ItemType contextItemType)(Code)(Java Doc) public void process(XPathContext context) throws XPathException(Code)(Java Doc) final public Expression promote(PromotionOffer offer)(Code)(Java Doc) public Value reduce() throws XPathException(Code)(Java Doc) public boolean schemaEquals(Value obj)(Code)(Java Doc) final public Expression simplify(StaticContext env)(Code)(Java Doc) public static double stringToNumber(CharSequence s) throws NumberFormatException(Code)(Java Doc) public String toString()(Code)(Java Doc) public static CharSequence trimWhitespace(CharSequence in)(Code)(Java Doc) final public Expression typeCheck(StaticContext env, ItemType contextItemType)(Code)(Java Doc)
|
|
|