public class DoubleWrapper extends FieldElement<DoubleWrapper> implements IRingElement<DoubleWrapper>
Modifier and Type | Class and Description |
---|---|
class |
DoubleWrapper.DoubleWrapperFactory
The factory for instances of class
FACTORY |
Modifier and Type | Field and Description |
---|---|
static DoubleWrapper.DoubleWrapperFactory |
FACTORY
The singleton factory for DoubleWrapper
|
(package private) static java.util.regex.Pattern |
fractionPattern
used in
DoubleWrapper.DoubleWrapperFactory.get(Object) to parse fractions. |
private static DoubleWrapper |
M_ONE
the constant -1
|
private static DoubleWrapper |
ONE
the constant 1
|
private static long |
serialVersionUID |
protected double |
value
The encapsulated value.
|
private static DoubleWrapper |
ZERO
the constant 0
|
Constructor and Description |
---|
DoubleWrapper(double value)
Builds an element from a double-precision floating-point value.
|
Modifier and Type | Method and Description |
---|---|
DoubleWrapper |
abs()
Returns absolute value of this element
|
DoubleWrapper |
add(DoubleWrapper val)
Calculates the sum of this element and another one.
|
int |
compareTo(DoubleWrapper o)
Implements Comparable.compareTo(Object).
|
DoubleWrapper |
divide(DoubleWrapper 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.
|
DoubleWrapper.DoubleWrapperFactory |
getFactory()
Give access to the factory for this type.
|
double |
getValue() |
int |
hashCode() |
DoubleWrapper |
invert()
Calculates the inverse element of multiplication for this element.
|
DoubleWrapper |
multiply(DoubleWrapper val)
Calculates the product of this element and another one.
|
DoubleWrapper |
negate()
Calculates the inverse element of addition for this element.
|
DoubleWrapper |
sqrt() |
DoubleWrapper |
subtract(DoubleWrapper 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 double value
private static final DoubleWrapper M_ONE
private static final DoubleWrapper ONE
private static final DoubleWrapper ZERO
public static final DoubleWrapper.DoubleWrapperFactory FACTORY
static final java.util.regex.Pattern fractionPattern
DoubleWrapper.DoubleWrapperFactory.get(Object)
to parse fractions.public DoubleWrapper(double value)
value
- a double value to be wrappedpublic int hashCode()
hashCode
in class java.lang.Object
Object.hashCode()
public double getValue()
public DoubleWrapper add(DoubleWrapper val)
add
in interface IRingElement<DoubleWrapper>
val
- public DoubleWrapper subtract(DoubleWrapper val)
subtract
in interface IRingElement<DoubleWrapper>
subtract
in class FieldElement<DoubleWrapper>
val
- public DoubleWrapper multiply(DoubleWrapper val)
multiply
in interface IRingElement<DoubleWrapper>
val
- public DoubleWrapper divide(DoubleWrapper val) throws DivisionByZeroException
divide
in interface IRingElement<DoubleWrapper>
divide
in class FieldElement<DoubleWrapper>
val
- DivisionByZeroException
- if a division is possible for the type, but val
is
the zero element.public DoubleWrapper negate()
negate
in interface IRingElement<DoubleWrapper>
public DoubleWrapper invert() throws DivisionByZeroException
invert
in interface IRingElement<DoubleWrapper>
invert
in class RingElement<DoubleWrapper>
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<DoubleWrapper>
equals
in class RingElement<DoubleWrapper>
obj
- public java.lang.String toString()
toString
in class java.lang.Object
public double doubleValue()
public int compareTo(DoubleWrapper o)
compareTo
in interface java.lang.Comparable<DoubleWrapper>
compareTo
in interface IRingElement<DoubleWrapper>
o
- the objectpublic DoubleWrapper sqrt()
public DoubleWrapper.DoubleWrapperFactory getFactory()
IRingElement
getFactory
in interface IRingElement<DoubleWrapper>
public DoubleWrapper abs()
IRingElement
abs
in interface IRingElement<DoubleWrapper>
IRingElement.abs()