edu.neu.ccs
Class XString

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

public class XString
extends XObject

Object wrapper for the String class that also provides Stringable capabilities. The default value for this class is the String representation of epsilon, "".

Since:
1.0
Version:
2.2
See Also:
Serialized Form

Field Summary
private  String value
          The wrapped value of this object.
 
Fields inherited from class edu.neu.ccs.XObject
changeAdapter, VALUE
 
Constructor Summary
XString()
          Constructs a wrapper for the default String value;
XString(String s)
          Constructs a wrapper for the given String value.
 
Method Summary
 boolean equals(Object other)
          Returns true if the wrapped String is equal to the given object, and false if it is not.
 void fromStringData(String s)
          Sets the state of this object using information contained in the given String.
 String getValue()
          Returns the wrapped value of this object.
 int hashCode()
          Returns an int hash code appropriate for the wrapped object.
 void setValue(String s)
          Sets the value wrapped by this object to the given value.
 String toString()
          Returns the wrapped String.
 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 XString[] toXArray(String[] a)
          Returns an array of XString objects initialized from the given array of String objects.
 
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 String value
The wrapped value of this object.

Constructor Detail

XString

public XString()
Constructs a wrapper for the default String value;

See Also:
XString(String)

XString

public XString(String s)
Constructs a wrapper for the given String value.

Parameters:
s - the desired String
See Also:
XString()
Method Detail

fromStringData

public void fromStringData(String s)
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

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 String is equal to the given object, and false if it is not.

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

hashCode

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


toString

public String toString()
Returns the wrapped String.


setValue

public void setValue(String s)
Sets the value wrapped by this object to the given value. If null, the value is set to the empty string, "".

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

getValue

public String getValue()
Returns the wrapped value of this object.

See Also:
setValue(String)

toXArray

public static XString[] toXArray(String[] a)
Returns an array of XString objects initialized from the given array of String objects.

Parameters:
a - an array of Strings
Returns:
the resulting array of XString objects