public static class CalculatorExpr.Operand
extends java.lang.Object
CalculatorExpr.Operation
.Modifier and Type | Field and Description |
---|---|
DataAccess |
dataAccess
Set if the value uses reflection.
|
java.lang.Object |
dataConst
Set for constant data.
|
CalculatorExpr |
expr
If not null the operand is calculated with an expression itself.
|
int |
ixValue
Index of the value contained in a given array on execution, -1 if not used.
|
java.lang.String |
textOrVar
The String literal or the given sDatapath.
|
Constructor and Description |
---|
Operand(CalculatorExpr expr) |
Operand(int ixValue,
DataAccess dataAccess,
java.lang.Object dataConst,
java.lang.String textOrVar)
Constructs
|
Operand(java.lang.Object value)
Creates an operator which is a single data instance.
|
Operand(java.lang.String text)
A ValueAccess without value, only a constant text literal, especially for Text Cmd.
|
Operand(java.lang.String sDatapath,
java.util.Map<java.lang.String,DataAccess.IntegerIx> variables,
java.lang.Class<?> reflData,
java.util.Map<java.lang.String,java.lang.Object> idxConstData)
Deprecated.
it should be possible to use
Operand#Operand(StringPartScan, Map, Class) in all cases. |
Operand(StringPartScan sDatapath,
java.util.Map<java.lang.String,DataAccess.IntegerIx> variables,
java.lang.Class<?> reflData,
boolean bSpecialSyntax)
See
Operand#Operand(StringPartScan, Map, Class, Map, boolean)
but without the idxConstData |
Operand(StringPartScan sDatapath,
java.util.Map<java.lang.String,DataAccess.IntegerIx> variables,
java.lang.Class<?> reflData,
java.util.Map<java.lang.String,java.lang.Object> idxConstData,
boolean bSpecialSyntax)
See
Operand#Operand(String, Map, Class, Map) but with StringPartScan for the sDatapath |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
calc(java.util.Map<java.lang.String,DataAccess.IntegerIx> nameVariables,
java.lang.Object[] varValues)
Accesses and returns the value of this operand.
|
java.lang.String |
toString() |
public int ixValue
public final DataAccess dataAccess
public final java.lang.Object dataConst
public final java.lang.String textOrVar
public final CalculatorExpr expr
public Operand(java.lang.String text)
text
- public Operand(CalculatorExpr expr)
public Operand(int ixValue, DataAccess dataAccess, java.lang.Object dataConst, java.lang.String textOrVar)
ixValue
- -1 if no variable is useddataAccess
- maybe null, the access inside a given variable if ixValue >=0dataConst
- textOrVar
- Name of the variabe if ixValue >=0, constant text if ixValue <0public Operand(java.lang.Object value)
CalculatorExpr.Value
, for numeric values.
This is checked on evaluation of the data. Then numeric operations are possible.
But value can be any Object, evaluated often with Object.toString()
to get the string content
or also evaluated with a DataAccess expression.value
- public Operand(java.lang.String sDatapath, java.util.Map<java.lang.String,DataAccess.IntegerIx> variables, java.lang.Class<?> reflData, java.util.Map<java.lang.String,java.lang.Object> idxConstData) throws java.lang.Exception
Operand#Operand(StringPartScan, Map, Class)
in all cases.dataConst
as value of the operand. All other are null.
ixValue
, the rest describes the access operation.
expr
as expression to execute is null.
expr
. The fields dataConst
and dataAccess
remains null.
sDatapath
- textual given value. It is either a literal, a simple variable ...TODO docuvariables
- Container with some variable names associated to indices in a value array.reflData
- type wich can contain a static member with the required name in sDatapath if the name is not found in variablesidxConstData
- If this is not null, then it is first used to find dataConst
with sDatapath as key.java.lang.Exception
Operand#Operand(Object, StringPartScan, Map, Class, boolean)
public Operand(StringPartScan sDatapath, java.util.Map<java.lang.String,DataAccess.IntegerIx> variables, java.lang.Class<?> reflData, boolean bSpecialSyntax) throws java.text.ParseException
Operand#Operand(StringPartScan, Map, Class, Map, boolean)
but without the idxConstDatasDatapath
- variables
- reflData
- bSpecialSyntax
- java.text.ParseException
public Operand(StringPartScan sDatapath, java.util.Map<java.lang.String,DataAccess.IntegerIx> variables, java.lang.Class<?> reflData, java.util.Map<java.lang.String,java.lang.Object> idxConstData, boolean bSpecialSyntax) throws java.text.ParseException
Operand#Operand(String, Map, Class, Map)
but with StringPartScan
for the sDatapathsDatapath
- variables
- reflData
- idxConstData
- bSpecialSyntax
- java.text.ParseException
public java.lang.Object calc(java.util.Map<java.lang.String,DataAccess.IntegerIx> nameVariables, java.lang.Object[] varValues) throws java.lang.Exception
ixValue
. If ixValue
is <0 then either the given dataConst
or the textOrVar
is returned.nameVariables
- see DataAccess.access(List, Object, boolean, boolean, Map, Object[], boolean, org.vishia.util.DataAccess.Dst)
necessary on indirect access to variable via String, construct such as <&&(path)>varValues
- Array of possible values proper to the given ixValue
dataAccess
is given, it accesses with the given start Objectjava.lang.Exception
public java.lang.String toString()
toString
in class java.lang.Object