All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----cryptix.util.math.BigRegister
The bits are indexed from 0 (rightmost) to size
- 1, (leftmost) where size
is this register's
designated (at instantiation time) bit capacity.
Copyright © 1995-1997
Systemics Ltd on behalf of the
Cryptix Development Team.
All rights reserved.
$Revision: 1.2 $
BigRegister
object.
BigRegister
of a given size
with all its bits set to zeroes.
this &= source
.
this &= ~source
.
this BigRegister
object with random data
generated from the default source.
this BigRegister
object with random data
generated from a designated source.
this BigRegister
.
this
.
this BigRegister
's contents to that of the
argument, returning -1, 0 or 1 for less than, equal to, or greater
than comparison result.
this
.
count
bits starting at offset n
framed in a long
, right justified and left padded
with binary zeroes.
size
of this
object as
specified at its instantiation time.
this
.
this BigRegister
as an int
.
this
.
size
and bits
) are equal to this one;
false otherwise.
this
.
this
.
this BigRegister
as a long
.
this
.
this = ~this
.
this |= source
.
this BigRegister
's bits.
size
of this
register.
size
of this
register.
count
bits starting at offset n
to a given value
.
this BigRegister
's contents
by a given number of bit positions.
this BigRegister
's contents
by a given number of bit positions.
this BigRegister
's contents in a
byte array with the LSB at index position 0.
String
representation of the binary
contents of this
.
BigRegister
, of the same size
as this
set to the specified value.
this ^= source
.
public static final int MAXIMUM_SIZE
BigRegister
object.
public BigRegister(int size)
BigRegister
of a given size
with all its bits set to zeroes.
this
object.
public synchronized Object clone()
this
.
public synchronized void and(BigRegister source)
this &= source
.
size
than this
.
public synchronized void andNot(BigRegister source)
this &= ~source
.
size
than this
.
public synchronized void or(BigRegister source)
this |= source
.
size
than this
.
public synchronized void not()
this = ~this
.
public synchronized void xor(BigRegister source)
this ^= source
.
size
than this
.
public synchronized void shiftLeft(int n)
this BigRegister
's contents
by a given number of bit positions. If the number is negative, a
right shift is executed.
public synchronized void shiftRight(int n)
this BigRegister
's contents
by a given number of bit positions. If the number is negative, a
left shift is executed.
public synchronized void rotateLeft(int n)
size
of this
register.
Effectively compute this = this << n | this >> (size - n)
.
If the number of positions to rotate by is negative, then a right instead of left rotation is executed.
public synchronized void rotateRight(int n)
size
of this
register.
Effectively compute this = this >> n | this << (size - n)
.
If the number of positions to rotate by is negative, then a left instead of right rotation is executed.
public synchronized void invertOrder()
this
.
public synchronized boolean testBit(int n)
public synchronized boolean isSameValue(BigRegister x)
size
and bits
) are equal to this one;
false otherwise.
NOTE: the equals
method is not used, because this is
a mutable object (see the requirements for equals in the Java Language
Spec).
size
and contents.
public synchronized int compareTo(BigRegister x)
this BigRegister
's contents to that of the
argument, returning -1, 0 or 1 for less than, equal to, or greater
than comparison result.
BigRegister
object to compare to.
this
object are
respectively less than, equal to, or greater than those
of the argument.
public synchronized void setBit(int n)
ArrayOutOfBOundsException
while
accessing the bits array.
public synchronized void setBits(int n, int count, long value)
count
bits starting at offset n
to a given value
.
long
.
ArrayOutOfBOundsException
while
accessing the bits array, or count
is < 1 or
> 64.
public synchronized void clearBit(int n)
ArrayOutOfBOundsException
while
accessing the bits array.
public synchronized void flipBit(int n)
ArrayOutOfBOundsException
while
accessing the bits array.
public synchronized int getBit(int n)
ArrayOutOfBOundsException
while
accessing the bits array.
public synchronized long getBits(int n, int count)
count
bits starting at offset n
framed in a long
, right justified and left padded
with binary zeroes.
count
bits starting from bit
index n
in a java long
.
ArrayOutOfBOundsException
while
accessing the bits array, or count
is < 1 or
> 64.
public synchronized int byteValue()
this BigRegister
.
this
.
public synchronized int intValue()
this BigRegister
as an int
.
this
as an
int
.
public synchronized long longValue()
this BigRegister
as a long
.
this
as a
long
.
public synchronized BigRegister valueOf(long n)
BigRegister
, of the same size
as this
set to the specified value.
BigRegister
, of the same size
as this
set to the specified value.
public synchronized void reset()
this BigRegister
's bits.
public synchronized void atRandom()
this BigRegister
object with random data
generated from the default source.
public synchronized void atRandom(SecureRandom source)
this BigRegister
object with random data
generated from a designated source.
public synchronized void load(BigRegister source)
this
.
size
than this
.
public synchronized void load(byte source[])
this
.
Byte array order is assumed to have its Least Significant Byte
(LSB) at index position 0. This format mirrors that of the output
returned by the toByteArray()
method.
Bits unprovided for in the source
array are cleared.
It is a more tolerant way of initialising a register than that
obtained by invoking the same method with a BigRegister
argument.
size
than this
.
public synchronized byte[] toByteArray()
this BigRegister
's contents in a
byte array with the LSB at index position 0. This format is
compatible with the load([B)
method of this class.
this
in a byte array with the
LSB at index position 0.
public synchronized int getSize()
size
of this
object as
specified at its instantiation time.
size
of this
object
as specified at its instantiation time.
public synchronized int countSetBits()
this
.
this
.
public synchronized int highestSetBit()
this
.
this
, or
-1 if all bits are zeroes.
public synchronized int lowestSetBit()
this
.
this
, or
-1 if all bits are zeroes.
public synchronized String toString()
String
representation of the binary
contents of this
.
this
.
All Packages Class Hierarchy This Package Previous Next Index