Class RationalBigInt
- java.lang.Object
-
- org.networkcalculus.num.implementations.RationalBigInt
-
- All Implemented Interfaces:
Num
public class RationalBigInt extends java.lang.Object implements Num
Wrapper class around org.apache.commons.math3.BigFraction.BigFraction introducing special values like positive / negative infinity and NaN as well as operators like min, max, ==, >, >=, <, and <= that are not part of BigFraction but needed by the network calculator.For the ease of converting from the primitive data type double to BigFraction objects, copy by value semantic are is applied.
-
-
Field Summary
Fields Modifier and Type Field Description private static RationalBigInt
instance
private Num
NaN
private Num
NEGATIVE_INFINITY
private Num
POSITIVE_INFINITY
private org.apache.commons.math3.fraction.BigFraction
value
private Num
ZERO
-
Constructor Summary
Constructors Modifier Constructor Description private
RationalBigInt()
RationalBigInt(double value)
RationalBigInt(int num)
RationalBigInt(int num, int den)
private
RationalBigInt(java.math.BigInteger num, java.math.BigInteger den)
private
RationalBigInt(org.apache.commons.math3.fraction.BigFraction frac)
RationalBigInt(RationalBigInt num)
-
Method Summary
Modifier and Type Method Description Num
abs(Num num)
Num
add(Num num1, Num num2)
Num
copy()
Num
create(double value)
Num
create(int num)
Num
create(int num, int den)
Num
create(java.lang.String num_str)
Num
createNaN()
Num
createNegativeInfinity()
Num
createPositiveInfinity()
Num
createZero()
Num
diff(Num num1, Num num2)
Num
div(Num num1, Num num2)
double
doubleValue()
boolean
eq(double num)
boolean
eq(Num num)
boolean
equals(java.lang.Object obj)
boolean
eqZero()
boolean
geq(Num num)
boolean
geqZero()
static RationalBigInt
getInstance()
Num
getNaN()
Num
getNegativeInfinity()
Num
getPositiveInfinity()
org.apache.commons.math3.fraction.BigFraction
getValue()
Num
getZero()
boolean
gt(Num num)
boolean
gtZero()
int
hashCode()
boolean
isFinite()
boolean
isInfinite()
boolean
isNaN()
boolean
leq(Num num)
boolean
leqZero()
boolean
lt(Num num)
boolean
ltZero()
Num
max(Num num1, Num num2)
Num
min(Num num1, Num num2)
Num
mult(Num num1, Num num2)
Num
negate(Num num)
Num
sub(Num num1, Num num2)
java.lang.String
toString()
-
-
-
Field Detail
-
instance
private static RationalBigInt instance
-
value
private org.apache.commons.math3.fraction.BigFraction value
-
POSITIVE_INFINITY
private Num POSITIVE_INFINITY
-
NEGATIVE_INFINITY
private Num NEGATIVE_INFINITY
-
NaN
private Num NaN
-
ZERO
private Num ZERO
-
-
Constructor Detail
-
RationalBigInt
private RationalBigInt()
-
RationalBigInt
public RationalBigInt(int num)
-
RationalBigInt
public RationalBigInt(double value)
-
RationalBigInt
public RationalBigInt(int num, int den)
-
RationalBigInt
public RationalBigInt(RationalBigInt num)
-
RationalBigInt
private RationalBigInt(java.math.BigInteger num, java.math.BigInteger den)
-
RationalBigInt
private RationalBigInt(org.apache.commons.math3.fraction.BigFraction frac)
-
-
Method Detail
-
getInstance
public static RationalBigInt getInstance()
-
doubleValue
public double doubleValue()
- Specified by:
doubleValue
in interfaceNum
-
getValue
public org.apache.commons.math3.fraction.BigFraction getValue()
-
hashCode
public int hashCode()
-
toString
public java.lang.String toString()
-
getPositiveInfinity
public Num getPositiveInfinity()
- Specified by:
getPositiveInfinity
in interfaceNum
-
createPositiveInfinity
public Num createPositiveInfinity()
- Specified by:
createPositiveInfinity
in interfaceNum
-
getNegativeInfinity
public Num getNegativeInfinity()
- Specified by:
getNegativeInfinity
in interfaceNum
-
createNegativeInfinity
public Num createNegativeInfinity()
- Specified by:
createNegativeInfinity
in interfaceNum
-
createZero
public Num createZero()
- Specified by:
createZero
in interfaceNum
-
create
public Num create(java.lang.String num_str) throws java.lang.Exception
-
equals
public boolean equals(java.lang.Object obj)
-
isInfinite
public boolean isInfinite()
- Specified by:
isInfinite
in interfaceNum
-
-