net.sf.saxon.value

Class BooleanValue

public final class BooleanValue extends AtomicValue implements Comparable

A boolean XPath value
Field Summary
static BooleanValueFALSE
The boolean value FALSE
static BooleanValueTRUE
The boolean value TRUE
Method Summary
intcompareTo(Object other)
Compare the value to another boolean value
AtomicValueconvertPrimitive(BuiltInAtomicType requiredType, boolean validate, XPathContext context)
Convert to target data type
ObjectconvertToJava(Class target, XPathContext context)
Convert to Java object (for passing to external functions)
booleaneffectiveBooleanValue(XPathContext context)
Get the effective boolean value of this expression
booleanequals(Object other)
Determine whether two boolean values are equal
static AtomicValuefromString(CharSequence s)
Convert a string to a boolean value, using the XML Schema rules (including whitespace trimming)
static BooleanValueget(boolean value)
Factory method: get a BooleanValue
booleangetBooleanValue()
Get the value
ItemTypegetItemType(TypeHierarchy th)
Determine the data type of the expression
StringgetStringValue()
Convert to string
inthashCode()
Get a hash code for comparing two BooleanValues
StringtoString()
Diagnostic display of this value as a string

Field Detail

FALSE

public static final BooleanValue FALSE
The boolean value FALSE

TRUE

public static final BooleanValue TRUE
The boolean value TRUE

Method Detail

compareTo

public int compareTo(Object other)
Compare the value to another boolean value

Parameters: other The other boolean value

Returns: -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.

Throws: ClassCastException if the other value is not a BooleanValue (the parameter is declared as Object to satisfy the Comparable interface)

convertPrimitive

public AtomicValue convertPrimitive(BuiltInAtomicType requiredType, boolean validate, XPathContext context)
Convert to target data type

Parameters: requiredType an integer identifying the required atomic type context

Returns: an AtomicValue, a value of the required type

convertToJava

public Object convertToJava(Class target, XPathContext context)
Convert to Java object (for passing to external functions)

Parameters: target the Java class to which conversion is required

Returns: An object of the specified Java class

Throws: XPathException if conversion is not possible or fails

effectiveBooleanValue

public boolean effectiveBooleanValue(XPathContext context)
Get the effective boolean value of this expression

Parameters: context dynamic evaluation context, not used in this implementation

Returns: the boolean value

equals

public boolean equals(Object other)
Determine whether two boolean values are equal

Parameters: other the value to be compared to this value

Returns: true if the other value is a boolean value and is equal to this value

fromString

public static AtomicValue fromString(CharSequence s)
Convert a string to a boolean value, using the XML Schema rules (including whitespace trimming)

Parameters: s the input string

Returns: the relevant BooleanValue if validation succeeds; or an ErrorValue if not.

get

public static BooleanValue get(boolean value)
Factory method: get a BooleanValue

Parameters: value true or false, to determine which boolean value is required

Returns: the BooleanValue requested

getBooleanValue

public boolean getBooleanValue()
Get the value

Returns: true or false, the actual boolean value of this BooleanValue

getItemType

public ItemType getItemType(TypeHierarchy th)
Determine the data type of the expression

Parameters: th

Returns: Type.BOOLEAN,

getStringValue

public String getStringValue()
Convert to string

Returns: "true" or "false"

hashCode

public int hashCode()
Get a hash code for comparing two BooleanValues

Returns: the hash code

toString

public String toString()
Diagnostic display of this value as a string

Returns: a string representation of this value: "true()" or "false()"