org.web3d.vrtp.datatypes
Class PrimitiveNumber

java.lang.Object
  |
  +--org.web3d.vrtp.datatypes.PrimitiveNumber
All Implemented Interfaces:
ArithmeticIF, java.lang.Cloneable, java.lang.Comparable, Primitive, java.io.Serializable
Direct Known Subclasses:
DoublePrecision, LongInteger, SignedInteger, UnsignedByte, UnsignedShort

public abstract class PrimitiveNumber
extends java.lang.Object
implements Primitive, java.lang.Cloneable, java.lang.Comparable, java.io.Serializable, ArithmeticIF

PrimitiveNumber

Grumble. Java's object counterparts to the primitive types (Integer, Char, Float, etc) are lousy in that you can't really change values once you create them. This is a parallel object hierarchy that does a few more things, and conforms to the Primitive interface, which specifies the minimum operations required for compliance with dabp. This hierarchy is also mutable, while Java's default hierarchy is immutable. Primitive types that are numeric, such as UnsignedByte, SignedInteger, etc, should inherit from this. Other primitive types, such as strings, should inherit from something else.

This would be a great place to do categories if this were objective-c. Dangit.

Author:
Don McGregor
See Also:
Serialized Form

Constructor Summary
PrimitiveNumber()
           
 
Method Summary
abstract  void add(int pValue)
          Add the given value to the existing value
 byte byteValue()
          Returns the value of the specified number as a byte.
abstract  java.lang.Object clone()
          Implementation of the Cloneable interface.
abstract  void decrement()
          Subtract one from the value
abstract  double doubleValue()
          Returns the value of the specified number as a double.
abstract  boolean equals(java.lang.Object anObject)
          implementation of Comparable interface
abstract  float floatValue()
          Returns the value of the specified number as a float.
abstract  void increment()
          Add one to the value
abstract  int intValue()
          Returns the value of the specified number as an int.
abstract  long longValue()
          Returns the value of the specified number as a long.
 short shortValue()
          Returns the value of the specified number as a short.
abstract  void subtract(int pValue)
          Subtract the given value from the existing value
 
Methods inherited from class java.lang.Object
, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.web3d.vrtp.datatypes.Primitive
compareTo, getSize, hashCode, initializeWithBinary, initializeWithString, serialize, toString
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Constructor Detail

PrimitiveNumber

public PrimitiveNumber()
Method Detail

equals

public abstract boolean equals(java.lang.Object anObject)
implementation of Comparable interface
Specified by:
equals in interface Primitive
Overrides:
equals in class java.lang.Object

clone

public abstract java.lang.Object clone()
Implementation of the Cloneable interface. Returns a copy of the object, generally speaking a "deep copy" that in no way shares internal data with the original object. This is public rather than protected in the Object base class
Specified by:
clone in interface Primitive
Overrides:
clone in class java.lang.Object

intValue

public abstract int intValue()
Returns the value of the specified number as an int. This may involve rounding.
Returns:
the numeric value represented by this object after conversion to type int.

longValue

public abstract long longValue()
Returns the value of the specified number as a long. This may involve rounding.
Returns:
the numeric value represented by this object after conversion to type long.

floatValue

public abstract float floatValue()
Returns the value of the specified number as a float. This may involve rounding.
Returns:
the numeric value represented by this object after conversion to type float.

doubleValue

public abstract double doubleValue()
Returns the value of the specified number as a double. This may involve rounding.
Returns:
the numeric value represented by this object after conversion to type double.

byteValue

public byte byteValue()
Returns the value of the specified number as a byte. This may involve rounding or truncation.
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.
Returns:
the numeric value represented by this object after conversion to type short.
Since:
JDK1.1

increment

public abstract void increment()
Description copied from interface: ArithmeticIF
Add one to the value
Specified by:
increment in interface ArithmeticIF

decrement

public abstract void decrement()
Description copied from interface: ArithmeticIF
Subtract one from the value
Specified by:
decrement in interface ArithmeticIF

add

public abstract void add(int pValue)
Description copied from interface: ArithmeticIF
Add the given value to the existing value
Specified by:
add in interface ArithmeticIF

subtract

public abstract void subtract(int pValue)
Description copied from interface: ArithmeticIF
Subtract the given value from the existing value
Specified by:
subtract in interface ArithmeticIF