public class ComplexType extends AbstractType
Type
when a certain part of an Expression
is a Complex
when evaluated.
The following list shows, what part must be Complex
so that
TYPE
is used to get the appropriate Evaluator:BinaryOperation
: the first operandUnaryOperation
: the operand (there is only one)FunctionCall
: nothing (see AbstractType
)
List
: at least one entry while the remaining are Real
Symbol
: the appropriate Variable
object must not be of
Type ComplexType
. If the Symbol
is a constant
double value, a new Constant
object of Type ComplexType
will be instantiated. If the Symbol
is named "i", then the
Constant
Constant.I
will be returned.
In any other case, the appropriate Variable
(or
even Constant
, if "pi" or something else)
will be returned independent from its Type
.Modifier and Type | Field and Description |
---|---|
static ComplexType |
TYPE
A
static instance of this class. |
Modifier | Constructor and Description |
---|---|
protected |
ComplexType()
Creates a new
ComplexType instance. |
Modifier and Type | Method and Description |
---|---|
Variable |
createVariable(String name,
Object value)
Creates and returns a new
ComplexVariable . |
boolean |
equals(Object o)
|
Evaluator |
getEvaluator(BinaryOperation expr,
Evaluator e1,
Evaluator e2)
Returns the
Evaluator for the specified
BinaryOperation which first operand is a Complex when evaluated. |
Evaluator |
getEvaluator(List expr,
Evaluator[] e)
Returns the
Evaluator for the specified List
which all entries are either Complex or Real when
evaluated (at least one entry must be Complex ). |
Evaluator |
getEvaluator(PredefinedFunction pf,
Evaluator paramEval)
Returns the
Evaluator for the specified
PredefinedFunction which parameter is a Complex when evaluated. |
Evaluator |
getEvaluator(Symbol expr,
Context context)
|
Evaluator |
getEvaluator(UnaryOperation expr,
Evaluator e)
Returns the
Evaluator for the specified
UnaryOperation which operand is a Complex when evaluated. |
Class |
getRepresentationClass()
Returns
Complex .class . |
getEvaluator
public static final ComplexType TYPE
static
instance of this class. The Constructor
of this class is protected
, so you have to use
this static
field.protected ComplexType()
ComplexType
instance. This constructor is
protected
because you do not need to create several
instances of this class. Use the static
field TYPE
instead.public Variable createVariable(String name, Object value)
ComplexVariable
.name
- the name of the Variable
to be created.value
- the value of the Variable
to be created.ComplexVariable
.Type.createVariable(String,Object)
public boolean equals(Object o)
public Evaluator getEvaluator(BinaryOperation expr, Evaluator e1, Evaluator e2)
Evaluator
for the specified
BinaryOperation
which first operand is a Complex
when evaluated. The returned Evaluator
must not evaluate to a ComplexType
result.expr
- the BinaryOperation
the Evaluator
is to be returned for.e1
- the Evaluator
for the first operand of the
BinaryOperation
.e2
- the Evaluator
for the second operand of the
BinaryOperation
.Evaluator
for the specified BinaryOperation.UnsupportedOperationException
- if the specified
BinaryOperation
has an unknown type (see
BinaryOperation.getType()
) or a certain binary operation
is not supported (e.g.: Complex / ComplexVector).BinaryOperation.getEvaluator(Type,Context)
,
ComplexPlusRealEvaluator
,
ComplexMinusRealEvaluator
,
ComplexTimesRealEvaluator
,
ComplexDivideRealEvaluator
,
ComplexPowerRealEvaluator
,
ComplexPlusComplexEvaluator
,
ComplexMinusComplexEvaluator
,
ComplexTimesComplexEvaluator
,
ComplexDivideComplexEvaluator
,
ComplexPowerComplexEvaluator
,
ComplexTimesRealVectorEvaluator
,
ComplexTimesComplexVectorEvaluator
public Evaluator getEvaluator(List expr, Evaluator[] e)
Evaluator
for the specified List
which all entries are either Complex
or Real
when
evaluated (at least one entry must be Complex
).
The List
represents a ComplexVector
in any case
and the returned Evaluator
evaluates to a
ComplexVector
result.expr
- the List
the Evaluator
is to be returned for.e
- an array of all Evaluator
for the list
entries.ComplexVectorEvaluator
instanceList.getEvaluator(Type,Context)
public Evaluator getEvaluator(PredefinedFunction pf, Evaluator paramEval)
Evaluator
for the specified
PredefinedFunction
which parameter is a Complex
when evaluated.pf
- the PredefinedFunction
the Evaluator
is to be returned for.paramEval
- the Evaluator
for the
function's parameter.Evaluator
for the specified
PredefinedFunction
.UnsupportedOperationException
- if the specified
PredefinedFunction
is unknown.PredefinedFunctionComplexEvaluator
public Evaluator getEvaluator(Symbol expr, Context context)
Constant
or Variable
represented by the
specified Symbol
. If the Symbol
is a constant
double value, a new Constant
object of Type
ComplexType
will be instantiated. The specified Context
contains the Variable
if the Symbol
is not a
constant double value.Symbol
is named "i", then the
Constant
Constant.I
will be returned.
If the Symbol
is a mathematical constant like "pi" or "e", the
appropriate Constant
object will be returned by
Constant.getConstant(Symbol,Type)
.context
- the Context
, the Evaluator for
the Symbol
is getting from (in cases of representing a variable
and not a constant).
expr
- the Symbol
the Evaluator
is to be returned for.Evaluator
for the specified Symbol
.Symbol.isConstant()
public Evaluator getEvaluator(UnaryOperation expr, Evaluator e)
Evaluator
for the specified
UnaryOperation
which operand is a Complex
when evaluated. The returned Evaluator
will
evaluate to a ComplexType
result again.expr
- the UnaryOperation
the Evaluator
is to be returned for.e
- the Evaluator
for the operand of the
UnaryOperation
.Evaluator
for the specified
UnaryOperation
.UnsupportedOperationException
- if the specified
UnaryOperation
has an unknown type (see
UnaryOperation.getType()
).UnaryOperation.getEvaluator(Type,Context)
,
PositiveSignComplexEvaluator
,
NegativeSignComplexEvaluator
public Class getRepresentationClass()
Complex
.class
.Complex.class
.