org.jboss.util
Class MuBoolean

java.lang.Object
  extended byorg.jboss.util.MuBoolean
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Comparable, Mutable (src) , java.io.Serializable

public class MuBoolean
extends java.lang.Object
implements java.lang.Comparable, java.lang.Cloneable, java.io.Serializable, Mutable (src)

A mutable boolean class.

See Also:
Serialized Form

Constructor Summary
MuBoolean()
          Construct a new mutable boolean.
MuBoolean(boolean b)
          Construct a new mutable boolean.
MuBoolean(java.lang.Object obj)
          Construct a new mutable boolean.
MuBoolean(java.lang.String value)
          Construct a new mutable boolean.
 
Method Summary
 boolean and(boolean b)
          ANDs the current value with the specified value.
 boolean booleanValue()
          Return the value of this mutable boolean.
 java.lang.Object clone()
          Clone this mutable boolean.
 boolean commit(boolean assumed, boolean b)
          Set the value to value only if the current value is equal to the assumed value.
 int compareTo(boolean bool)
          Compares this object with the specified boolean for order.
 int compareTo(java.lang.Object obj)
          Compares this object with the specified object for order.
 boolean complement()
          Set the value to its complement.
 boolean equals(java.lang.Object obj)
          Test the equality of another object.
 boolean get()
          Get the current value.
 java.lang.Object getValue()
          Get the boolean value of this mutable boolean.
 int hashCode()
          Return the hash code for this mutable boolean.
 boolean or(boolean b)
          ORs the current value with the specified value.
 boolean set(boolean b)
          Set the value.
 boolean set(java.lang.Boolean b)
          Set the value.
 boolean set(MuBoolean (src)  b)
          Set the value.
 void setValue(java.lang.Object obj)
          Set the value of this mutable boolean.
 boolean swap(MuBoolean (src)  b)
          Swap values with another mutable boolean.
 java.lang.String toString()
          Convert to a string.
 boolean xor(boolean b)
          XORs the current value with the specified value.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MuBoolean

public MuBoolean()
Construct a new mutable boolean.


MuBoolean

public MuBoolean(boolean b)
Construct a new mutable boolean.

Parameters:
b - Boolean value.

MuBoolean

public MuBoolean(java.lang.Object obj)
Construct a new mutable boolean.

Parameters:
obj - Object to convert to a boolean value.

MuBoolean

public MuBoolean(java.lang.String value)
Construct a new mutable boolean.

Parameters:
value - String to convert to a boolean value.
Method Detail

booleanValue

public boolean booleanValue()
Return the value of this mutable boolean.

Returns:
Boolean value.

set

public boolean set(boolean b)
Set the value.

Parameters:
b - Boolean value.
Returns:
The previous value.

set

public boolean set(java.lang.Boolean b)
Set the value.

Parameters:
b - Boolean value.
Returns:
The previous value.

set

public boolean set(MuBoolean (src)  b)
Set the value.

Parameters:
b - Boolean value.
Returns:
The previous value.

get

public boolean get()
Get the current value.

Returns:
The current value.

commit

public boolean commit(boolean assumed,
                      boolean b)
Set the value to value only if the current value is equal to the assumed value.

Parameters:
assumed - The assumed value.
b - The new value.
Returns:
True if value was changed.

swap

public boolean swap(MuBoolean (src)  b)
Swap values with another mutable boolean.

Parameters:
b - Mutable boolean to swap values with.
Returns:
The new value.

complement

public boolean complement()
Set the value to its complement.

Returns:
The new value.

and

public boolean and(boolean b)
ANDs the current value with the specified value.

Parameters:
b - Value to and with.
Returns:
The new value.

or

public boolean or(boolean b)
ORs the current value with the specified value.

Parameters:
b - Value to or with.
Returns:
The new value.

xor

public boolean xor(boolean b)
XORs the current value with the specified value.

Parameters:
b - Value to xor with.
Returns:
The new value.

compareTo

public int compareTo(boolean bool)
Compares this object with the specified boolean for order.

Parameters:
bool - Boolean to compare with.
Returns:
A negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

compareTo

public int compareTo(java.lang.Object obj)
              throws java.lang.ClassCastException
Compares this object with the specified object for order.

Specified by:
compareTo in interface java.lang.Comparable
Returns:
A negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
Throws:
java.lang.ClassCastException - Object is not a MuBoolean.

toString

public java.lang.String toString()
Convert to a string.

Returns:
String value

hashCode

public int hashCode()
Return the hash code for this mutable boolean.

Returns:
Hash code

equals

public boolean equals(java.lang.Object obj)
Test the equality of another object.

Parameters:
obj - Object to test equality with.
Returns:
True if object is equal to this.

clone

public java.lang.Object clone()
Clone this mutable boolean.

Returns:
Cloned mutable boolean.

setValue

public void setValue(java.lang.Object obj)
Set the value of this mutable boolean.

If value is a java.lang.Boolean, then use Boolean.booleanValue() to determin value, if the object is non-null then the value is true, else it is false.

Specified by:
setValue in interface Mutable (src)
Parameters:
obj - Object to convert to a boolean value.

getValue

public java.lang.Object getValue()
Get the boolean value of this mutable boolean.

Specified by:
getValue in interface Mutable (src)
Returns:
java.lang.Boolean value.