|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectch.javasoft.math.AbstractNumberOps<BigInteger>
ch.javasoft.math.BigIntegerOperations
public class BigIntegerOperations
Number operations for BigInteger numbers.
A singleton instance exists for this class.
| Constructor Summary | |
|---|---|
BigIntegerOperations()
|
|
| Method Summary | |
|---|---|
BigInteger |
abs(BigInteger number)
Returns the absolute value of the given number, i.e. |
BigInteger |
add(BigInteger numA,
BigInteger numB)
Returns the sum of the two values, i.e. |
int |
byteLength()
Returns the byte array length if NumberOperations.toByteArray(Number) is used and if
this size is fixed, and -1 if the size may vary depending on the number
instance |
int |
compare(BigInteger o1,
BigInteger o2)
|
BigInteger |
divide(BigInteger numA,
BigInteger numB)
Returns the ratio of the two values, i.e. |
BigInteger |
fromByteArray(byte[] bytes)
Converts the byte array containing binary data into a new number instance. |
static BigIntegerOperations |
instance()
Returns the singleton instance |
BigInteger |
invert(BigInteger number)
Returns the inverted value, i.e. |
boolean |
isOne(BigInteger number)
Returns true if this value is numerically equal to one, i.e. |
boolean |
isZero(BigInteger number)
Returns true if this value is numerically equal to zero, i.e. |
BigInteger |
multiply(BigInteger numA,
BigInteger numB)
Returns the product of the two values, i.e. |
BigInteger |
negate(BigInteger number)
Returns the negated value, i.e. |
BigInteger[] |
newArray(int size)
Create a new array of the underlying number type |
BigInteger[][] |
newArray(int rows,
int cols)
Create a new 2 dimensional array of the underlying number type |
Class<BigInteger> |
numberClass()
The class representing numbers of this number operations instance |
BigInteger |
one()
Returns the value representing one |
BigInteger |
pow(BigInteger numA,
BigInteger numB)
Returns the powered value, i.e. |
BigInteger |
readFrom(DataInput in)
Reads binary data from the given data input. |
BigInteger |
reduce(BigInteger number)
Converts the number into some reduced form. |
BigInteger[] |
reduceVector(boolean cloneOnChange,
BigInteger... vector)
Converts a vector into some reduced form. |
int |
signum(BigInteger number)
Returns signum of the value, i.e. |
BigInteger |
subtract(BigInteger numA,
BigInteger numB)
Returns the difference of the two values, i.e. |
byte[] |
toByteArray(BigInteger number)
Converts this number to binary data and returns it as a byte array. |
BigInteger |
valueOf(double value)
Create an instance of the underlying number type based on the submitted double value |
BigInteger |
valueOf(long value)
Create an instance of the underlying number type based on the submitted long integer value |
BigInteger |
valueOf(Number number)
Create an instance of the underlying number type based on the submitted number |
BigInteger |
valueOf(String s)
Create an instance of the underlying number type based on the given string representation of the number |
void |
writeTo(BigInteger number,
DataOutput out)
Converts this number to binary data and writes it to the data output. |
BigInteger |
zero()
Returns the value representing zero |
| Methods inherited from class ch.javasoft.math.AbstractNumberOps |
|---|
isNegative, isNonNegative, isNonPositive, isNonZero, isPositive, max, max, min, min |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.util.Comparator |
|---|
equals |
| Constructor Detail |
|---|
public BigIntegerOperations()
| Method Detail |
|---|
public static BigIntegerOperations instance()
public Class<BigInteger> numberClass()
NumberOperations
public BigInteger[] newArray(int size)
NumberOperations
public BigInteger[][] newArray(int rows,
int cols)
NumberOperations
public BigInteger valueOf(String s)
NumberOperations
public BigInteger valueOf(Number number)
NumberOperations
public BigInteger valueOf(long value)
NumberOperations
public BigInteger valueOf(double value)
NumberOperations
public BigInteger abs(BigInteger number)
NumberOperations
abs in interface NumberOperations<BigInteger>abs in class AbstractNumberOps<BigInteger>
public BigInteger add(BigInteger numA,
BigInteger numB)
NumberOperations
public BigInteger divide(BigInteger numA,
BigInteger numB)
NumberOperationsFor integer types, an integer division is performed, ignoring possible remainders
public BigInteger invert(BigInteger number)
NumberOperations
invert in interface NumberOperations<BigInteger>invert in class AbstractNumberOps<BigInteger>public boolean isOne(BigInteger number)
NumberOperations
isOne in interface NumberOperations<BigInteger>isOne in class AbstractNumberOps<BigInteger>public boolean isZero(BigInteger number)
NumberOperations
isZero in interface NumberOperations<BigInteger>isZero in class AbstractNumberOps<BigInteger>
public BigInteger multiply(BigInteger numA,
BigInteger numB)
NumberOperations
public BigInteger negate(BigInteger number)
NumberOperations
public BigInteger one()
NumberOperations
public BigInteger subtract(BigInteger numA,
BigInteger numB)
NumberOperations
public BigInteger zero()
NumberOperations
public int compare(BigInteger o1,
BigInteger o2)
public BigInteger reduce(BigInteger number)
NumberOperations
public BigInteger[] reduceVector(boolean cloneOnChange,
BigInteger... vector)
NumberOperations
Note that the vector length might change by this operation. If only
individual components of the vector should be reduced, which is not
affecting the vector's length, reduce each number
separately.
cloneOnChange - if a reduction can be made, the array is cloned
and the original array is not changed. If no
reduction can be made, or if cloneOnChange
is false, the original array will be returned,
unmodified in the former case, and with reduced
values in the latter case.vector - the vector to reducepublic int signum(BigInteger number)
NumberOperations
public BigInteger pow(BigInteger numA,
BigInteger numB)
NumberOperations
public byte[] toByteArray(BigInteger number)
NumberOperationsNumberOperations.fromByteArray(byte[]) method.
public void writeTo(BigInteger number,
DataOutput out)
throws IOException
NumberOperationsNumberOperations.readFrom(DataInput).
IOExceptionpublic BigInteger fromByteArray(byte[] bytes)
NumberOperationsNumberOperations.toByteArray(Number) method.
public BigInteger readFrom(DataInput in)
throws IOException
NumberOperationsNumberOperations.writeTo(Number, DataOutput)
IOExceptionpublic int byteLength()
NumberOperationsNumberOperations.toByteArray(Number) is used and if
this size is fixed, and -1 if the size may vary depending on the number
instance
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||