org.web3d.vrtp.datatypes
Class UnsignedByte

java.lang.Object
  |
  +--org.web3d.vrtp.datatypes.PrimitiveNumber
        |
        +--org.web3d.vrtp.datatypes.UnsignedByte
All Implemented Interfaces:
ArithmeticIF, java.lang.Cloneable, java.lang.Comparable, Primitive, java.io.Serializable

public class UnsignedByte
extends PrimitiveNumber

UnsignedByte

See Also:
Serialized Form

Field Summary
static int BYTE_SIZE
           
(package private) static short MAX_UNSIGNED_BYTE_VALUE
           
 
Constructor Summary
UnsignedByte()
          Contructs a new UnsignedByte object and intializes its value to 0.
UnsignedByte(byte pData)
          Constructs an UnsignedByte object from a signed byte, throws an exception if the paraneter is out of range.
UnsignedByte(int pData)
          Constructs an UnsignedByte object from a int, throws an exception if the parameter is out of range.
UnsignedByte(short pData)
          Constructs an UnsignedByte object from a short, throws an exception if the parameter is out of range.
UnsignedByte(java.lang.String pData)
           
 
Method Summary
 void add(int pValue)
          Add the given amount to the data
 byte byteValue()
          Returns the value of the specified number as a byte.
 java.lang.Object clone()
          Return clone of this object, no shared data
 int compareTo(java.lang.Object obj)
          Implementation of the Comparable interface.
 void decrement()
          subtract one from the value
 double doubleValue()
          Returns the current value of this object as a double float, after conversion.
 boolean equals(java.lang.Object obj)
          Compare for equality.
 float floatValue()
          Returns a the current value of this object as a float, after conversion.
 int getSize()
          Number of bytes this takes up when serialized in binary format.
 int hashCode()
          Return hashcode.
 void increment()
          add one to the value
 void initializeWithBinary(byte[] pBinaryData, int offset)
          Initialize an already-existing object with binary data.
 void initializeWithString(java.lang.String pStringData)
          Initialize the object with the string data given.
 int intValue()
          Returns the current value of this object as an int, after conversion.
 long longValue()
          Returns the current value of this object as a long, after conversion.
 void serialize(java.io.DataOutputStream pOutputStream)
          This is parallel to Java's serialization scheme.
 short shortValue()
          Returns the value of the specified number as a short.
 void subtract(int pValue)
          subtract the given amount from the value
 java.lang.String toString()
          Returns a String object representing this UnsignedByte value.
 
Methods inherited from class java.lang.Object
, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

MAX_UNSIGNED_BYTE_VALUE

static final short MAX_UNSIGNED_BYTE_VALUE

BYTE_SIZE

public static final int BYTE_SIZE
Constructor Detail

UnsignedByte

public UnsignedByte(java.lang.String pData)

UnsignedByte

public UnsignedByte()
Contructs a new UnsignedByte object and intializes its value to 0.

UnsignedByte

public UnsignedByte(byte pData)
Constructs an UnsignedByte object from a signed byte, throws an exception if the paraneter is out of range.
Parameters:
pData - >=0
Throws:
java.lang.RuntimeException - if pData is out of range

UnsignedByte

public UnsignedByte(short pData)
Constructs an UnsignedByte object from a short, throws an exception if the parameter is out of range.
Parameters:
pData - >=0, <=MAX_UNSIGNED_BYTE_VALUE
Throws:
java.lang.RuntimeException - if the parameter is out of range

UnsignedByte

public UnsignedByte(int pData)
Constructs an UnsignedByte object from a int, throws an exception if the parameter is out of range.
Parameters:
pData - >=0, <=MAX_UNSIGNED_BYTE_VALUE
Throws:
java.lang.RuntimeException - if the parameter is out of range
Method Detail

initializeWithBinary

public void initializeWithBinary(byte[] pBinaryData,
                                 int offset)
Initialize an already-existing object with binary data. the object must recoginize the binary data starting at the given offset.

initializeWithString

public void initializeWithString(java.lang.String pStringData)
Initialize the object with the string data given.

hashCode

public int hashCode()
Return hashcode. In this case, just the value itself.
Overrides:
hashCode in class java.lang.Object

getSize

public int getSize()
Description copied from interface: Primitive
Number of bytes this takes up when serialized in binary format. this is computing using our own internal scheme for serialization; other schemes, such as the java or corba serialization, might be different.

byteValue

public byte byteValue()
Returns the value of the specified number as a byte. This may involve rounding or truncation.
Overrides:
byteValue in class PrimitiveNumber
Returns:
the numeric value represented by this object after conversion to type byte.
Since:
JDK1.1

shortValue

public short shortValue()
Returns the value of the specified number as a short. This may involve rounding or truncation.
Overrides:
shortValue in class PrimitiveNumber
Returns:
the numeric value represented by this object after conversion to type short.
Since:
JDK1.1

doubleValue

public double doubleValue()
Returns the current value of this object as a double float, after conversion.
Overrides:
doubleValue in class PrimitiveNumber
Returns:
the current value of this object as a double float

floatValue

public float floatValue()
Returns a the current value of this object as a float, after conversion.
Overrides:
floatValue in class PrimitiveNumber
Returns:
the current value of this object as a float

intValue

public int intValue()
Returns the current value of this object as an int, after conversion.
Overrides:
intValue in class PrimitiveNumber
Returns:
the current value of this object as an int

longValue

public long longValue()
Returns the current value of this object as a long, after conversion.
Overrides:
longValue in class PrimitiveNumber
Returns:
the current value of this object as a long

toString

public java.lang.String toString()
Returns a String object representing this UnsignedByte value.
Overrides:
toString in class java.lang.Object
Returns:
a string representation of the value of this object in base 10.

serialize

public void serialize(java.io.DataOutputStream pOutputStream)
This is parallel to Java's serialization scheme. It gives us (slightly) more control over the export binary format.

clone

public java.lang.Object clone()
Return clone of this object, no shared data
Overrides:
clone in class PrimitiveNumber

compareTo

public int compareTo(java.lang.Object obj)
Implementation of the Comparable interface. This is used by standard Java utilties classes to do things like sort arrays and the like. So as long as you implement this, you get sorting for "free".

equals

public boolean equals(java.lang.Object obj)
Compare for equality. Object being compared must be of type UnsignedByte for the equality to be true, so comparing an UnsignedByte value of 7 to an UnsignedShort value of 7 will return false.
Overrides:
equals in class PrimitiveNumber

increment

public void increment()
add one to the value
Overrides:
increment in class PrimitiveNumber

decrement

public void decrement()
subtract one from the value
Overrides:
decrement in class PrimitiveNumber

add

public void add(int pValue)
Add the given amount to the data
Overrides:
add in class PrimitiveNumber

subtract

public void subtract(int pValue)
subtract the given amount from the value
Overrides:
subtract in class PrimitiveNumber