edu.neu.ccs
Class XBoolean

java.lang.Object
  extended byedu.neu.ccs.XObject
      extended byedu.neu.ccs.XBoolean
All Implemented Interfaces:
Cloneable, Serializable, Stringable

public class XBoolean
extends XObject

Object wrapper for the primitive boolean type that also provides Stringable capabilities. The default value for this class is false.

Since:
1.0
Version:
2.2
See Also:
Serialized Form

Field Summary
private  boolean value
          The wrapped value of this object.
 
Fields inherited from class edu.neu.ccs.XObject
changeAdapter, VALUE
 
Constructor Summary
XBoolean()
          Constructs a wrapper for the default boolean value.
XBoolean(boolean b)
          Constructs a wrapper for the given boolean value.
XBoolean(String s)
          Constructs a wrapper for the boolean value whose state information is encapsulated in the given String data.
 
Method Summary
 boolean equals(Object other)
          Returns true if the wrapped object is equal to the given object, and false if it is not.
 void fromStringData(String data)
          Sets the state of this object using information contained in the given String.
 boolean getValue()
          Returns the value wrapped by this object.
 int hashCode()
          Returns an int hash code appropriate for the wrapped object.
static boolean parseBoolean(String data)
          Parses a boolean value from a String using the current shared parser object.
 void setValue(boolean b)
          Sets the value wrapped by this object to the given value.
static boolean[] toPrimitiveArray(XBoolean[] x)
          Returns an array of primitive boolean values copied from the given array of XBoolean objects.
 String toString()
          Returns a String representation of the wrapped value.
 String toStringData()
          Returns a String encapsulation of this object that contains information needed to set the state of this object at a later time.
static XBoolean[] toXArray(boolean[] a)
          Returns an array of XBoolean objects initialized from the given array of boolean values.
 
Methods inherited from class edu.neu.ccs.XObject
addPropertyChangeListener, addPropertyChangeListener, formatErrorMessage, removePropertyChangeListener, removePropertyChangeListener, toStringArray
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

value

private boolean value
The wrapped value of this object.

Constructor Detail

XBoolean

public XBoolean()
Constructs a wrapper for the default boolean value.

See Also:
XBoolean(boolean), XBoolean(String)

XBoolean

public XBoolean(boolean b)
Constructs a wrapper for the given boolean value.

Parameters:
b - the value to be wrapped
See Also:
XBoolean(), XBoolean(String)

XBoolean

public XBoolean(String s)
         throws ParseException
Constructs a wrapper for the boolean value whose state information is encapsulated in the given String data.

Parameters:
s - a String representation of the desired value
Throws:
ParseException - if the data is malformed
See Also:
XBoolean(), XBoolean(boolean)
Method Detail

fromStringData

public void fromStringData(String data)
                    throws ParseException
Description copied from interface: Stringable
Sets the state of this object using information contained in the given String.

Specified by:
fromStringData in interface Stringable
Specified by:
fromStringData in class XObject
Throws:
ParseException

toStringData

public String toStringData()
Description copied from interface: Stringable
Returns a String encapsulation of this object that contains information needed to set the state of this object at a later time.

Specified by:
toStringData in interface Stringable
Specified by:
toStringData in class XObject

equals

public boolean equals(Object other)
Returns true if the wrapped object is equal to the given object, and false if it is not.

Parameters:
other - the object to be compared with the wrapped object

hashCode

public int hashCode()
Returns an int hash code appropriate for the wrapped object.


toString

public String toString()
Returns a String representation of the wrapped value.


setValue

public void setValue(boolean b)
Sets the value wrapped by this object to the given value.

Parameters:
b - the value to be wrapped
See Also:
getValue()

getValue

public boolean getValue()
Returns the value wrapped by this object.

See Also:
setValue(boolean)

parseBoolean

public static boolean parseBoolean(String data)
                            throws NumberFormatException
Parses a boolean value from a String using the current shared parser object.

Parameters:
data - the String data to parse
Returns:
the extracted boolean value
Throws:
NumberFormatException - if the data is malformed

toPrimitiveArray

public static boolean[] toPrimitiveArray(XBoolean[] x)
Returns an array of primitive boolean values copied from the given array of XBoolean objects.

Parameters:
x - an array of XBooleans
Returns:
the resulting array of boolean values
See Also:
toXArray(boolean[])

toXArray

public static XBoolean[] toXArray(boolean[] a)
Returns an array of XBoolean objects initialized from the given array of boolean values.

Parameters:
a - an array of booleans
Returns:
the resulting array of XBoolean objects
See Also:
toPrimitiveArray(XBoolean[])