Package org.apfloat.jscience
Class AbstractField<T extends AbstractField<T,V>,V extends org.apfloat.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>,javolution.lang.Immutable,javolution.lang.Realtime,javolution.lang.ValueType,javolution.xml.XMLSerializable,org.jscience.mathematics.structure.Field<T>,org.jscience.mathematics.structure.GroupAdditive<T>,org.jscience.mathematics.structure.GroupMultiplicative<T>,org.jscience.mathematics.structure.Ring<T>,org.jscience.mathematics.structure.Structure<T>
- Direct Known Subclasses:
ApcomplexField,ApfloatField,AprationalField,FixedPrecisionApcomplexField,FixedPrecisionApfloatField,ModuloApintField
public abstract class AbstractField<T extends AbstractField<T,V>,V extends org.apfloat.Apcomplex> extends org.jscience.mathematics.number.Number<T> implements org.jscience.mathematics.structure.Field<T>This class represents an arbitrary precision field object.- Since:
- 1.8.0
- Version:
- 1.8.0
- Author:
- Mikko Tommila
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractField(V value)Constructs a new field object with the specified value.
-
Method Summary
Modifier and Type Method Description intcompareTo(T that)Compares this number to another number.abstract Tcopy()Returns a copy of this object.doubledoubleValue()Returns the value of this number as adouble.booleanequals(Object obj)Compares for equality.inthashCode()Returns the hash code for this number.abstract Tinverse()Returns the multiplicative inverse of this object.booleanisLargerThan(T that)Compares the absolute value of this number with the absolute value of the number specified.longlongValue()Returns the value of this number as along.abstract Topposite()Returns the additive inverse of this object.abstract Tplus(T that)Returns the sum of this object with the one specified.abstract Ttimes(T that)Returns the product of this object with the one specified.javolution.text.TexttoText()Returns the text representation of this number.Vvalue()Returns the value of this number as the underlying type.
-
-
-
Constructor Detail
-
AbstractField
protected AbstractField(V value)
Constructs a new field object with the specified value.- Parameters:
value- The value.
-
-
Method Detail
-
plus
public abstract T plus(T that)
Returns the sum of this object with the one specified.- Specified by:
plusin interfaceorg.jscience.mathematics.structure.GroupAdditive<T extends AbstractField<T,V>>- Parameters:
that- The addend.- Returns:
this + that
-
opposite
public abstract T opposite()
Returns the additive inverse of this object.- Specified by:
oppositein interfaceorg.jscience.mathematics.structure.GroupAdditive<T extends AbstractField<T,V>>- Returns:
-this
-
times
public abstract T times(T that)
Returns the product of this object with the one specified.- Specified by:
timesin interfaceorg.jscience.mathematics.structure.GroupMultiplicative<T extends AbstractField<T,V>>- Specified by:
timesin interfaceorg.jscience.mathematics.structure.Ring<T extends AbstractField<T,V>>- Parameters:
that- The multiplicand.- Returns:
this * that
-
inverse
public abstract T inverse() throws ArithmeticException
Returns the multiplicative inverse of this object.- Specified by:
inversein interfaceorg.jscience.mathematics.structure.GroupMultiplicative<T extends AbstractField<T,V>>- Returns:
1 / this- Throws:
ArithmeticException- If the divisor is zero.
-
copy
public abstract T copy()
Returns a copy of this object.- Specified by:
copyin interfacejavolution.lang.ValueType- Specified by:
copyin classorg.jscience.mathematics.number.Number<T extends AbstractField<T,V>>- Returns:
- A copy of this object.
-
isLargerThan
public boolean isLargerThan(T that)
Compares the absolute value of this number with the absolute value of the number specified.- Specified by:
isLargerThanin classorg.jscience.mathematics.number.Number<T extends AbstractField<T,V>>- Parameters:
that- The number to be compared with.- Returns:
|this| > |that|
-
value
public V value()
Returns the value of this number as the underlying type.- Returns:
- The value.
-
doubleValue
public double doubleValue()
Returns the value of this number as adouble.- Specified by:
doubleValuein classorg.jscience.mathematics.number.Number<T extends AbstractField<T,V>>- Returns:
- The value.
-
longValue
public long longValue()
Returns the value of this number as along.- Specified by:
longValuein classorg.jscience.mathematics.number.Number<T extends AbstractField<T,V>>- Returns:
- The value.
-
toText
public javolution.text.Text toText()
Returns the text representation of this number.- Specified by:
toTextin interfacejavolution.lang.Realtime- Specified by:
toTextin classorg.jscience.mathematics.number.Number<T extends AbstractField<T,V>>- Returns:
- The string representation of this number as a
Text.
-
compareTo
public int compareTo(T that)
Compares this number to another number.- Specified by:
compareToin interfaceComparable<T extends AbstractField<T,V>>- Specified by:
compareToin classorg.jscience.mathematics.number.Number<T extends AbstractField<T,V>>- Parameters:
that- The number to be compared with.- Returns:
- -1, 0, or 1 depending on the ordering.
-
hashCode
public int hashCode()
Returns the hash code for this number.- Specified by:
hashCodein classorg.jscience.mathematics.number.Number<T extends AbstractField<T,V>>- Returns:
- The hash code value.
-
equals
public boolean equals(Object obj)
Compares for equality.- Specified by:
equalsin classorg.jscience.mathematics.number.Number<T extends AbstractField<T,V>>- Returns:
- If the objects are equal.
-
-