moka.lang
Class UByte

java.lang.Object
  extended bymoka.lang.Object
      extended bymoka.lang.UByte

public class UByte
extends Object

The UByte class wraps a value of the primitive type ubyte in an object. An object of type UByte contains a single field whose type is ubyte.

In addition, this class provides several methods for converting an ubyte to a String and a String to an ubyte, as well as other constants and methods useful when dealing with an ubyte.

Since:
MDK2.2

Field Summary
static byte MAX_VALUE
          The largest value of type byte.
static byte MIN_VALUE
          The smallest value of type byte.
 
Constructor Summary
UByte(ubyte value)
          Constructs a newly allocated UByte object that represents the primitive ubyte argument.
 
Method Summary
 byte byteValue()
          Returns the value of this UByte as an byte.
 double doubleValue()
          Returns the value of this UByte as a double.
 boolean equals(Object obj)
          Compares this object to the specified object.
 int intValue()
          Returns the value of this UByte as an int.
static boolean isUbyte(String str)
          Checks if the specified string is a decimal representation of a ubyte.
 long longValue()
          Returns the value of this UByte as a long.
static ubyte parseUbyte(String s)
          Parses the string argument as a decimal integer.
 short shortValue()
          Returns the value of this UByte as a short.
 String toString()
          Returns a String object representing this UByte's value.
 ubyte ubyteValue()
          Returns the value of this UByte as an byte.
 
Methods inherited from class moka.lang.Object
finalize, getClassName
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MIN_VALUE

public static final byte MIN_VALUE
The smallest value of type byte. The constant value of this field is 0.

See Also:
Constant Field Values

MAX_VALUE

public static final byte MAX_VALUE
The largest value of type byte. The constant value of this field is 256.

Constructor Detail

UByte

public UByte(ubyte value)
Constructs a newly allocated UByte object that represents the primitive ubyte argument.

Parameters:
value - the value to be represented by the Byte.
Method Detail

toString

public String toString()
Returns a String object representing this UByte's value. The value is converted to signed decimal representation and returned as a string.

Overrides:
toString in class Object
Returns:
a string representation of the value of this object.

equals

public boolean equals(Object obj)
Compares this object to the specified object. The result is true if and only if the argument is not null and is an UByte object that contains the same ubyte value as this object.

Overrides:
equals in class Object
Parameters:
obj - the object to compare with.
Returns:
true if the objects are the same; false otherwise.

ubyteValue

public ubyte ubyteValue()
Returns the value of this UByte as an byte.


byteValue

public byte byteValue()
Returns the value of this UByte as an byte.


parseUbyte

public static ubyte parseUbyte(String s)
Parses the string argument as a decimal integer. The characters in the string must all be decimal digits. The resulting ubyte value is returned. The string argument is finalized before the method returns.

Parameters:
s - a String containing the ubyte representation to be parsed
Returns:
the byte value represented by the argument in decimal.

intValue

public int intValue()
Returns the value of this UByte as an int. This may involve rounding or truncation.

Returns:
the numeric value represented by this object after conversion to type int.

longValue

public long longValue()
Returns the value of this UByte as a long. This may involve rounding or truncation.

Returns:
the numeric value represented by this object after conversion to type long.

doubleValue

public double doubleValue()
Returns the value of this UByte as a double. This may involve rounding.

Returns:
the numeric value represented by this object after conversion to type double.

shortValue

public short shortValue()
Returns the value of this UByte as a short. This may involve rounding or truncation.

Returns:
the numeric value represented by this object after conversion to type short.

isUbyte

public static boolean isUbyte(String str)
Checks if the specified string is a decimal representation of a ubyte.

Parameters:
str - The string to verify
Returns:
true if the specified string is a decimal representation of a ubyte, false otherwize.