edu.neu.ccs
Class HexXLong

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

public class HexXLong
extends XLong

Class HexXLong extends XLong by replacing the three methods: fromStringData, toStringData, and toString, to use hexadecimal digits rather than decimal digits.

Since:
2.3
Version:
2.3
See Also:
Serialized Form

Field Summary
 
Fields inherited from class edu.neu.ccs.XLong
 
Fields inherited from class edu.neu.ccs.XObject
changeAdapter, VALUE
 
Constructor Summary
HexXLong()
          Constructs a wrapper for the default long value.
HexXLong(long x)
          Constructs a wrapper for the given long value.
HexXLong(String s)
          Constructs a wrapper for the long value whose state information is encapsulated in the given hexadecimal String data of length at most 16.
 
Method Summary
 void fromStringData(String s)
          Sets the state of this object using information contained in the given hexadecimal String of length at most 16.
 String toString()
          Returns "0" if the value of this object is zero; otherwise returns the same String as toStringData with the leading zeroes removed.
 String toStringData()
          Returns a hexadecimal String encapsulation of this object that contains the information needed to set the state of this object at a later time.
 
Methods inherited from class edu.neu.ccs.XLong
byteValue, doubleValue, equals, floatValue, getValue, hashCode, intValue, longValue, parseLong, setValue, shortValue, toPrimitiveArray, toXArray
 
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
 

Constructor Detail

HexXLong

public HexXLong()
Constructs a wrapper for the default long value.

See Also:
HexXLong(long), HexXLong(String)

HexXLong

public HexXLong(long x)
Constructs a wrapper for the given long value.

Parameters:
x - the value to be wrapped
See Also:
HexXLong(), HexXLong(String)

HexXLong

public HexXLong(String s)
         throws ParseException
Constructs a wrapper for the long value whose state information is encapsulated in the given hexadecimal String data of length at most 16.

Parameters:
s - a hexadecimal String representation of the desired value
Throws:
ParseException - if s is not hexadecimal with at most 16 digits
See Also:
HexXLong(), HexXLong(long), fromStringData(String)
Method Detail

fromStringData

public void fromStringData(String s)
                    throws ParseException

Sets the state of this object using information contained in the given hexadecimal String of length at most 16.

Uses Hex.hexToLong internally.

Specified by:
fromStringData in interface Stringable
Overrides:
fromStringData in class XLong
Parameters:
s - a hexadecimal String representation of the desired value
Throws:
ParseException - if s is not hexadecimal with at most 16 digits
See Also:
Hex.hexToLong(String)

toStringData

public String toStringData()

Returns a hexadecimal String encapsulation of this object that contains the information needed to set the state of this object at a later time.

Uses Hex.longToHex internally.

Specified by:
toStringData in interface Stringable
Overrides:
toStringData in class XLong
Returns:
a hexadecimal String encapsulation of this object
See Also:
Hex.longToHex(long)

toString

public String toString()

Returns "0" if the value of this object is zero; otherwise returns the same String as toStringData with the leading zeroes removed.

Overrides:
toString in class XLong
Returns:
a brief hexadecimal String encapsulation of this object
See Also:
toStringData()