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

public class StandardField extends Object implements FieldI, IntegerConvertor
A Field implementation using the default Jep methods for evaluation. So to add two elements it will use the Add.add(Object, Object) method of the Add class.
See Also:
  • Constructor Details

    • StandardField

      public StandardField()
  • Method Details

    • add

      public Object add(Object l, Object r) throws EvaluationException
      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.
      Throws:
      EvaluationException - on error
    • sub

      public Object sub(Object l, Object r) throws EvaluationException
      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.
      Throws:
      EvaluationException - on error
    • neg

      public Object neg(Object l) throws EvaluationException
      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.
      Throws:
      EvaluationException - on error
    • mul

      public Object mul(Object l, Object r) throws EvaluationException
      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.
      Throws:
      EvaluationException - on error
    • div

      public Object div(Object l, Object r) throws EvaluationException
      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.
      Throws:
      EvaluationException - on error
    • mod

      public Object mod(Object l, Object r) throws EvaluationException
      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.
      Throws:
      EvaluationException - on error
    • pow

      public Object pow(Object l, Object r) throws EvaluationException
      Description copied from interface: FieldI
      The power operator.
      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.
      Throws:
      EvaluationException - on error
    • eq

      public Boolean eq(Object l, Object r) throws EvaluationException
      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.
      Throws:
      EvaluationException - on error
    • ne

      public Boolean ne(Object l, Object r) throws EvaluationException
      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.
      Throws:
      EvaluationException - on error
    • lt

      public Boolean lt(Object l, Object r) throws EvaluationException
      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.
      Throws:
      EvaluationException - on error
    • le

      public Boolean le(Object l, Object r) throws EvaluationException
      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.
      Throws:
      EvaluationException - on error
    • gt

      public Boolean gt(Object l, Object r) throws EvaluationException
      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.
      Throws:
      EvaluationException - on error
    • ge

      public Boolean ge(Object l, Object r) throws EvaluationException
      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.
      Throws:
      EvaluationException - on error
    • and

      public Boolean and(Object l, Object r) throws EvaluationException
      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.
      Throws:
      EvaluationException - on error
    • or

      public Boolean or(Object l, Object r) throws EvaluationException
      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.
      Throws:
      EvaluationException - on error
    • not

      public Boolean not(Object l) throws EvaluationException
      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.
      Throws:
      EvaluationException - on error
    • 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
    • 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
    • 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
    • getAdd

      public Add getAdd()
      Return the PFMC used for the add operation
      Returns:
      function used
    • setAdd

      public void setAdd(Add add)
      Sets the PFMC used for add operations.
      Parameters:
      add - PFMC must extend the Add class and implement the Add.add(Object, Object) method.
    • getSub

      public Subtract getSub()
    • setSub

      public void setSub(Subtract sub)
    • getUmin

      public UMinus getUmin()
    • setUmin

      public void setUmin(UMinus umin)
    • getMul

      public Multiply getMul()
    • setMul

      public void setMul(Multiply mul)
    • getMod

      public Modulus getMod()
    • setMod

      public void setMod(Modulus mod)
    • getDiv

      public Divide getDiv()
    • setDiv

      public void setDiv(Divide div)
    • getPow

      public Power getPow()
    • setPow

      public void setPow(Power pow)
    • getComp

      public Comparative getComp()
    • setComp

      public void setComp(Comparative comp)
    • getAnd

      public Logical getAnd()
    • setAnd

      public void setAnd(Logical and)
    • getOr

      public Logical getOr()
    • setOr

      public void setOr(Logical or)
    • getNot

      public Not getNot()
    • setNot

      public void setNot(Not not)