net.sf.saxon.value
Class BooleanValue
- Comparable, ConversionResult, GroundedValue, Item, PullEvent, Serializable, SequenceIterable, ValueRepresentation
public final class BooleanValue
implements Comparable
A boolean XPath value
asAtomic , checkPermittedContents , convert , convert , convertPrimitive , copyAsSubType , effectiveBooleanValue , equals , getCardinality , getComponent , getItemType , getLength , getPrimitiveType , getSchemaComparable , getStringValue , getStringValueCS , getTypeLabel , getTypedValue , getXPathComparable , isNaN , itemAt , iterate , process , setTypeLabel , subsequence , toString |
asItem , asItem , asIterator , asValue , checkPermittedContents , convertJavaObjectToXPath , convertToJava , convertToJava , effectiveBooleanValue , equals , fromItem , getCanonicalLexicalRepresentation , getCardinality , getItemType , getIterator , getLength , getSchemaComparable , getStringValue , getStringValueCS , itemAt , iterate , iterate , makeQNameValue , process , reduce , stringToNumber , toString |
FALSE
public static final BooleanValue FALSE
The boolean value FALSE
TRUE
public static final BooleanValue TRUE
The boolean value TRUE
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 valuetypeLabel
- the type label, xs:boolean or a subtype
compareTo
public int compareTo(Object other)
Compare the value to another boolean value
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.
convertToJava
public Object convertToJava(Class target,
XPathContext context)
throws XPathException
Convert to Java object (for passing to external functions)
- convertToJava in interface Value
target
- the Java class to which conversion is required
- An object of the specified Java class
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.
- copyAsSubType in interface AtomicValue
typeLabel
- the atomic type label to be added to the copied value
equals
public boolean equals(Object other)
Determine whether two boolean values are equal
- equals in interface 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
fromString
public static ConversionResult fromString(CharSequence s)
Convert a string to a boolean value, using the XML Schema rules (including
whitespace trimming)
- the relevant BooleanValue if validation succeeds; or a ValidationFailure if not.
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
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.
- getPrimitiveType in interface AtomicValue
getSchemaComparable
public 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
Value.INDETERMINATE_ORDERING
when there
is no defined order relationship between two given values.
- getSchemaComparable in interface AtomicValue
- a Comparable that follows XML Schema comparison rules
getXPathComparable
public Object getXPathComparable(boolean ordered,
StringCollator collator,
XPathContext context)
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.
- getXPathComparable in interface AtomicValue
ordered
- collator
- context
-
hashCode
public int hashCode()
Get a hash code for comparing two BooleanValues
toString
public String toString()
Diagnostic display of this value as a string
- toString in interface AtomicValue
- a string representation of this value: "true()" or "false()"