public class BigDecimalWrapper extends FieldElement<BigDecimalWrapper> implements IRingElement<BigDecimalWrapper>
Modifier and Type | Field and Description |
---|---|
(package private) BigDecimalWrapperFactory |
FACTORY
The factory for BigDecimalWrapper
|
(package private) static java.util.regex.Pattern |
fractionPattern
used in
BigDecimalWrapperFactory.get(Object) to parse fractions. |
private static long |
serialVersionUID |
protected java.math.BigDecimal |
value
The encapsulated value.
|
Modifier | Constructor and Description |
---|---|
protected |
BigDecimalWrapper(java.math.BigDecimal value,
FAC factory)
Builds an element from a BigDecimal value.
|
Modifier and Type | Method and Description |
---|---|
BigDecimalWrapper |
abs()
Returns absolute value of this element
|
BigDecimalWrapper |
add(BigDecimalWrapper val)
Calculates the sum of this element and another one.
|
int |
compareTo(BigDecimalWrapper o)
Implements Comparable.compareTo(Object).
|
BigDecimalWrapper |
divide(BigDecimalWrapper val)
Calculates the quotient of this element and another one.
|
double |
doubleValue()
Returns the double-precision floating-point value of this element.
|
boolean |
equals(java.lang.Object obj)
Checks two FieldElements for equality.
|
BigDecimalWrapperFactory |
getFactory()
Give access to the factory for this type.
|
java.math.BigDecimal |
getValue() |
int |
hashCode() |
BigDecimalWrapper |
invert()
Calculates the inverse element of multiplication for this element.
|
boolean |
isZero()
Tests if this RingElement is the neutral element of addition (zero).
|
BigDecimalWrapper |
multiply(BigDecimalWrapper val)
Calculates the product of this element and another one.
|
BigDecimalWrapper |
negate()
Calculates the inverse element of addition for this element.
|
BigDecimalWrapper |
sqrt() |
BigDecimalWrapper |
subtract(BigDecimalWrapper val)
Calculates the product of this element and another one.
|
java.lang.String |
toString()
Returns a String representation of this element.
|
norm
private static final long serialVersionUID
protected java.math.BigDecimal value
final BigDecimalWrapperFactory FACTORY
static final java.util.regex.Pattern fractionPattern
BigDecimalWrapperFactory.get(Object)
to parse fractions.protected BigDecimalWrapper(java.math.BigDecimal value, FAC factory)
value
- a BigDecimal value to be wrappedfactory
- the factory encapsulating the context in which the new value
is created. See java.math.MathContextpublic int hashCode()
hashCode
in class java.lang.Object
Object.hashCode()
public java.math.BigDecimal getValue()
public BigDecimalWrapper add(BigDecimalWrapper val)
add
in interface IRingElement<BigDecimalWrapper>
val
- public BigDecimalWrapper subtract(BigDecimalWrapper val)
subtract
in interface IRingElement<BigDecimalWrapper>
subtract
in class FieldElement<BigDecimalWrapper>
val
- public BigDecimalWrapper multiply(BigDecimalWrapper val)
multiply
in interface IRingElement<BigDecimalWrapper>
val
- public BigDecimalWrapper divide(BigDecimalWrapper val) throws DivisionByZeroException
divide
in interface IRingElement<BigDecimalWrapper>
divide
in class FieldElement<BigDecimalWrapper>
val
- DivisionByZeroException
- if a division is possible for the type, but val
is
the zero element.public BigDecimalWrapper negate()
negate
in interface IRingElement<BigDecimalWrapper>
public BigDecimalWrapper invert() throws DivisionByZeroException
invert
in interface IRingElement<BigDecimalWrapper>
invert
in class RingElement<BigDecimalWrapper>
InvalidOperationException
- if original value is zeroDivisionByZeroException
- if an inversion is possible for the type, but the element is
the zero element.public boolean equals(java.lang.Object obj)
equals
in interface IRingElement<BigDecimalWrapper>
equals
in class RingElement<BigDecimalWrapper>
obj
- public boolean isZero()
RingElement
isZero
in interface IRingElement<BigDecimalWrapper>
isZero
in class RingElement<BigDecimalWrapper>
RingElement.isZero()
public java.lang.String toString()
toString
in class java.lang.Object
public double doubleValue()
public int compareTo(BigDecimalWrapper o)
compareTo
in interface java.lang.Comparable<BigDecimalWrapper>
compareTo
in interface IRingElement<BigDecimalWrapper>
o
- the objectpublic BigDecimalWrapper sqrt()
InvalidOperationException
- if the precision of the factory is 0 (that is infinite
precision) or the value is negative.public BigDecimalWrapperFactory getFactory()
IRingElement
getFactory
in interface IRingElement<BigDecimalWrapper>
public BigDecimalWrapper abs()
IRingElement
abs
in interface IRingElement<BigDecimalWrapper>