Class 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

    • Constructor Detail

      • NestedIntegerValue

        public NestedIntegerValue​(int[] val)
    • Method Detail

      • 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 interface AtomicSequence
        Specified by:
        getSchemaComparable in class AtomicValue
        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 class AtomicValue
        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 strings
        implicitTimezone - 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 class AtomicValue
        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 class AtomicValue
        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 class AtomicValue
        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 class AtomicValue
        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 interface java.lang.Comparable