Class NumberToComplexDecorator
java.lang.Object
com.singularsys.extensions.field.implementations.FieldDecorator
com.singularsys.extensions.field.implementations.NumberToComplexDecorator
- All Implemented Interfaces:
FieldI,IntegerConvertor,Serializable
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:
-
Constructor Summary
ConstructorsConstructorDescriptionNumberToComplexDecorator(FieldI field) Constructor, does not simplify results.NumberToComplexDecorator(FieldI field, boolean simplifyResults) If simplifyResults is true, any complex result that represent a real numbers will be converted back to a double. -
Method Summary
Modifier and TypeMethodDescriptionconvertInput(Object in) Attempt to convert the input to a Field method.convertOutput(Object out) Attempt to convert the output from a Field method.
-
Constructor Details
-
NumberToComplexDecorator
Constructor, does not simplify results.- Parameters:
field- base field
-
NumberToComplexDecorator
If simplifyResults is true, any complex result that represent a real numbers will be converted back to a double.- Parameters:
field- base fieldsimplifyResults- whether to try to convert real results back to Doubles.
-
-
Method Details
-
convertInput
Description copied from class:FieldDecoratorAttempt to convert the input to a Field method.- Specified by:
convertInputin classFieldDecorator- Parameters:
in-- Returns:
- If appropriate convert
into a different type, otherwise returnin.
-
convertOutput
Description copied from class:FieldDecoratorAttempt to convert the output from a Field method.- Specified by:
convertOutputin classFieldDecorator- Parameters:
out-- Returns:
- If appropriate convert
outto a different type, otherwise returnout.
-