Class BigIntegerAlgebra
- java.lang.Object
-
- java.lang.Number
-
- java.math.BigInteger
-
- BigIntegerAlgebra
-
- All Implemented Interfaces:
Serializable,Comparable<BigInteger>
public class BigIntegerAlgebra extends BigInteger
Wrapper forjava.math.BigInteger. Required for mixed arithmetic withintorlongoperands becausejava.math.BigIntegerdoes not implement aBigInteger(long)constructor.
Note: As classBigIntegerAlgebraextends classjava.math.BigIntegermethods of the later class can be called onBigIntegerAlgebrainstances. The methods however will not return anBigIntegerAlgebrainstance but an instance of the super class as result. If needed, call theBigIntegerAlgebra(BigInteger)constructor on the result to get aBigIntegerAlgebrainstance again. If this is considered inconvenient, wrapper methods for all relevant methods ofBigIntegerneed to be implemented in the Algebra wrapper class.
-
-
Field Summary
-
Fields inherited from class java.math.BigInteger
ONE, TEN, TWO, ZERO
-
-
Constructor Summary
Constructors Constructor Description BigIntegerAlgebra(long value)Constructs a new BigIntegerAlgebra object.BigIntegerAlgebra(String value)Constructs a new BigIntegerAlgebra object.BigIntegerAlgebra(String value, int radix)Constructs a new BigIntegerAlgebra object.BigIntegerAlgebra(BigInteger value)Constructs a new BigIntegerAlgebra object from ajava.math.BigInteger.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BigIntegerAlgebraadd(BigInteger opnd)Addsopndto this.BigIntegerAlgebradiv(BigInteger opnd)Divides this byopnd.BigIntegerAlgebramul(BigInteger opnd)(Post)Multiplies this byopnd.BigIntegerAlgebraneg()CallsBigInteger.negate().BigIntegerAlgebrapow(int exponent)Returns the power ofexponentof this.BigIntegerAlgebraremainder(BigInteger opnd)Returns the remainder of this divided byopnd.BigIntegerAlgebrasub(BigInteger opnd)Subtractsopndfrom this.-
Methods inherited from class java.math.BigInteger
abs, and, andNot, bitCount, bitLength, byteValueExact, clearBit, compareTo, divide, divideAndRemainder, doubleValue, equals, flipBit, floatValue, gcd, getLowestSetBit, hashCode, intValue, intValueExact, isProbablePrime, longValue, longValueExact, max, min, mod, modInverse, modPow, multiply, negate, nextProbablePrime, not, or, probablePrime, setBit, shiftLeft, shiftRight, shortValueExact, signum, sqrt, sqrtAndRemainder, subtract, testBit, toByteArray, toString, toString, valueOf, xor
-
Methods inherited from class java.lang.Number
byteValue, shortValue
-
-
-
-
Constructor Detail
-
BigIntegerAlgebra
public BigIntegerAlgebra(BigInteger value)
Constructs a new BigIntegerAlgebra object from ajava.math.BigInteger.
-
BigIntegerAlgebra
public BigIntegerAlgebra(String value)
Constructs a new BigIntegerAlgebra object.
Callsjava.math.BigInteger(String)but allows arbitrary' 'or'_'characters invalueto improve readability.
-
BigIntegerAlgebra
public BigIntegerAlgebra(String value, int radix)
Constructs a new BigIntegerAlgebra object.
Callsjava.math.BigInteger( value, radix )but allows arbitrary' 'or'_'characters invalue.
-
BigIntegerAlgebra
public BigIntegerAlgebra(long value)
Constructs a new BigIntegerAlgebra object.
Required for mixed operations: int op BigInteger, BigInteger op int
-
-
Method Detail
-
neg
public BigIntegerAlgebra neg()
CallsBigInteger.negate().
-
add
public BigIntegerAlgebra add(BigInteger opnd)
- Overrides:
addin classBigInteger
-
sub
public BigIntegerAlgebra sub(BigInteger opnd)
-
mul
public BigIntegerAlgebra mul(BigInteger opnd)
-
div
public BigIntegerAlgebra div(BigInteger opnd)
-
remainder
public BigIntegerAlgebra remainder(BigInteger opnd)
- Overrides:
remainderin classBigInteger
-
pow
public BigIntegerAlgebra pow(int exponent)
- Overrides:
powin classBigInteger
-
-