Class AbstractField<T extends AbstractField<T,V>,V extends Apcomplex>

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

    Constructors
    Modifier
    Constructor
    Description
    protected
    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
    Compares for equality.
    int
    Returns the hash code for this number.
    abstract T
    Returns the multiplicative inverse of this object.
    boolean
    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.
    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 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 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 GroupMultiplicative<T extends AbstractField<T,V>>
      Specified by:
      times in interface 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 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 ValueType
      Specified by:
      copy in class 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 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 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 Number<T extends AbstractField<T,V>>
      Returns:
      The value.
    • toText

      public Text toText()
      Returns the text representation of this number.
      Specified by:
      toText in interface Realtime
      Specified by:
      toText in class 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 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 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 Number<T extends AbstractField<T,V>>
      Returns:
      If the objects are equal.