public static class DataAccess.DatapathElement
extends java.lang.Object
ZbnfJavaOutput
to fill from a parse result.
Therefore some methods have a special naming which matches to the semantic of the used parser script.
fnArgs
and indices
:DataAccess#access(Object, boolean, boolean)
or DataAccess#access(DatapathElement, Object, boolean, boolean, boolean, Dst)
is called.
The calculation of the arguments and indices should be done outside of the class before usage with adequate operations.
To set the results setActualArgumentArray(Object[])
or setActualArguments(Object...)
should be used.
set(String)
: Textual parsing of the path. Its capability was enhanced in 2019-06: Before, the usage of DataAccess
was usually related to the ZBNF parser and the JZtxtcmd
, which uses
the derived class DataAccess.SetDatapathElement
and the set_ident(String)
etc. from the parse result.
The other possibility, set the path immediately only from a given text, was necessary with the OutTextPreparer
and it may be proper from user level. That possibility supports only simple argument names stored in #argNames
,
String literal arguments stored immediately in fnArgs
and numeric literal indices stored in indices
Modifier and Type | Field and Description |
---|---|
private CalculatorExpr.Operand[] |
args
It is is a method call, contains the argument calculation rules.
|
protected java.lang.Object[] |
fnArgs
Deprecated.
because it is a violation of the principle that this class stores only data of construction or set, not for current access.
It is used yet (2019-08) especially in
JZtxtcmdExecuter . |
protected java.lang.String |
ident
Name of the element or method in any instance.
|
(package private) int[] |
indices
Numerical values to access elements of the given variable.
|
private boolean |
operation_
true then an operation call, false: a variable access.
|
protected char |
whatisit
Kind of element
'$': An environment variable.
|
Modifier | Constructor and Description |
---|---|
protected |
DatapathElement()
Creates an empty element.
|
|
DatapathElement(java.lang.String path)
Creates a datapath element.
|
|
DatapathElement(StringPartScan path,
java.util.Map<java.lang.String,DataAccess.IntegerIx> nameVariables,
java.lang.Class<?> reflData)
Creates a datapath element. see
set(String) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
argName(int ix)
Returns the name for the argument start variable.
|
java.lang.String |
ident() |
boolean |
isOperation() |
int |
nrArgNames() |
(package private) CalculatorExpr.Operand[] |
parseArgumentExpr(StringPartScan sArgs,
java.util.Map<java.lang.String,DataAccess.IntegerIx> nameVariables,
java.lang.Class<?> reflData)
Parses an argument String with expressions
|
void |
set_ident(java.lang.String text) |
void |
set_operation()
Invoked from
ZbnfJavaOutput or other via reflection. |
void |
set_operation(boolean val)
Invoked from
ZbnfJavaOutput or other via reflection. |
void |
set_whatisit(java.lang.String text) |
void |
set(java.lang.String path)
Creates a datapath element, for general purpose.
|
void |
set(StringPartScan path,
java.util.Map<java.lang.String,DataAccess.IntegerIx> nameVariables,
java.lang.Class<?> reflData)
Creates a datapath element, for general purpose.
|
void |
setActualArgumentArray(java.lang.Object[] args)
Adds any argument with its value.
|
void |
setActualArguments(java.lang.Object... args)
Adds any argument with its value.
|
void |
setIdent(java.lang.String ident) |
java.lang.String |
toString()
For debugging.
|
void |
writeStruct(java.lang.Appendable out) |
protected java.lang.String ident
protected char whatisit
fnArgs
fnArgs
fnArgs
.
DataAccess.Variable
with that given type using DataAccess#storeValue(List, Map, Object, boolean)
.@Deprecated protected java.lang.Object[] fnArgs
JZtxtcmdExecuter
.DataAccess.invokeMethod(DatapathElement, Class, Object, boolean, Object[], boolean)
.private CalculatorExpr.Operand[] args
CalculatorExpr.Operand.textOrVar
contains the name of the start variable if given.int[] indices
args
maybe with const values.private boolean operation_
protected DatapathElement()
public DatapathElement(java.lang.String path) throws java.text.ParseException
name
- see set(String)
java.text.ParseException
public DatapathElement(StringPartScan path, java.util.Map<java.lang.String,DataAccess.IntegerIx> nameVariables, java.lang.Class<?> reflData) throws java.text.ParseException
set(String)
path
- nameVariables
- see DataAccess.DataAccess(StringPartScan, Map, Class, char)
reflData
- see DataAccess.DataAccess(StringPartScan, Map, Class, char)
java.text.ParseException
public void set_operation(boolean val)
ZbnfJavaOutput
or other via reflection.public void set_operation()
ZbnfJavaOutput
or other via reflection.public boolean isOperation()
public int nrArgNames()
public java.lang.String argName(int ix)
DataAccess.invokeMethod(DatapathElement, Class, Object, boolean, Object[], boolean)
public void set(java.lang.String path) throws java.text.ParseException
whatisit
.
If the name contains a '(' it is a method call. Elsewhere it is the name of a field.
If it is a method call, the following rules are taken for evaluating parameters:
CalculatorExpr.setExpr(String)
.
path
- java.text.ParseException
public void set(StringPartScan path, java.util.Map<java.lang.String,DataAccess.IntegerIx> nameVariables, java.lang.Class<?> reflData) throws java.text.ParseException
whatisit
.
operation(arg, ...)
then it is marked as Operation call. The args are yet only names,
TODO it should be expression (including constants etc.).
array[indices]
the index values are parsed with CalculatorExpr#setExpr(StringPartScan)
.
Usual they are only integer literal constants, then the value is stored immediately.
path
- nameVariables
- see DataAccess.DataAccess(StringPartScan, Map, Class, char)
reflData
- see DataAccess.DataAccess(StringPartScan, Map, Class, char)
java.text.ParseException
CalculatorExpr.Operand[] parseArgumentExpr(StringPartScan sArgs, java.util.Map<java.lang.String,DataAccess.IntegerIx> nameVariables, java.lang.Class<?> reflData) throws java.text.ParseException
sArgs
- The starting "(" is parsed already, by previous check. A following ")" is not read.
It means the sArgs can contain the argument String without ().
After parsing the sArgs is set before ")" if exist, after the args.
The Syntax of any arg is determined by functionality of CalculatorExpr#CalculatorExpr(StringPartScan, Map, Class)
.nameVariables
- Map of variablesreflData
- java.text.ParseException
public void set_ident(java.lang.String text)
public void set_whatisit(java.lang.String text)
public java.lang.String ident()
public void setIdent(java.lang.String ident)
public void setActualArguments(java.lang.Object... args)
public void setActualArgumentArray(java.lang.Object[] args)
public void writeStruct(java.lang.Appendable out) throws java.io.IOException
java.io.IOException
public java.lang.String toString()
toString
in class java.lang.Object