Boolean

The Boolean class wraps a value of the primitive type {@code bool} in an object. An object of type {@code Boolean} contains a single field whose type is {@code bool}. <p> In addition, this class provides many methods for converting a {@code bool} to a {@code string} and a {@code string} to a {@code bool}, as well as other constants and methods useful when dealing with a {@code bool}.

@author Arthur van Hoff

Constructors

this
this()
Undocumented in source.
this
this(bool v)
Undocumented in source.
this
this(long v)
Undocumented in source.
this
this(ulong v)
Undocumented in source.
this
this(Boolean v)
Undocumented in source.
this
this(string s)

Allocates a {@code Boolean} object representing the value {@code true} if the string argument is not {@code null} and is equal, ignoring case, to the string {@code "true"}. Otherwise, allocate a {@code Boolean} object representing the value {@code false}. Examples:<p> {@code new Boolean("True")} produces a {@code Boolean} object that represents {@code true}.<br> {@code new Boolean("yes")} produces a {@code Boolean} object that represents {@code false}.

Members

Functions

booleanValue
bool booleanValue()

Returns the value of this {@code Boolean} object as a bool primitive.

compareTo
int compareTo(Boolean b)

Compares this {@code Boolean} instance with another.

toHash
size_t toHash()

Returns a hash code for this {@code Boolean} object.

toString
string toString()

Returns a {@code string} object representing this Boolean's value. If this object represents the value {@code true}, a string equal to {@code "true"} is returned. Otherwise, a string equal to {@code "false"} is returned.

Static functions

FALSE
Boolean FALSE()

The {@code Boolean} object corresponding to the primitive value {@code false}.

TRUE
Boolean TRUE()

The {@code Boolean} object corresponding to the primitive value {@code true}.

compare
int compare(bool x, bool y)

Compares two {@code bool} values. The value returned is identical to what would be returned by: <pre> Boolean.valueOf(x).compareTo(Boolean.valueOf(y)) </pre>

logicalAnd
bool logicalAnd(bool a, bool b)

Returns the result of applying the logical AND operator to the specified {@code bool} operands.

logicalOr
bool logicalOr(bool a, bool b)

Returns the result of applying the logical OR operator to the specified {@code bool} operands.

logicalXor
bool logicalXor(bool a, bool b)

Returns the result of applying the logical XOR operator to the specified {@code bool} operands.

parseBoolean
bool parseBoolean(string s)

Parses the string argument as a bool. The {@code bool} returned represents the value {@code true} if the string argument is not {@code null} and is equal, ignoring case, to the string {@code "true"}. <p>

toString
string toString(bool b)

Returns a {@code string} object representing the specified bool. If the specified bool is {@code true}, then the string {@code "true"} will be returned, otherwise the string {@code "false"} will be returned.

valueOf
Boolean valueOf(bool b)

Returns a {@code Boolean} instance representing the specified {@code bool} value. If the specified {@code bool} value is {@code true}, this method returns {@code Boolean.TRUE}; if it is {@code false}, this method returns {@code Boolean.FALSE}. If a new {@code Boolean} instance is not required, this method should generally be used in preference to the constructor {@link #Boolean(bool)}, as this method is likely to yield significantly better space and time performance.

valueOf
Boolean valueOf(string s)

Returns a {@code Boolean} with a value represented by the specified string. The {@code Boolean} returned represents a true value if the string argument is not {@code null} and is equal, ignoring case, to the string {@code "true"}.

Meta