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>, 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 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
    protected
    AbstractField​(V value)
    Constructs a new field object with the specified value.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    compareTo​(T that)
    Compares this number to another number.
    abstract T
    Returns a copy of this object.
    double
    Returns the value of this number as a double.
    boolean
    equals​(Object obj)
    Compares for equality.
    int
    Returns the hash code for this number.
    abstract T
    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 a long.
    abstract T
    Returns the additive inverse of this object.
    abstract T
    plus​(T that)
    Returns the sum of this object with the one specified.
    abstract T
    times​(T that)
    Returns the product of this object with the one specified.
    javolution.text.Text
    Returns the text representation of this number.
    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

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • AbstractField

      protected AbstractField(V value)
      Constructs a new field object with the specified value.
      Parameters:
      value - The value.
  • Method Details

    • plus

      public abstract T plus(T that)
      Returns the sum of this object with the one specified.
      Specified by:
      plus in interface org.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:
      opposite in interface org.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:
      times in interface org.jscience.mathematics.structure.GroupMultiplicative<T extends AbstractField<T,​V>>
      Specified by:
      times in interface org.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:
      inverse in interface org.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:
      copy in interface javolution.lang.ValueType
      Specified by:
      copy in class org.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:
      isLargerThan in class org.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 a double.
      Specified by:
      doubleValue in class org.jscience.mathematics.number.Number<T extends AbstractField<T,​V>>
      Returns:
      The value.
    • longValue

      public long longValue()
      Returns the value of this number as a long.
      Specified by:
      longValue in class org.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:
      toText in interface javolution.lang.Realtime
      Specified by:
      toText in class org.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:
      compareTo in interface Comparable<T extends AbstractField<T,​V>>
      Specified by:
      compareTo in class org.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:
      hashCode in class org.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:
      equals in class org.jscience.mathematics.number.Number<T extends AbstractField<T,​V>>
      Returns:
      If the objects are equal.