Package org.apfloat.jscience
Class AbstractField<T extends AbstractField<T,V>,V extends Apcomplex>
java.lang.Object
java.lang.Number
org.jscience.mathematics.number.Number<T>
org.apfloat.jscience.AbstractField<T,V>
- Type Parameters:
T
- The type of the field.V
- The type of the underlying value.
- All Implemented Interfaces:
Serializable
,Comparable<T>
,Immutable
,Realtime
,ValueType
,XMLSerializable
,Field<T>
,GroupAdditive<T>
,GroupMultiplicative<T>
,Ring<T>
,Structure<T>
- Direct Known Subclasses:
ApcomplexField
,ApfloatField
,AprationalField
,FixedPrecisionApcomplexField
,FixedPrecisionApfloatField
,ModuloApintField
public abstract class AbstractField<T extends AbstractField<T,V>,V extends Apcomplex>
extends Number<T>
implements Field<T>
This class represents an arbitrary precision field object.
- Since:
- 1.8.0
- Version:
- 1.8.0
- Author:
- Mikko Tommila
- See Also:
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractField
(V value) Constructs a new field object with the specified value. -
Method Summary
Modifier and TypeMethodDescriptionint
Compares this number to another number.abstract T
copy()
Returns a copy of this object.double
Returns the value of this number as adouble
.boolean
Compares for equality.int
hashCode()
Returns the hash code for this number.abstract T
inverse()
Returns the multiplicative inverse of this object.boolean
isLargerThan
(T that) Compares the absolute value of this number with the absolute value of the number specified.long
Returns the value of this number as along
.abstract T
opposite()
Returns the additive inverse of this object.abstract T
Returns the sum of this object with the one specified.abstract T
Returns the product of this object with the one specified.toText()
Returns the text representation of this number.value()
Returns the value of this number as the underlying type.Methods inherited from class org.jscience.mathematics.number.Number
byteValue, floatValue, intValue, isGreaterThan, isLessThan, minus, pow, shortValue, toString
-
Constructor Details
-
AbstractField
Constructs a new field object with the specified value.- Parameters:
value
- The value.
-
-
Method Details
-
plus
Returns the sum of this object with the one specified.- Specified by:
plus
in interfaceGroupAdditive<T extends AbstractField<T,
V>> - Parameters:
that
- The addend.- Returns:
this + that
-
opposite
Returns the additive inverse of this object.- Specified by:
opposite
in interfaceGroupAdditive<T extends AbstractField<T,
V>> - Returns:
-this
-
times
Returns the product of this object with the one specified.- Specified by:
times
in interfaceGroupMultiplicative<T extends AbstractField<T,
V>> - Specified by:
times
in interfaceRing<T extends AbstractField<T,
V>> - Parameters:
that
- The multiplicand.- Returns:
this * that
-
inverse
Returns the multiplicative inverse of this object.- Specified by:
inverse
in interfaceGroupMultiplicative<T extends AbstractField<T,
V>> - Returns:
1 / this
- Throws:
ArithmeticException
- If the divisor is zero.
-
copy
-
isLargerThan
Compares the absolute value of this number with the absolute value of the number specified.- Specified by:
isLargerThan
in classNumber<T extends AbstractField<T,
V>> - Parameters:
that
- The number to be compared with.- Returns:
|this| > |that|
-
value
-
doubleValue
public double doubleValue()Returns the value of this number as adouble
.- Specified by:
doubleValue
in classNumber<T extends AbstractField<T,
V>> - Returns:
- The value.
-
longValue
-
toText
-
compareTo
Compares this number to another number.- Specified by:
compareTo
in interfaceComparable<T extends AbstractField<T,
V>> - Specified by:
compareTo
in classNumber<T extends AbstractField<T,
V>> - Parameters:
that
- The number to be compared with.- Returns:
- -1, 0, or 1 depending on the ordering.
-
hashCode
-
equals
-