java.lang.Object
com.singularsys.extensions.field.implementations.DoubleField
All Implemented Interfaces:
FieldI, IntegerConvertor, Serializable

public final class DoubleField extends Object implements FieldI, IntegerConvertor
A double field where all input must be double and all output is double.
Author:
Richard Morris
See Also:
  • Constructor Details

    • DoubleField

      public DoubleField()
  • Method Details

    • add

      public Double add(Object l, Object r)
      Description copied from interface: FieldI
      Add two members of the field.
      Specified by:
      add in interface FieldI
      Parameters:
      l - left-hand argument
      r - right-hand argument
      Returns:
      an object representing the result or null if it can not be evaluated.
    • sub

      public Double sub(Object l, Object r)
      Description copied from interface: FieldI
      Subtract two members of the field.
      Specified by:
      sub in interface FieldI
      Parameters:
      l - left-hand argument
      r - right-hand argument
      Returns:
      an object representing the result or null if it can not be evaluated.
    • neg

      public Double neg(Object l)
      Description copied from interface: FieldI
      The negation -x of an element.
      Specified by:
      neg in interface FieldI
      Parameters:
      l - the argument
      Returns:
      an object representing the result or null if it can not be evaluated.
    • mul

      public Double mul(Object l, Object r)
      Description copied from interface: FieldI
      Multiplies two members of the field.
      Specified by:
      mul in interface FieldI
      Parameters:
      l - left-hand argument
      r - right-hand argument
      Returns:
      an object representing the result or null if it can not be evaluated.
    • div

      public Double div(Object l, Object r)
      Description copied from interface: FieldI
      Divides two members of the field.
      Specified by:
      div in interface FieldI
      Parameters:
      l - left-hand argument
      r - right-hand argument
      Returns:
      an object representing the result or null if it can not be evaluated.
    • mod

      public Double mod(Object l, Object r)
      Description copied from interface: FieldI
      The modulus of two members of the field.
      Specified by:
      mod in interface FieldI
      Parameters:
      l - left-hand argument
      r - right-hand argument
      Returns:
      an object representing the result or null if it can not be evaluated.
    • pow

      public Double pow(Object l, Object r)
      If l>=0 calls Math.pow, if l<0 (i.e. when the result would be complex) return null. Integral exponents are handled by the powI method.
      Specified by:
      pow in interface FieldI
      Parameters:
      l - left-hand argument
      r - right-hand argument
      Returns:
      an object representing the result or null if it can not be evaluated.
    • powG

      public Double powG(Double l, Double r)
    • eq

      public Boolean eq(Object l, Object r)
      Description copied from interface: FieldI
      Equals
      Specified by:
      eq in interface FieldI
      Parameters:
      l - left-hand argument
      r - right-hand argument
      Returns:
      an object representing the result or null if it can not be evaluated.
    • ne

      public Boolean ne(Object l, Object r)
      Description copied from interface: FieldI
      Not Equals
      Specified by:
      ne in interface FieldI
      Parameters:
      l - left-hand argument
      r - right-hand argument
      Returns:
      an object representing the result or null if it can not be evaluated.
    • gt

      public Boolean gt(Object l, Object r)
      Description copied from interface: FieldI
      Greater than
      Specified by:
      gt in interface FieldI
      Parameters:
      l - left-hand argument
      r - right-hand argument
      Returns:
      an object representing the result or null if it can not be evaluated.
    • ge

      public Boolean ge(Object l, Object r)
      Description copied from interface: FieldI
      Greater or equal to
      Specified by:
      ge in interface FieldI
      Parameters:
      l - left-hand argument
      r - right-hand argument
      Returns:
      an object representing the result or null if it can not be evaluated.
    • lt

      public Boolean lt(Object l, Object r)
      Description copied from interface: FieldI
      Less than
      Specified by:
      lt in interface FieldI
      Parameters:
      l - left-hand argument
      r - right-hand argument
      Returns:
      an object representing the result or null if it can not be evaluated.
    • le

      public Boolean le(Object l, Object r)
      Description copied from interface: FieldI
      Less than or equals to
      Specified by:
      le in interface FieldI
      Parameters:
      l - left-hand argument
      r - right-hand argument
      Returns:
      an object representing the result or null if it can not be evaluated.
    • and

      public Boolean and(Object l, Object r)
      Description copied from interface: FieldI
      Logical and.
      Specified by:
      and in interface FieldI
      Parameters:
      l - left-hand argument
      r - right-hand argument
      Returns:
      an object representing the result or null if it can not be evaluated.
    • or

      public Boolean or(Object l, Object r)
      Description copied from interface: FieldI
      Logical or.
      Specified by:
      or in interface FieldI
      Parameters:
      l - left-hand argument
      r - right-hand argument
      Returns:
      an object representing the result or null if it can not be evaluated.
    • not

      public Boolean not(Object l)
      Description copied from interface: FieldI
      Logical not.
      Specified by:
      not in interface FieldI
      Parameters:
      l - argument
      Returns:
      an object representing the result or null if it can not be evaluated.
    • getOne

      public Object getOne()
      Description copied from interface: FieldI
      Get the multiplicative identity for this field.
      Specified by:
      getOne in interface FieldI
      Returns:
      object representing one or null if undefined for this field
    • getZero

      public Object getZero()
      Description copied from interface: FieldI
      Get the additive identity for this field
      Specified by:
      getZero in interface FieldI
      Returns:
      object representing zero or null if undefined for this field
    • convertToInt

      public Integer convertToInt(Object l)
      Description copied from interface: IntegerConvertor
      Attempt to convert argument to an integer
      Specified by:
      convertToInt in interface IntegerConvertor
      Parameters:
      l - value to convert
      Returns:
      corresponding integer or null if it cannot be converted
    • convertFromInt

      public Object convertFromInt(Integer l)
      Description copied from interface: IntegerConvertor
      Attempt to convert argument from an integer
      Specified by:
      convertFromInt in interface IntegerConvertor
      Parameters:
      l - value to convert
      Returns:
      corresponding value in this field or null if it cannot be converted