Class FieldDecorator
java.lang.Object
com.singularsys.extensions.field.implementations.FieldDecorator
- All Implemented Interfaces:
FieldI,IntegerConvertor,Serializable
- Direct Known Subclasses:
BigIntegerToRationalDecorator,FieldConsole.AllToComplexDecorator,FieldConsole.RationalBigDecToDoubleDecorator,FieldConsole.RationalToBigDecDecorator,IntegerToBigIntegerDecorator,NumberToComplexDecorator,NumberToDoubleDecorator
Abstract base class for Decorators used to convert the inputs and outputs of a field operation.
For instance,
it could use a widening conversion to convert Integers to Doubles. Once converted the arguments are passed to
field supplied in the constructor.
Subclasses should implement the methods
public Object convertInput(Object in) and
public Object convertOutput(Object out).
Since Jep 4.1, extensions 2.2, this class also implements IntegerConvertor.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdd two members of the field.Logical and.Attempt to convert argument from an integerabstract ObjectconvertInput(Object in) Attempt to convert the input to a Field method.abstract ObjectconvertOutput(Object out) Attempt to convert the output from a Field method.Attempt to convert argument to an integerDivides two members of the field.EqualsGreater or equal togetOne()Get the multiplicative identity for this field.getZero()Get the additive identity for this fieldGreater thanLess than or equals toLess thanThe modulus of two members of the field.Multiplies two members of the field.Not EqualsThe negation -x of an element.Logical not.Logical or.The power operator.Subtract two members of the field.
-
Constructor Details
-
FieldDecorator
- Parameters:
field- the field to be decorated
-
-
Method Details
-
convertInput
Attempt to convert the input to a Field method.- Parameters:
in-- Returns:
- If appropriate convert
into a different type, otherwise returnin. - Throws:
EvaluationException
-
convertOutput
Attempt to convert the output from a Field method.- Parameters:
out-- Returns:
- If appropriate convert
outto a different type, otherwise returnout. - Throws:
EvaluationException
-
add
Description copied from interface:FieldIAdd two members of the field.- Specified by:
addin 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
Description copied from interface:FieldIThe negation -x of an element.- Specified by:
negin interfaceFieldI- Parameters:
l- the argument- Returns:
- an object representing the result or null if it can not be evaluated.
- Throws:
EvaluationException- on error
-
sub
Description copied from interface:FieldISubtract two members of the field.- Specified by:
subin 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
-
mul
Description copied from interface:FieldIMultiplies two members of the field.- Specified by:
mulin 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
Description copied from interface:FieldIDivides two members of the field.- Specified by:
divin 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
Description copied from interface:FieldIThe modulus of two members of the field.- Specified by:
modin 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
Description copied from interface:FieldIThe power operator.- Specified by:
powin 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
Description copied from interface:FieldIEquals- Specified by:
eqin 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
Description copied from interface:FieldINot Equals- Specified by:
nein 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
Description copied from interface:FieldIGreater than- Specified by:
gtin 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
Description copied from interface:FieldIGreater or equal to- Specified by:
gein 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
Description copied from interface:FieldILess than- Specified by:
ltin 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
Description copied from interface:FieldILess than or equals to- Specified by:
lein 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
Description copied from interface:FieldILogical and.- Specified by:
andin 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
-
or
Description copied from interface:FieldILogical or.- Specified by:
orin 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
Description copied from interface:FieldILogical not.- Specified by:
notin interfaceFieldI- Parameters:
l- argument- Returns:
- an object representing the result or null if it can not be evaluated.
- Throws:
EvaluationException- on error
-
getOne
Description copied from interface:FieldIGet the multiplicative identity for this field. -
getZero
Description copied from interface:FieldIGet the additive identity for this field -
convertToInt
Description copied from interface:IntegerConvertorAttempt to convert argument to an integer- Specified by:
convertToIntin interfaceIntegerConvertor- Parameters:
l- value to convert- Returns:
- corresponding integer or null if it cannot be converted
- Throws:
EvaluationException- on error- Since:
- Jep 4.1, extensions 2.2
-
convertFromInt
Description copied from interface:IntegerConvertorAttempt to convert argument from an integer- Specified by:
convertFromIntin interfaceIntegerConvertor- Parameters:
l- value to convert- Returns:
- corresponding value in this field or null if it cannot be converted
- Throws:
EvaluationException- probably never- Since:
- Jep 4.1, extensions 2.2
-