|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpops.ale.codec.UnsignedBigInt
public class UnsignedBigInt
This class is a recyclable, unsigned and finite java's BigInteger
like, but
simpler.
This class wraps an array of bytes of maximum MAX_BYTES
.
This size is fixed for recycling the object.
This class is intended to be used for manipulating numbers on more than 64 bits.
However, for better efficiency numbers that hold on maximum 7 bytes, are treated as native long.
Finally, this class has the same semantics as the following union in C :
typedef union { long nativeData; unsigned char data [MAX_BYTES]; } UnsignedBigInt;In this case, a C compiler allocates MAX_BYTES bytes of memory and the access to this memory is determined upon compilation.
BigInteger
for string conversion
of data on more than 7 bytes.
Constructor Summary | |
---|---|
UnsignedBigInt()
Constructor |
Method Summary | |
---|---|
static long |
bench_toString(byte[] data)
|
static void |
bench()
|
static long |
benchSetData()
|
static int |
compare(UnsignedBigInt arg1,
UnsignedBigInt arg2)
Comparison of two numbers. |
boolean |
equal(UnsignedBigInt val)
Equal method |
boolean |
greaterEqThan(UnsignedBigInt val)
Greater or Equal Than. |
boolean |
greaterThan(UnsignedBigInt val)
Greater Than. |
boolean |
lessEqThan(UnsignedBigInt val)
Less or Equal Than. |
boolean |
lessThan(UnsignedBigInt val)
Less Than. |
static void |
main(java.lang.String[] args)
|
static void |
postlude()
|
static void |
prelude()
|
void |
razData()
sets all bytes to zero |
void |
setData(byte[] data)
Copies the given array for processing. |
void |
setData(byte[] data,
int start,
int length)
Copies the given array for processing. |
void |
setData(byte[] data,
int start,
int startMask,
int startShift,
int length,
int stopMask,
int stopShift)
Copies the given array for processing. |
void |
setData(long data)
|
void |
setData(java.lang.String data)
Wraps the given decimal String for processing. |
void |
setData(UnsignedBigInt val)
Copies the given array for processing. |
void |
setNonNativeData(long data)
Wraps the given long for processing. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public UnsignedBigInt()
Method Detail |
---|
public void razData()
public void setData(UnsignedBigInt val)
data
- array of bytespublic void setData(byte[] data)
data
- array of bytespublic void setData(byte[] data, int start, int length)
data
- array of byteslength
- the amount of bytes to copypublic void setData(byte[] data, int start, int startMask, int startShift, int length, int stopMask, int stopShift)
data
- array of bytespublic void setNonNativeData(long data)
data
- in long : may be also a byte, short or int promoted to long.public void setData(long data)
public void setData(java.lang.String data)
data
- in longpublic boolean lessThan(UnsignedBigInt val)
val
- value to compare with
public boolean lessEqThan(UnsignedBigInt val)
val
- value to compare with
public boolean greaterThan(UnsignedBigInt val)
val
- value to compare with
public boolean greaterEqThan(UnsignedBigInt val)
val
- value to compare with
public boolean equal(UnsignedBigInt val)
public static int compare(UnsignedBigInt arg1, UnsignedBigInt arg2)
public java.lang.String toString()
toString
in class java.lang.Object
public static void main(java.lang.String[] args) throws java.lang.Exception
java.lang.Exception
public static void bench() throws java.lang.Exception
java.lang.Exception
public static void prelude() throws java.lang.InterruptedException
java.lang.InterruptedException
public static void postlude() throws java.lang.InterruptedException
java.lang.InterruptedException
public static long benchSetData() throws java.lang.Exception
java.lang.Exception
public static long bench_toString(byte[] data) throws java.lang.Exception
java.lang.Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |