public class RealType extends AbstractType
Type
when a certain part of an Expression
is a Real
when evaluated.
The following list shows, what part must be Real
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
: all entriesSymbol
: the appropriate Variable
object must not be of
Type RealType
. If the Symbol
is a constant
double value, a new Constant
object of Type RealType
will be instantiated. 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 RealType |
TYPE
A
static instance of this class. |
Modifier | Constructor and Description |
---|---|
protected |
RealType()
Creates a new
RealType instance. |
Modifier and Type | Method and Description |
---|---|
Variable |
createVariable(String name,
Object value)
Creates and returns a new
RealVariable . |
boolean |
equals(Object o)
|
Evaluator |
getEvaluator(BinaryOperation expr,
Evaluator e1,
Evaluator e2)
Returns the
Evaluator for the specified
BinaryOperation which first operand is a Real
when evaluated. |
Evaluator |
getEvaluator(List expr,
Evaluator[] e)
|
Evaluator |
getEvaluator(PredefinedFunction pf,
Evaluator paramEval)
Returns the
Evaluator for the specified
PredefinedFunction which parameter is a Real when
evaluated. |
Evaluator |
getEvaluator(Symbol expr,
Context context)
|
Evaluator |
getEvaluator(UnaryOperation expr,
Evaluator e)
|
Class |
getRepresentationClass()
Returns
Real .class . |
getEvaluator
public static final RealType TYPE
static
instance of this class. The Constructor
of this class is protected
, so you have to use
this static
field.protected RealType()
RealType
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)
RealVariable
.name
- the name of the Variable
to be created.value
- the value of the Variable
to be created.RealVariable
.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 Real
when evaluated. The returned Evaluator
must not
evaluate to a RealType
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.: Real / RealVector).BinaryOperation.getEvaluator(Type,Context)
,
RealPlusRealEvaluator
,
RealMinusRealEvaluator
,
RealTimesRealEvaluator
,
RealDivideRealEvaluator
,
RealPowerRealEvaluator
,
ComplexPlusRealEvaluator
,
RealMinusComplexEvaluator
,
ComplexTimesRealEvaluator
,
RealDivideComplexEvaluator
,
RealPowerComplexEvaluator
,
RealTimesRealVectorEvaluator
,
RealTimesComplexVectorEvaluator
public Evaluator getEvaluator(List expr, Evaluator[] e)
Evaluator
for the specified List
which all entries are Real
when evaluated. The List
represents a RealVector
in any case and the returned
Evaluator
evaluates to a RealVector
result.expr
- the List
the Evaluator
is to be returned for.e
- an array of all Evaluator
for the list
entries.RealVectorEvaluator
instanceList.getEvaluator(Type,Context)
public Evaluator getEvaluator(PredefinedFunction pf, Evaluator paramEval)
Evaluator
for the specified
PredefinedFunction
which parameter is a Real
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.PredefinedFunctionRealEvaluator
public Evaluator getEvaluator(Symbol expr, Context context)
Constant
or Variable
represented by the
specified Symbol
. If the Symbol
is a constant
value, a new Constant
object of Type RealType
will be
instantiated. The specified Context
contains the
Variable
if the Symbol
is not a
constant double value.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 Real
when evaluated. The returned Evaluator
will
evaluate to a RealType
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)
,
PositiveSignRealEvaluator
,
NegativeSignRealEvaluator