Class NumberToComplexDecorator
- java.lang.Object
-
- com.singularsys.extensions.field.implementations.FieldDecorator
-
- com.singularsys.extensions.field.implementations.NumberToComplexDecorator
-
- All Implemented Interfaces:
FieldI,java.io.Serializable
public class NumberToComplexDecorator extends FieldDecorator
Convert all Number types to Complex, and optionally convert result to Doubles if possible. By default results will always be complex, but if the simplifyResults is set in the constructor real results will be converted to Doubles.- See Also:
ComplexField, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description NumberToComplexDecorator(FieldI field)NumberToComplexDecorator(FieldI field, boolean simplifyResults)If simplifyResults is true any complex results which represent real numbers will be converted back to doubles.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.ObjectconvertInput(java.lang.Object in)Attempt to convert the input to a Field method.java.lang.ObjectconvertOutput(java.lang.Object out)Attempt to convert the output from a Field method.
-
-
-
Constructor Detail
-
NumberToComplexDecorator
public NumberToComplexDecorator(FieldI field)
-
NumberToComplexDecorator
public NumberToComplexDecorator(FieldI field, boolean simplifyResults)
If simplifyResults is true any complex results which represent real numbers will be converted back to doubles.- Parameters:
field- base fieldsimplifyResults- whether to try to convert real results back to Doubles.
-
-
Method Detail
-
convertInput
public java.lang.Object convertInput(java.lang.Object in) throws EvaluationExceptionDescription copied from class:FieldDecoratorAttempt to convert the input to a Field method.- Specified by:
convertInputin classFieldDecorator- Returns:
- If appropriate convert
into a different type, otherwise returnin. - Throws:
EvaluationException
-
convertOutput
public java.lang.Object convertOutput(java.lang.Object out) throws EvaluationExceptionDescription copied from class:FieldDecoratorAttempt to convert the output from a Field method.- Specified by:
convertOutputin classFieldDecorator- Returns:
- If appropriate convert
outto a different type, otherwise returnout. - Throws:
EvaluationException
-
-