Class BooleanValue

    • Field Detail

      • TRUE

        public static final BooleanValue TRUE
        The boolean value TRUE
      • FALSE

        public static final BooleanValue FALSE
        The boolean value FALSE
    • Constructor Detail

      • BooleanValue

        public BooleanValue​(boolean value,
                            AtomicType typeLabel)
        Create a new Boolean value with a user-supplied type label. It is the caller's responsibility to ensure that the value is valid for the subtype
        value - the boolean value
        typeLabel - the type label, xs:boolean or a subtype
    • Method Detail

      • get

        public static BooleanValue get​(boolean value)
        Factory method: get a BooleanValue
        value - true or false, to determine which boolean value is required
        the BooleanValue requested
      • copyAsSubType

        public AtomicValue copyAsSubType​(AtomicType typeLabel)
        Create a copy of this atomic value (usually so that the type label can be changed). The type label of the copy will be reset to the primitive type.
        Specified by:
        copyAsSubType in class AtomicValue
        typeLabel - the atomic type label to be added to the copied value
        the copied value
      • fromString

        public static ConversionResult fromString​(java.lang.CharSequence s)
        Convert a string to a boolean value, using the XML Schema rules (including whitespace trimming)
        s - the input string
        the relevant BooleanValue if validation succeeds; or a ValidationFailure if not.
      • getBooleanValue

        public boolean getBooleanValue()
        Get the value
        true or false, the actual boolean value of this BooleanValue
      • getPrimitiveType

        public BuiltInAtomicType getPrimitiveType()
        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 AnyAtomicType.
        Specified by:
        getPrimitiveType in class AtomicValue
        the primitive type
      • getPrimitiveStringValue

        public java.lang.String getPrimitiveStringValue()
        Convert to string
        Specified by:
        getPrimitiveStringValue in class AtomicValue
        "true" or "false"
      • getSchemaComparable

        public java.lang.Comparable getSchemaComparable()
        Get a Comparable value that implements the XML Schema ordering comparison semantics for this value. The default implementation returns "this". This is overridden for particular 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.

        Specified by:
        getSchemaComparable in interface AtomicSequence
        Specified by:
        getSchemaComparable in class AtomicValue
        a Comparable that follows XML Schema comparison rules
      • getXPathComparable

        public AtomicMatchKey getXPathComparable​(boolean ordered,
                                                 StringCollator collator,
                                                 int implicitTimezone)
        Get a Comparable value that implements the XPath ordering comparison semantics for this value. Returns null if the value is not comparable according to XPath rules. The default implementation returns null. This is overridden for types that allow ordered comparisons in XPath: numeric, boolean, string, date, time, dateTime, yearMonthDuration, dayTimeDuration, and anyURI.
        Specified by:
        getXPathComparable in class AtomicValue
        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 XPath dynamic evaluation context, used in cases where the comparison is context sensitive
        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
      • compareTo

        public int compareTo​(java.lang.Object other)
        Compare the value to another boolean value
        Specified by:
        compareTo in interface java.lang.Comparable
        other - The other boolean value
        -1 if this one is the lower, 0 if they are equal, +1 if this one is the higher. False is considered to be less than true.
        java.lang.ClassCastException - if the other value is not a BooleanValue (the parameter is declared as Object to satisfy the Comparable interface)
      • equals

        public boolean equals​(java.lang.Object other)
        Determine whether two boolean values are equal
        Specified by:
        equals in class AtomicValue
        other - the value to be compared to this value
        true if the other value is a boolean value and is equal to this value
        java.lang.ClassCastException - if other value is not xs:boolean or derived therefrom
      • hashCode

        public int hashCode()
        Get a hash code for comparing two BooleanValues
        hashCode in class java.lang.Object
        the hash code
      • toString

        public java.lang.String toString()
        Diagnostic display of this value as a string
        toString in class AtomicValue
        a string representation of this value: "true()" or "false()"