Package net.sf.saxon.value
Class NestedIntegerValue
- java.lang.Object
-
- net.sf.saxon.value.AtomicValue
-
- net.sf.saxon.value.NestedIntegerValue
-
- All Implemented Interfaces:
java.lang.Comparable
,java.lang.Iterable<AtomicValue>
,AtomicMatchKey
,AtomicSequence
,GroundedValue
,IdentityComparable
,Item
,Sequence
,ConversionResult
public class NestedIntegerValue extends AtomicValue implements java.lang.Comparable, AtomicMatchKey
This class represents a dot-separated sequence of numbers such as 1.12.5, typically used as a software version number.Although the class is implemented as an atomic type derived from xs:string, it has not been integrated into the schema type hierarchy and cannot be used directly in schema validation.
The class provides "smart" ordering, for example 1 < 1.2 < 1.12 < 1.12.6
-
-
Field Summary
Fields Modifier and Type Field Description static NestedIntegerValue
ONE
static NestedIntegerValue
TWO
-
Fields inherited from class net.sf.saxon.value.AtomicValue
typeLabel
-
Fields inherited from interface net.sf.saxon.expr.sort.AtomicMatchKey
NaN_MATCH_KEY
-
-
Constructor Summary
Constructors Constructor Description NestedIntegerValue(int[] val)
NestedIntegerValue(java.lang.String v)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description NestedIntegerValue
append(int leaf)
int
compareTo(java.lang.Object other)
AtomicValue
copyAsSubType(AtomicType typeLabel)
Create a copy of this atomic value, with a different type labelboolean
equals(java.lang.Object o)
The equals() methods on atomic values is defined to follow the semantics of eq when applied to two atomic values.int
getDepth()
int
getLeaf()
protected java.lang.CharSequence
getPrimitiveStringValue()
Convert the value to a string, using the serialization rules for the primitive type.BuiltInAtomicType
getPrimitiveType()
Determine the primitive type of the value.java.lang.Comparable
getSchemaComparable()
Get a Comparable value that implements the XML Schema ordering comparison semantics for this value.NestedIntegerValue
getStem()
AtomicMatchKey
getXPathComparable(boolean ordered, StringCollator collator, int implicitTimezone)
Get an object value that implements the XPath equality and ordering comparison semantics for this value.static NestedIntegerValue
parse(java.lang.String v)
-
Methods inherited from class net.sf.saxon.value.AtomicValue
asAtomic, asMapKey, atomize, checkPermittedContents, checkValidInJavascript, effectiveBooleanValue, getCanonicalLexicalRepresentation, getCardinality, getComponent, getGenre, getItemType, getLength, getStringValue, getStringValueCS, getUType, head, identityHashCode, isIdentical, isIdentical, isNaN, itemAt, iterate, iterator, setTypeLabel, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.sf.saxon.expr.sort.AtomicMatchKey
asAtomic
-
Methods inherited from interface net.sf.saxon.om.GroundedValue
asIterable, concatenate, containsNode, materialize
-
Methods inherited from interface net.sf.saxon.om.Item
isStreamed, reduce, subsequence, toShortString
-
Methods inherited from interface net.sf.saxon.om.Sequence
makeRepeatable
-
-
-
-
Field Detail
-
ONE
public static NestedIntegerValue ONE
-
TWO
public static NestedIntegerValue TWO
-
-
Constructor Detail
-
NestedIntegerValue
public NestedIntegerValue(java.lang.String v) throws XPathException
- Throws:
XPathException
-
NestedIntegerValue
public NestedIntegerValue(int[] val)
-
-
Method Detail
-
parse
public static NestedIntegerValue parse(java.lang.String v) throws XPathException
- Throws:
XPathException
-
append
public NestedIntegerValue append(int leaf)
-
getStem
public NestedIntegerValue getStem()
-
getDepth
public int getDepth()
-
getLeaf
public int getLeaf()
-
getSchemaComparable
public java.lang.Comparable getSchemaComparable()
Description copied from class:AtomicValue
Get a Comparable value that implements the XML Schema ordering comparison semantics for this value. An implementation must be provided for all atomic types.In the case of data types that are partially ordered, the returned Comparable extends the standard semantics of the compareTo() method by returning the value
SequenceTool.INDETERMINATE_ORDERING
when there is no defined order relationship between two given values. This value is also returned when two values of different types are compared.- Specified by:
getSchemaComparable
in interfaceAtomicSequence
- Specified by:
getSchemaComparable
in classAtomicValue
- Returns:
- a Comparable that follows XML Schema comparison rules
-
getXPathComparable
public AtomicMatchKey getXPathComparable(boolean ordered, StringCollator collator, int implicitTimezone)
Description copied from class:AtomicValue
Get an object value that implements the XPath equality and ordering comparison semantics for this value. If the ordered parameter is set to true, the result will be a Comparable and will support a compareTo() method with the semantics of the XPath lt/gt operator, provided that the other operand is also obtained using the getXPathComparable() method. In all cases the result will support equals() and hashCode() methods that support the semantics of the XPath eq operator, again provided that the other operand is also obtained using the getXPathComparable() method. A collation is supplied for comparing strings, and an implicit timezone for comparing date/time values that have no saved timezone.- Specified by:
getXPathComparable
in classAtomicValue
- Parameters:
ordered
- true if an ordered comparison is required. In this case the result is null if the type is unordered; in other cases the returned value will be a Comparable.collator
- the collation to be used when comparing stringsimplicitTimezone
- the implicit timezone in the dynamic context, used when comparing dates/times with and without timezone- Returns:
- an Object whose equals() and hashCode() methods implement the XPath comparison semantics with respect to this atomic value. If ordered is specified, the result will either be null if no ordering is defined, or will be a Comparable
-
equals
public boolean equals(java.lang.Object o)
Description copied from class:AtomicValue
The equals() methods on atomic values is defined to follow the semantics of eq when applied to two atomic values. When the other operand is not an atomic value, the result is undefined (may be false, may be an exception). When the other operand is an atomic value that cannot be compared with this one, the method must throw a ClassCastException.The hashCode() method is consistent with equals().
- Specified by:
equals
in classAtomicValue
- Parameters:
o
- the other value- Returns:
- true if the other operand is an atomic value and the two values are equal as defined by the XPath eq operator
-
getPrimitiveType
public BuiltInAtomicType getPrimitiveType()
Description copied from class:AtomicValue
Determine the primitive type of the value. This delivers the same answer as getItemType().getPrimitiveItemType(). The primitive types are the 19 primitive types of XML Schema, plus xs:integer, xs:dayTimeDuration and xs:yearMonthDuration, and xs:untypedAtomic. For external objects, the result is xs:anyAtomicType.- Specified by:
getPrimitiveType
in classAtomicValue
- Returns:
- the primitive type
-
copyAsSubType
public AtomicValue copyAsSubType(AtomicType typeLabel)
Description copied from class:AtomicValue
Create a copy of this atomic value, with a different type label- Specified by:
copyAsSubType
in classAtomicValue
- Parameters:
typeLabel
- the type label of the new copy. The caller is responsible for checking that the value actually conforms to this type.- Returns:
- the copied value
-
getPrimitiveStringValue
protected java.lang.CharSequence getPrimitiveStringValue()
Description copied from class:AtomicValue
Convert the value to a string, using the serialization rules for the primitive type. This is the result of conversion to a string except that postprocessing defined by the saxon:preprocess facet is not (yet) applied.- Specified by:
getPrimitiveStringValue
in classAtomicValue
- Returns:
- the value converted to a string according to the rules for the primitive type
-
compareTo
public int compareTo(java.lang.Object other)
- Specified by:
compareTo
in interfacejava.lang.Comparable
-
-