Class StandardField
- java.lang.Object
-
- com.singularsys.extensions.field.implementations.StandardField
-
- All Implemented Interfaces:
FieldI
,IntegerConvertor
,java.io.Serializable
public class StandardField extends java.lang.Object implements FieldI, IntegerConvertor
A Field implementation using the default Jep methods for evaluation. So to add two elements it will use theAdd.add(Object, Object)
method of theAdd
class.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description StandardField()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
add(java.lang.Object l, java.lang.Object r)
Add two members of the field.java.lang.Boolean
and(java.lang.Object l, java.lang.Object r)
Logical and.java.lang.Object
convertFromInt(java.lang.Integer l)
Attempt to convert argument from an integerjava.lang.Integer
convertToInt(java.lang.Object l)
Attempt to convert argument to an integerjava.lang.Object
div(java.lang.Object l, java.lang.Object r)
Divides two members of the field.java.lang.Boolean
eq(java.lang.Object l, java.lang.Object r)
Equalsjava.lang.Boolean
ge(java.lang.Object l, java.lang.Object r)
Greater or equal toAdd
getAdd()
Return the PFMC used for the add operationLogical
getAnd()
Comparative
getComp()
Divide
getDiv()
Modulus
getMod()
Multiply
getMul()
Not
getNot()
java.lang.Object
getOne()
Get the multiplicative identity for this field.Logical
getOr()
Power
getPow()
Subtract
getSub()
UMinus
getUmin()
java.lang.Object
getZero()
Get the additive identity for this fieldjava.lang.Boolean
gt(java.lang.Object l, java.lang.Object r)
Greater thanjava.lang.Boolean
le(java.lang.Object l, java.lang.Object r)
Less than or equals tojava.lang.Boolean
lt(java.lang.Object l, java.lang.Object r)
Less thanjava.lang.Object
mod(java.lang.Object l, java.lang.Object r)
The modulus of two members of the field.java.lang.Object
mul(java.lang.Object l, java.lang.Object r)
Multiplies two members of the field.java.lang.Boolean
ne(java.lang.Object l, java.lang.Object r)
Not Equalsjava.lang.Object
neg(java.lang.Object l)
The negation -x of an element.java.lang.Boolean
not(java.lang.Object l)
Logical not.java.lang.Boolean
or(java.lang.Object l, java.lang.Object r)
Logical or.java.lang.Object
pow(java.lang.Object l, java.lang.Object r)
The power operator.void
setAdd(Add add)
Sets the PFMC used for add operations.void
setAnd(Logical and)
void
setComp(Comparative comp)
void
setDiv(Divide div)
void
setMod(Modulus mod)
void
setMul(Multiply mul)
void
setNot(Not not)
void
setOr(Logical or)
void
setPow(Power pow)
void
setSub(Subtract sub)
void
setUmin(UMinus umin)
java.lang.Object
sub(java.lang.Object l, java.lang.Object r)
Subtract two members of the field.
-
-
-
Method Detail
-
add
public java.lang.Object add(java.lang.Object l, java.lang.Object r) throws EvaluationException
Description copied from interface:FieldI
Add two members of the field.- Specified by:
add
in interfaceFieldI
- Parameters:
l
- left hand argumentr
- right hand argument- Returns:
- an object representing the result or null if it can not be evaluated.
- Throws:
EvaluationException
- on error
-
sub
public java.lang.Object sub(java.lang.Object l, java.lang.Object r) throws EvaluationException
Description copied from interface:FieldI
Subtract two members of the field.- Specified by:
sub
in interfaceFieldI
- Parameters:
l
- left hand argumentr
- right hand argument- Returns:
- an object representing the result or null if it can not be evaluated.
- Throws:
EvaluationException
- on error
-
neg
public java.lang.Object neg(java.lang.Object l) throws EvaluationException
Description copied from interface:FieldI
The negation -x of an element.- Specified by:
neg
in interfaceFieldI
- Parameters:
l
- the argument- Returns:
- an object representing the result or null if it can not be evaluated.
- Throws:
EvaluationException
- on error
-
mul
public java.lang.Object mul(java.lang.Object l, java.lang.Object r) throws EvaluationException
Description copied from interface:FieldI
Multiplies two members of the field.- Specified by:
mul
in interfaceFieldI
- Parameters:
l
- left hand argumentr
- right hand argument- Returns:
- an object representing the result or null if it can not be evaluated.
- Throws:
EvaluationException
- on error
-
div
public java.lang.Object div(java.lang.Object l, java.lang.Object r) throws EvaluationException
Description copied from interface:FieldI
Divides two members of the field.- Specified by:
div
in interfaceFieldI
- Parameters:
l
- left hand argumentr
- right hand argument- Returns:
- an object representing the result or null if it can not be evaluated.
- Throws:
EvaluationException
- on error
-
mod
public java.lang.Object mod(java.lang.Object l, java.lang.Object r) throws EvaluationException
Description copied from interface:FieldI
The modulus of two members of the field.- Specified by:
mod
in interfaceFieldI
- Parameters:
l
- left hand argumentr
- right hand argument- Returns:
- an object representing the result or null if it can not be evaluated.
- Throws:
EvaluationException
- on error
-
pow
public java.lang.Object pow(java.lang.Object l, java.lang.Object r) throws EvaluationException
Description copied from interface:FieldI
The power operator.- Specified by:
pow
in interfaceFieldI
- Parameters:
l
- left hand argumentr
- right hand argument- Returns:
- an object representing the result or null if it can not be evaluated.
- Throws:
EvaluationException
- on error
-
eq
public java.lang.Boolean eq(java.lang.Object l, java.lang.Object r) throws EvaluationException
Description copied from interface:FieldI
Equals- Specified by:
eq
in interfaceFieldI
- Parameters:
l
- left hand argumentr
- right hand argument- Returns:
- an object representing the result or null if it can not be evaluated.
- Throws:
EvaluationException
- on error
-
ne
public java.lang.Boolean ne(java.lang.Object l, java.lang.Object r) throws EvaluationException
Description copied from interface:FieldI
Not Equals- Specified by:
ne
in interfaceFieldI
- Parameters:
l
- left hand argumentr
- right hand argument- Returns:
- an object representing the result or null if it can not be evaluated.
- Throws:
EvaluationException
- on error
-
lt
public java.lang.Boolean lt(java.lang.Object l, java.lang.Object r) throws EvaluationException
Description copied from interface:FieldI
Less than- Specified by:
lt
in interfaceFieldI
- Parameters:
l
- left hand argumentr
- right hand argument- Returns:
- an object representing the result or null if it can not be evaluated.
- Throws:
EvaluationException
- on error
-
le
public java.lang.Boolean le(java.lang.Object l, java.lang.Object r) throws EvaluationException
Description copied from interface:FieldI
Less than or equals to- Specified by:
le
in interfaceFieldI
- Parameters:
l
- left hand argumentr
- right hand argument- Returns:
- an object representing the result or null if it can not be evaluated.
- Throws:
EvaluationException
- on error
-
gt
public java.lang.Boolean gt(java.lang.Object l, java.lang.Object r) throws EvaluationException
Description copied from interface:FieldI
Greater than- Specified by:
gt
in interfaceFieldI
- Parameters:
l
- left hand argumentr
- right hand argument- Returns:
- an object representing the result or null if it can not be evaluated.
- Throws:
EvaluationException
- on error
-
ge
public java.lang.Boolean ge(java.lang.Object l, java.lang.Object r) throws EvaluationException
Description copied from interface:FieldI
Greater or equal to- Specified by:
ge
in interfaceFieldI
- Parameters:
l
- left hand argumentr
- right hand argument- Returns:
- an object representing the result or null if it can not be evaluated.
- Throws:
EvaluationException
- on error
-
and
public java.lang.Boolean and(java.lang.Object l, java.lang.Object r) throws EvaluationException
Description copied from interface:FieldI
Logical and.- Specified by:
and
in interfaceFieldI
- Parameters:
l
- left hand argument implimentationr
- right hand argument- Returns:
- an object representing the result or null if it can not be evaluated.
- Throws:
EvaluationException
- on error
-
or
public java.lang.Boolean or(java.lang.Object l, java.lang.Object r) throws EvaluationException
Description copied from interface:FieldI
Logical or.- Specified by:
or
in interfaceFieldI
- Parameters:
l
- left hand argumentr
- right hand argument- Returns:
- an object representing the result or null if it can not be evaluated.
- Throws:
EvaluationException
- on error
-
not
public java.lang.Boolean not(java.lang.Object l) throws EvaluationException
Description copied from interface:FieldI
Logical not.- Specified by:
not
in interfaceFieldI
- Parameters:
l
- argument- Returns:
- an object representing the result or null if it can not be evaluated.
- Throws:
EvaluationException
- on error
-
getZero
public java.lang.Object getZero()
Description copied from interface:FieldI
Get the additive identity for this field
-
getOne
public java.lang.Object getOne()
Description copied from interface:FieldI
Get the multiplicative identity for this field.
-
convertToInt
public java.lang.Integer convertToInt(java.lang.Object l) throws EvaluationException
Description copied from interface:IntegerConvertor
Attempt to convert argument to an integer- Specified by:
convertToInt
in interfaceIntegerConvertor
- Parameters:
l
- value to convert- Returns:
- corresponding integer or null if it cannot be converted
- Throws:
EvaluationException
- on error
-
convertFromInt
public java.lang.Object convertFromInt(java.lang.Integer l) throws EvaluationException
Description copied from interface:IntegerConvertor
Attempt to convert argument from an integer- Specified by:
convertFromInt
in interfaceIntegerConvertor
- Parameters:
l
- value to convert- Returns:
- corresponding value in this field or null if it cannot be converted
- Throws:
EvaluationException
- probably never
-
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 theAdd.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)
-
-