net.sourceforge.juint
Class Int8

java.lang.Object
  extended by java.lang.Number
      extended by net.sourceforge.juint.Int8
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable, Bitwise<Int8>

public class Int8
extends java.lang.Number
implements java.io.Serializable, java.lang.Comparable, Bitwise<Int8>

Signed 8-bit integer.

See Also:
Serialized Form

Field Summary
static byte MAX_VALUE
          The largest possible value.
static byte MIN_VALUE
          The smallest possible value.
 
Constructor Summary
Int8(byte bite)
          Creates a new instance from a byte.
Int8(int bite)
          Creates a new instance from an int.
Int8(long bite)
          Creates a new instance from a long.
Int8(short bite)
          Creates a new instance from a short.
 
Method Summary
 Int8 addBitmask(Int8 bitmask)
          Sets the bits in the given bitmask.
 Int8 and(Int8 number)
          Logical and.
 int compareTo(java.lang.Object object)
          Compares this Int8 to another Int8 for order.
 double doubleValue()
          Gets the value as a double.
 boolean equals(java.lang.Object object)
          Compares this Int8 to anoter Int8 for equality.
 float floatValue()
          Gets the value as a float.
 boolean hasBitmask(Int8 bitmask)
          Determines if this number has the given bitmask.
 int hashCode()
          Gets the hash code.
 byte int8Value()
          Gets the value as a signed 8-bit integer.
 int intValue()
          Gets the value as an int.
 long longValue()
          Gets the value as a long.
 Int8 not()
          Logical not.
 Int8 or(Int8 number)
          Logical or.
 Int8 removeBitmask(Int8 bitmask)
          Unsets the bits in the given bitmask.
 java.lang.String toString()
          Gets the value as a String.
 Int8 xor(Int8 number)
          Logical xor.
 
Methods inherited from class java.lang.Number
byteValue, shortValue
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

MAX_VALUE

public static final byte MAX_VALUE
The largest possible value.

127

See Also:
Constant Field Values

MIN_VALUE

public static final byte MIN_VALUE
The smallest possible value.

-128

See Also:
Constant Field Values
Constructor Detail

Int8

public Int8(byte bite)
Creates a new instance from a byte.

Parameters:
bite - the value to be represented

Int8

public Int8(short bite)
Creates a new instance from a short.

Parameters:
bite - the value to be represented

Int8

public Int8(int bite)
Creates a new instance from an int.

Parameters:
bite - the value to be represented

Int8

public Int8(long bite)
Creates a new instance from a long.

Parameters:
bite - the value to be represented
Method Detail

int8Value

public byte int8Value()
Gets the value as a signed 8-bit integer.

Returns:
the value as a signed 8-bit integer

intValue

public int intValue()
Gets the value as an int.

Specified by:
intValue in class java.lang.Number
Returns:
the value as an int

longValue

public long longValue()
Gets the value as a long.

Specified by:
longValue in class java.lang.Number
Returns:
the value as a long

floatValue

public float floatValue()
Gets the value as a float.

Specified by:
floatValue in class java.lang.Number
Returns:
the value as a float

doubleValue

public double doubleValue()
Gets the value as a double.

Specified by:
doubleValue in class java.lang.Number
Returns:
the value as a double

compareTo

public int compareTo(java.lang.Object object)
Compares this Int8 to another Int8 for order.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
object - a Int8

equals

public boolean equals(java.lang.Object object)
Compares this Int8 to anoter Int8 for equality.

Overrides:
equals in class java.lang.Object
Parameters:
object - a Int8

hashCode

public int hashCode()
Gets the hash code. The result is the value returned from intValue().

Overrides:
hashCode in class java.lang.Object
Returns:
the hash code

toString

public java.lang.String toString()
Gets the value as a String.

Overrides:
toString in class java.lang.Object
Returns:
the value as a String

and

public Int8 and(Int8 number)
Description copied from interface: Bitwise
Logical and.

Specified by:
and in interface Bitwise<Int8>
Returns:
the result of the and

not

public Int8 not()
Description copied from interface: Bitwise
Logical not.

Specified by:
not in interface Bitwise<Int8>
Returns:
the result of the not

or

public Int8 or(Int8 number)
Description copied from interface: Bitwise
Logical or.

Specified by:
or in interface Bitwise<Int8>
Returns:
the result of the or

xor

public Int8 xor(Int8 number)
Description copied from interface: Bitwise
Logical xor.

Specified by:
xor in interface Bitwise<Int8>
Returns:
the result of the xor

addBitmask

public Int8 addBitmask(Int8 bitmask)
Description copied from interface: Bitwise
Sets the bits in the given bitmask.

Specified by:
addBitmask in interface Bitwise<Int8>
Returns:
the number with the bits set

hasBitmask

public boolean hasBitmask(Int8 bitmask)
Description copied from interface: Bitwise
Determines if this number has the given bitmask.

Specified by:
hasBitmask in interface Bitwise<Int8>
Returns:
true if the number has the bitmask; false otherwise

removeBitmask

public Int8 removeBitmask(Int8 bitmask)
Description copied from interface: Bitwise
Unsets the bits in the given bitmask.

Specified by:
removeBitmask in interface Bitwise<Int8>
Returns:
the number with the bits unset