edu.neu.ccs
Class XChar

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

public class XChar
extends XObject

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

Since:
1.0
Version:
2.2
See Also:
Serialized Form

Field Summary
private  char value
          The wrapped value of this object.
 
Fields inherited from class edu.neu.ccs.XObject
changeAdapter, VALUE
 
Constructor Summary
XChar()
          Constructs a wrapper for the default char value.
XChar(char c)
          Constructs a wrapper for the given char value.
XChar(String s)
          Constructs a wrapper for the char 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.
 char getValue()
          Returns the value wrapped by this object.
 int hashCode()
          Returns an int hash code appropriate for the wrapped object.
static char parseChar(String s)
          Parses a char value from a String using the current shared parser.
 void setValue(char c)
          Sets the value wrapped by this object to the given value.
static char[] toPrimitiveArray(XChar[] x)
          Returns an array of primitive char values copied from the given array of XChar 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 XChar[] toXArray(char[] a)
          Returns an array of XChar objects initialized from the given array of char 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 char value
The wrapped value of this object.

Constructor Detail

XChar

public XChar()
Constructs a wrapper for the default char value.

See Also:
XChar(char), XChar(String)

XChar

public XChar(char c)
Constructs a wrapper for the given char value.

Parameters:
c - the value to be wrapped
See Also:
XChar(), XChar(String)

XChar

public XChar(String s)
      throws ParseException
Constructs a wrapper for the char 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:
XChar(), XChar(char)
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(char c)
Sets the value wrapped by this object to the given value.

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

getValue

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

See Also:
setValue(char)

parseChar

public static char parseChar(String s)
                      throws NumberFormatException
Parses a char value from a String using the current shared parser.

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

toPrimitiveArray

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

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

toXArray

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

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