Package me.olhalvo.unum.types
Class UByte
java.lang.Object
java.lang.Number
me.olhalvo.unum.types.UNumber
me.olhalvo.unum.types.UByte
- All Implemented Interfaces:
Serializable,Comparable<Number>
- Direct Known Subclasses:
UByteO
Class used to represent an unsigned byte (0 to 255)
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd(T b) Adds the given number to this UByte and returns a new UByte with the resultand(T b) Performs a bitwise AND operation between this UByte and the given number, returning a new UByte with the resultdivide(T b) Divides this Ubyte by the passed number and returns a new UByte with the resultdoublebooleanChecks equality between this UByte and another objectfloatinthashCode()intintValue()longlsl(int n) Performs a logical left shift operation on this UBytelsr(int n) Performs a logical right shift operation on this UBytemultiply(T b) Multiplies this Ubyte by the passed number and returns a new UByte with the resultprotected UBytenewInstance(byte value) Protected methods to be used so that arithmetic methods can have similar behaviour in overflow classesprotected UBytenewInstance(int value) Protected methods to be used so that arithmetic methods can have similar behaviour in overflow classesprotected UBytenewInstance(long value) Protected methods to be used so that arithmetic methods can have similar behaviour in overflow classesprotected UBytenewInstance(short value) Protected methods to be used so that arithmetic methods can have similar behaviour in overflow classesnot()Performs a bitwise NOT operation on this UByteor(T b) Performs a bitwise OR operation between this UByte and the given number, returning a new UByte with the resultremainder(T b) Calculates the remainder of this Ubyte divided by the passed number and returns a new UByte with the resultsubtract(T b) Subtracts the given number to this UByte and returns a new UByte with the resulttoString()static UBytevalueOf(byte value) see:valueOf(short)static UBytevalueOf(int value) see:valueOf(short)static UBytevalueOf(long value) see:valueOf(short)static UBytevalueOf(short value) Returns a UByte instance representing the specified valuestatic UBytesee:valueOf(short)xor(T b) Performs a bitwise XOR operation between this UByte and the given number, returning a new UByte with the resultMethods inherited from class java.lang.Number
byteValue, shortValueMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Comparable
compareTo
-
Field Details
-
MIN_VALUE
public static final short MIN_VALUEThe minimum value an UByte can have (0)- See Also:
-
MAX_VALUE
public static final short MAX_VALUEThe maximum value an UByte can have (255)- See Also:
-
-
Constructor Details
-
UByte
- Throws:
OutOfUnsignedRangeException
-
UByte
protected UByte(byte value) -
UByte
- Throws:
OutOfUnsignedRangeException
-
UByte
- Throws:
OutOfUnsignedRangeException
-
-
Method Details
-
valueOf
Returns a UByte instance representing the specified value- Parameters:
value- the value to represent- Returns:
- a UByte instance representing the specified value
- Throws:
OutOfUnsignedRangeException- if the value is out of range(MIN_VALUEtoMAX_VALUE)- See Also:
-
valueOf
see:valueOf(short) -
valueOf
see:valueOf(short)- Throws:
OutOfUnsignedRangeException
-
valueOf
see:valueOf(short)- Throws:
OutOfUnsignedRangeException
-
valueOf
see:valueOf(short)- Throws:
OutOfUnsignedRangeException
-
newInstance
Protected methods to be used so that arithmetic methods can have similar behaviour in overflow classes- Throws:
OutOfUnsignedRangeException- See Also:
-
newInstance
Protected methods to be used so that arithmetic methods can have similar behaviour in overflow classes- Throws:
OutOfUnsignedRangeException- See Also:
-
newInstance
Protected methods to be used so that arithmetic methods can have similar behaviour in overflow classes- Throws:
OutOfUnsignedRangeException- See Also:
-
newInstance
Protected methods to be used so that arithmetic methods can have similar behaviour in overflow classes- Throws:
OutOfUnsignedRangeException- See Also:
-
intValue
-
longValue
-
floatValue
-
doubleValue
-
toString
-
equals
Checks equality between this UByte and another object -
hashCode
-
add
Adds the given number to this UByte and returns a new UByte with the result- Type Parameters:
T- the type of the number- Parameters:
b- the number to add- Returns:
- a new UByte with the result
- Throws:
OutOfUnsignedRangeException- if the result is out of range(MIN_VALUEtoMAX_VALUE)- See Also:
-
subtract
Subtracts the given number to this UByte and returns a new UByte with the result- Type Parameters:
T- the type of the number- Parameters:
b- the number to subtract- Returns:
- a new UByte with the result
- Throws:
OutOfUnsignedRangeException- if the result is out of range(MIN_VALUEtoMAX_VALUE)- See Also:
-
multiply
Multiplies this Ubyte by the passed number and returns a new UByte with the result- Type Parameters:
T- the type of the number- Parameters:
b- the number to multiply by- Returns:
- a new UByte with the result
- Throws:
OutOfUnsignedRangeException- if the result is out of range(MIN_VALUEtoMAX_VALUE)- See Also:
-
divide
Divides this Ubyte by the passed number and returns a new UByte with the result- Type Parameters:
T- the type of the number- Parameters:
b- the number to Divide by- Returns:
- a new UByte with the result
- Throws:
OutOfUnsignedRangeException- if the result is out of range(MIN_VALUEtoMAX_VALUE)- See Also:
-
remainder
Calculates the remainder of this Ubyte divided by the passed number and returns a new UByte with the result- Type Parameters:
T- the type of the number- Parameters:
b- the number to divide by- Returns:
- a new UByte with the result
- Throws:
OutOfUnsignedRangeException- if the result is out of range(MIN_VALUEtoMAX_VALUE)- See Also:
-
and
-
or
Performs a bitwise OR operation between this UByte and the given number, returning a new UByte with the result- Type Parameters:
T- the type of the number- Parameters:
b- the number to OR with- Returns:
- a new UByte with the result
- Throws:
OutOfUnsignedRangeException- if the result is out of range(MIN_VALUEtoMAX_VALUE)- See Also:
-
xor
Performs a bitwise XOR operation between this UByte and the given number, returning a new UByte with the result- Type Parameters:
T- the type of the number- Parameters:
b- the number to XOR with- Returns:
- a new UByte with the result
- Throws:
OutOfUnsignedRangeException- if the result is out of range(MIN_VALUEtoMAX_VALUE)- See Also:
-
not
Performs a bitwise NOT operation on this UByte- Returns:
- a new UByte with the result
- See Also:
-
lsl
Performs a logical left shift operation on this UByte- Parameters:
n- the number of bits to shift- Returns:
- a new UByte with the result
- See Also:
-
lsr
Performs a logical right shift operation on this UByte- Parameters:
n- the number of bits to shift- Returns:
- a new UByte with the result
- See Also:
-
asOverflow
-