public final class OutTextPreparer
extends java.lang.Object
PrintStream.printf(String, Object...)
or String.format(String, Object...)
. The first ones are only for number and date formatting.
This class allows access to all Java data as placeholder values inclusively conditions and loops.
JZtxtcmd
only for text preparation of one or a few lines.
#readTemplateCreatePreparer(InputStream, String, Class, Map, String)
in the following forms (example, text file via readTemplate...():
<:otx: otxExample : data, placeholder, NEWLINE==nli > Output plain text with <&placeholder.value> <:if:data.cond>conditional output<:else>other variant<.if> <:for:var:data.container>element = <&var_key>: <&var><:if:var_next>, <.if><.for> <:wr:data.wrBuffer>Write this text with <&var> in another buffer<.wr> <:call:subtext:arg=data.var> <:exec:operation(arguments,...)> <.otx>To execute this script you should call (see
createArgumentDataObj()
and exec(Appendable, DataTextPreparer)
:
StringBuilder sb = new StringBuilder(500); // for the output text try { OutTextPreparer.DataTextPreparer args = mainOtx.createArgumentDataObj(); args.setArgument("data", myData); // The data class for access. args.setArgument("placeholder", "any test text"); args.setExecObj(myExecObj) // for <:exec...> mainOtx.exec(sb, args); // execute the outText script } catch(Exception exc) { // unexpected exceptions can be occurred, catch it! CharSequence sExc = org.vishia.util.ExcUtil.exceptionInfo("unexpected", exc, 0, 10); System.err.println(sExc); }Arguments
#readTemplateCreatePreparer(InputStream, String, Class, Map, String)
).
or also possible on start of the script as <:args:var, var2>
createArgumentDataObj()
.
One of the importants is:
exec(Appendable, DataTextPreparer)
.
That means also, it can be used concurrently in several threads.
OutTextPreparer.DataTextPreparer
which are created by call of createArgumentDataObj()
should be used in an execution thread, the data should be set due to the after called exec(Appendable, DataTextPreparer)
.
If executions of the same text pattern are executed in several threads, you can have only one reused instance
of the OutTextPreparer but several instances of OutTextPreparer.DataTextPreparer
, each for one execution thread.
You can reuse this instance with exec(Appendable, DataTextPreparer)
invocations one after another in the same thread.
OutTextPreparer.DataTextPreparer
must be matching to the OutputTextPreparer
because internally only integer numbers are used for access.
OutTextPreparer.DataTextPreparer.setArgument(String, Object)
or also OutTextPreparer.DataTextPreparer.setArgument(int, Object)
with given numeric index of the arguments).
That are your user data which can be accessed via <&arg1....>
in your pattern.
Compare it with the arguments of a printf, but with the difference that the possibilities to use the arguments
are some more powerful, not only for numbers and date.
But possibilities for number formatting are not given yet (maybe interesting, in future).
For number formatting just call your java operations.
<&
start of a data access till ... >
<:
start for controlling statements till ... >
but with:
<.
end of controling statements till ... >
<:--
this is a commented part till -->
Note changed 2024-02 before a single <:--... >
can only be commented. Now <:--... -->
is necessary for that.
<:SPECIAL TEXT>
for example <:<&>
to output a <&
itself. See next list.
<: >
skips over all white spaces till the next placeholder
<: >
second time after a <: >
stops skipping withspaces but outputs a space.
<:?nl>
skips till the next line (skips over the newline character in the script) (since 2023-05)
<:? >
skips over all white spaces till the next placeholder (since 2023-05)
<:s>
outputs a space (since 2023-05, alternatively usable to a second <: >
)
<:n>
outputs a newline as 0x0a
<:r>
outputs a newline as 0x0d
<:t>
outputs a tabulator as 0x09
<:x1234>
outputs the UTF16 character with the given hexa code, here 1234
<:CHARS> CHARS
may be any special character sequences, they will be output as given, for example:
<:<&var>>
produces the text <&var>
for generate a OutTextPreparer-Script itself.
<:<&>var>
produces the same <&var>
, other writing style.
<:<&><&var>>
produces the text <&CONTENT>
whereby CONTENT
is the content of var
.
The truth is: <:<&>
procuces the <&
.
Then <&var>
generates the content of the variable, then a simple >
follows in the text.
<&...>
and <:...>
is white space compliant.
This is a title line <:for:element:container><:?nl> <&element.data> written with an indentation <.for><: >In this script the line for data output should start with a new line, but the necessary first newline is already given after the title line. The newline after the
<:for...>
line should not be outputted.
But in the script the output line should be written as extra line.
For that the <:?nl>
skips over the next newline in the script.
Before 2023.05 the syntax was a little bit more complicated, that runs furthermore: This is a title line <:for:element:container><: > <: > <&element.data> written with an indentation <.for><: >
<&var>
: var
can be an argument variable.
Then the value is immediately gotten from the argument as set via OutTextPreparer.DataTextPreparer.setArgument(int, Object)
.
<&var>
: var
can be an field name in the 'execClass'.
TreeMap
or via indexed array access to the arguments.
<&data.element>
is a more complex access expression
then the capability of DataAccess
is used. This accesses the elements via reflection.
It means the given Class.getDeclaredFields()
, Class.getDeclaredMethods()
etc. are used
to get the data, accessed via Field
etc.
The access is completely controlled in the DataAccess
class. For usage it is simple.
<&data.operation(arg) + otherdata>
can be also a complex expression for numeric calculation,
String concatenation and boolean evaluation. This expression is executed in
with an interpreted approach.
It means the calculation needs a longer time then executed in the Java-VM per bytecode/JIT machine code.
But you can also prepare complex expressions by Java programming and call this expressions or operations.
For that the 'execClass' class can be used which may contain prepared operations for your own.
Hence you can decide writing simple expressions or also more complex as script or just as Java operations.
<>
produces the line number, which is automatically count. (since 2025-05)
<&...:%format>
an access to a number can be formatted due to the capabilities of java.util.Formatter.
For example output a value as hexadecimal presentation write <&access.to.value:%04x>
.
If formatting is not possible an error text from the thrown FormatterException is output.
<if:condition>conditional Text<elsif:condition>other Text<:else>else-Text<.if>
The condition is an expression built with the CalculatorExpr.setExpr(StringPartScan, Map, Class, boolean)
<:if:obj ?instanceof classXyz>
whereas the classXyz
can be given in the static reflection class as static variable as
public static Class> classXyz = MyClassXyz.class;
<for:var:container>text for any element <&var> with <&var_key> in loop <:if:variable_next>, <.if><.for>
Iterable
such a List
or a Map
.
Inside the statement
var
is the value of the container element,
var_key
is the key if the container is a map, else null
var_next
is the following element or null for the last element
<if:var_next>....<.if>
to detect whether there is a following element for example to output an separator.
<:wr:buffer>...<.wr>
buffer
is found via reflection data access. The String building the buffer
is used
to build a variable inside the OutTextPreparer.DataTextPreparer.args
with the index stored in nameVariables
,
where the reference to the buffer (as Appendable
) is stored for further usage.
It means if the <:wr:buffer>...<.wr>
is used on more positions in the otx with exact the same String for buffer
,
the same buffer is used immediately, only one time gotten via reflection and stored in OutTextPreparer.DataTextPreparer.args
.
<:call:otxSubScript:arg=value:arg2=value,...>
OutTextPreparer
,
either manually programmed by the constructor or as part of the whole script see #readTemplateCreatePreparer(InputStream, String, Class, Map, String)
.
<:otx: otxSubScript : arg1, arg2> Any script pattern<.end>or it should be found as static instance of a programmed OutTextPreparer in the 'execClass' given on construction:
static final OutTextPreparer otxListColors = new OutTextPreparer("otxListColors" , null //no static data on construction , "colors, text" //arguments need and used , "<&text>: <:for:color:colors><&color><:if:color_next>, <.if><.for>"); //The pattern.The association of arguments to the subscript argument variables is done on call from given values.
#readTemplateCreatePreparer(InputStream, String, Class, Map, String)
gives the possibility to have some static or non static operations to call immediately maybe related to the script.
For non static operations the necessary instance should be given in OutTextPreparer.DataTextPreparer.setExecObj(Object)
due to the execution call.
That is powerful because you can use specific parts programmed in Java in your script.
<:exec:operation(arg1, arg, ...)>
.
<&path.to.obj.operation(arg1,arg...)
but it is faster parsed and executed due to the immediately given 'execClass'
if the operation is member of this 'execClass'.
<:exec:operation(arg)>
::arg
is optional. The operation
will be searched in the given reflection class (ctor argument).
The operation is stored as Method
for usage, so this operation is fast.
The optional argument is used from given arguments of call, it should be match to the operations argument type.
If the operation is not found, an exception with a detailed error message is thrown on ctor.
If the operations argument is not proper, an exception is thrown on exec(Appendable, DataTextPreparer)
.
<&obj.operation(args ...)>
then the called operation can have any side effects as programmed.
Intrinsically it should return a String as variable text similar as <&var>
or <&path.to.var>
.
But if the operation is a void operation, or returns null, then no text is created.
This (and also side effects in String returning operations) allows change states in the underlying data
depending from the script. It is a contribution to free programming controlled by the script.
This is sometimes necessary. Hence, the script is not only a text preparer.
<&obj.operation(args ...)>
is: It can be get the OutTextPreparer.WriteDst
as argument
and writes the created text itself in its body. The buffer can be also a local one, inserted later in the main location
of generated text. It should return null if all is ok.
But if the operation has an error, it can return an error message, which is then placed in the code
maybe on the current main location.
OutTextPreparer.DataTextPreparer.setCheck(boolean)
for each script.
Modifier and Type | Class and Description |
---|---|
(package private) static class |
OutTextPreparer.Argument |
(package private) static class |
OutTextPreparer.CallCmd |
(package private) static class |
OutTextPreparer.Cmd |
(package private) static class |
OutTextPreparer.CmdString |
static class |
OutTextPreparer.DataTextPreparer
Instances of this class holds the data for one OutTextPreparer instance but maybe for all invocations.
|
(package private) static class |
OutTextPreparer.DebugCmd |
(package private) static class |
OutTextPreparer.ECmd |
(package private) static class |
OutTextPreparer.ForCmd |
(package private) static class |
OutTextPreparer.ForIxContainer
Helper class as container to produce indices for <:for:ix:[0..3]>
|
(package private) static class |
OutTextPreparer.IfCmd |
private static class |
OutTextPreparer.ParseHelper
internal class to organize data for parsing.
|
(package private) static class |
OutTextPreparer.SetCmd |
(package private) static class |
OutTextPreparer.TypeCmd
A cmd for a type check of an instance.
|
(package private) static class |
OutTextPreparer.ValueCmd
A cmd for a value can contain a format string.
|
(package private) static class |
OutTextPreparer.WrCmd
<:wr:...>....
|
static class |
OutTextPreparer.WriteDst
This class is used to write out the generated text.
|
Modifier and Type | Field and Description |
---|---|
(package private) java.util.List<OutTextPreparer.Cmd> |
cmds |
(package private) int |
ctCall |
static java.util.Map<java.lang.String,java.lang.Object> |
idxConstDataDefault |
(package private) int |
ixOUT
Index of the OUT element in variables
|
(package private) int |
ixVarLineoutStart |
protected java.util.List<java.lang.String> |
listArgs
Via script given arguments for the outText.
|
protected java.util.Map<java.lang.String,DataAccess.IntegerIx> |
nameVariables
All argument variables and internal variables sorted.
|
(package private) int |
nLineoutStart |
(package private) int |
nrLineStartInFile |
java.lang.String |
pattern
The source of the generation script, argument of
#parse(Class, String) only for debug. |
java.lang.String |
sIdent
Name of the generation script used for debug and comparison with data.
|
(package private) java.lang.String |
sLineoutStart
If not null then this is the start String of an line for output,
set if "NEWLINE===" is given in arguments.
|
static java.lang.String |
version
Version, history and license.
|
Modifier | Constructor and Description |
---|---|
|
OutTextPreparer(java.lang.String ident,
java.lang.Class<?> execClass,
java.util.List<java.lang.String> variables,
java.lang.String pattern)
Constructs completely the text generation control instance for the specific pattern and given sub pattern.
|
|
OutTextPreparer(java.lang.String ident,
java.lang.Class<?> execClass,
java.lang.String pattern)
Constructs completely the text generation control instance for the specific pattern and given sub pattern.
|
|
OutTextPreparer(java.lang.String ident,
java.lang.Class<?> execClass,
java.lang.String variables,
java.lang.String pattern)
Constructs completely the text generation control instance for the specific pattern and given sub pattern.
|
|
OutTextPreparer(java.lang.String ident,
java.lang.Class<?> execClass,
java.lang.String variables,
java.lang.String pattern,
java.util.Map<java.lang.String,java.lang.Object> idxConstData)
Constructs completely the text generation control instance for the specific pattern and given sub pattern.
|
private |
OutTextPreparer(java.lang.String ident,
java.lang.Class<?> execClass,
java.lang.String variables,
java.lang.String pattern,
java.util.Map<java.lang.String,java.lang.Object> idxConstData,
java.util.Map<java.lang.String,OutTextPreparer> idxScript)
Deprecated.
|
|
OutTextPreparer(java.lang.String ident,
java.util.List<java.lang.String> variables,
java.lang.String pattern)
Creates the text generation control data for the specific pattern and given sub pattern
without parsing.
|
|
OutTextPreparer(java.lang.String ident,
java.lang.String pattern)
Constructs completely the text generation control instance for the specific pattern.
|
|
OutTextPreparer(java.lang.String ident,
java.lang.String variables,
java.lang.String pattern)
Creates the text generation control data for the specific pattern and given sub pattern
without parsing.
|
|
OutTextPreparer(java.lang.String ident,
java.lang.String variables,
java.lang.String pattern,
int nrLineStartInFile)
Creates the text generation control data for the specific pattern and given sub pattern
read from a file or other input stream, without parsing.
|
Modifier and Type | Method and Description |
---|---|
OutTextPreparer.DataTextPreparer |
createArgumentDataObj()
Returns an proper instance for argument data for a
exec(Appendable, DataTextPreparer) run. |
private java.lang.Object |
dataForCmd(OutTextPreparer.Cmd cmd,
OutTextPreparer.DataTextPreparer args,
OutTextPreparer.WriteDst wrCt) |
(package private) void |
debug() |
void |
exec(java.lang.Appendable wr,
OutTextPreparer.DataTextPreparer args)
Compatible variant see
execLineCt(WriteDst, DataTextPreparer)
It is for compatibility and simplifies usage. |
private void |
execCall(OutTextPreparer.WriteDst wrCt,
OutTextPreparer.CallCmd cmd,
OutTextPreparer.DataTextPreparer args,
OutTextPreparer callVar)
Executes a call
|
private java.lang.Object |
execDataAccess(java.lang.Appendable wr,
OutTextPreparer.Cmd cmd,
OutTextPreparer.DataTextPreparer args)
Accesses the data
|
private void |
execFor(OutTextPreparer.WriteDst wrCt,
OutTextPreparer.ForCmd cmd,
int ixCmd,
java.lang.Object container,
OutTextPreparer.DataTextPreparer args)
Executes a for loop
|
private int |
execIf(OutTextPreparer.WriteDst wrCt,
OutTextPreparer.IfCmd ifcmd,
int ixCmd,
java.lang.Object data,
OutTextPreparer.DataTextPreparer args)
Executes a if branch
|
void |
execLineCt(OutTextPreparer.WriteDst wrCt,
OutTextPreparer.DataTextPreparer args)
Executes preparation of a pattern with given data.
|
private void |
execSub(OutTextPreparer.WriteDst wdArg,
OutTextPreparer.DataTextPreparer args,
int ixStart,
int ixEndExcl)
Executes preparation for a range of cmd for internal control structures
|
private void |
execSubFor(OutTextPreparer.WriteDst wdArg,
OutTextPreparer.DataTextPreparer args,
OutTextPreparer.ForCmd cmd,
int ixStart,
int ixEndExcl)
Executes preparation for a for cmd for internal control structures
complete the names of the for variables, only used for debug
|
OutTextPreparer.DataTextPreparer |
getArgumentData(java.lang.Object execInstance)
Creates the argument data and presets the given execInstance to
OutTextPreparer.DataTextPreparer.setExecObj(Object) |
void |
parse(java.lang.Class<?> execClass,
java.util.Map<java.lang.String,java.lang.Object> idxConstDataArg,
java.util.Map<java.lang.String,OutTextPreparer> idxScript)
Parse the pattern.
|
static void |
parseTemplates(java.util.Map<java.lang.String,OutTextPreparer> idxScript,
java.lang.Class<?> execClass,
java.util.Map<java.lang.String,java.lang.Object> idxConstData,
LogMessage log)
Parse all templates which are read with
#readTemplateCreatePreparer(InputStream, String, Map) . |
private void |
parseVariables(java.lang.String variables)
Sets all variables from string, detects 'NEWLINE'.
|
static void |
readStreamTemplateCreatePreparer(java.io.InputStream inp,
java.lang.String lineStart,
java.util.Map<java.lang.String,OutTextPreparer> idxScript,
java.lang.Object dataRoot,
java.util.Map<java.lang.String,java.lang.Object> idxConstData)
Recommended operation to read one template script and create all
OutTextPreparer instances but does not parse. |
private static void |
readStreamTemplateCreatePreparer(java.util.Map<java.lang.String,OutTextPreparer> idxScript,
java.util.List<java.lang.String> ret,
java.io.InputStream inp,
java.lang.String lineStart,
java.lang.Object dataRoot,
java.util.Map<java.lang.String,java.lang.Object> idxConstData)
Inner operation only separated because oder approach with ret argument.
|
static void |
readTemplateCreatePreparer(java.lang.Class<?> classInJar,
java.lang.String path,
java.util.Map<java.lang.String,OutTextPreparer> idxScript,
java.lang.Object dataRoot,
java.util.Map<java.lang.String,java.lang.Object> idxConstData)
Recommended operation to read one template script and create all
OutTextPreparer instances but does not parse. |
static java.util.List<java.lang.String> |
readTemplateList(java.io.InputStream inp,
java.lang.String lineStart,
java.lang.Object dataRoot,
java.util.Map<java.lang.String,java.lang.Object> idxConstData)
Reads a given template which may contain the pattern for some associated OutTextPreparer srcipts (parts of the template).
|
private void |
setVariables(java.util.List<java.lang.String> listArgs)
Sets all variables from list, but at last "OUT", "CMD" and "OTX".
|
java.lang.String |
toString() |
static void |
XXXreadStreamTemplateCreatePreparer(java.io.InputStream inp,
java.lang.String lineStart,
java.util.Map<java.lang.String,OutTextPreparer> idxScript,
java.lang.Object dataRoot,
java.util.Map<java.lang.String,java.lang.Object> idxConstData)
Deprecated.
remove it, use
#readStreamTemplateCreatePreparerNew(InputStream, String, Map, Object, Map) |
static java.util.Map<java.lang.String,java.lang.String> |
XXXreadTemplate(java.io.InputStream inp,
java.lang.String lineStart)
Deprecated.
use
#readTemplateCreatePreparer(InputStream, String, Class, Map, String) for all. |
static java.util.Map<java.lang.String,OutTextPreparer> |
XXXreadTemplateCreatePreparer(java.io.InputStream inp,
java.lang.Class<?> execClass)
Deprecated.
use
#readTemplateCreatePreparer(InputStream, String, Map) . |
static java.util.Map<java.lang.String,OutTextPreparer> |
XXXreadTemplateCreatePreparer(java.io.InputStream inp,
java.lang.Class<?> execClass,
java.util.Map<java.lang.String,java.lang.Object> idxConstData)
Deprecated.
use
#readTemplateCreatePreparer(InputStream, String, Map) . |
static java.util.Map<java.lang.String,OutTextPreparer> |
XXXreadTemplateCreatePreparer(java.io.InputStream inp,
java.util.Map<java.lang.String,java.lang.Object> idxConstData)
Deprecated.
use
#readTemplateCreatePreparer(InputStream, String, Map) . |
static OutTextPreparer |
XXXreadTemplateCreatePreparer(java.io.InputStream inp,
java.lang.String lineStart,
java.lang.Class<?> execClass,
java.util.Map<java.lang.String,java.lang.Object> idxConstData,
java.lang.String sMainScript)
Deprecated.
use
#readTemplateCreatePreparer(InputStream, String, Map) . |
private static void |
XXXreadTemplateCreatePreparerPriv(java.io.InputStream inp,
java.lang.String lineStart,
java.lang.Class<?> execClass,
java.util.Map<java.lang.String,java.lang.Object> idxConstData,
java.util.Map<java.lang.String,OutTextPreparer> idxScript)
Deprecated.
use
#readTemplateCreatePreparer(InputStream, String, Map) . |
static void |
XXXwriteOtx(java.io.File fout,
java.lang.Object data,
java.io.InputStream inTpl,
java.lang.Class<?> execClass,
java.lang.String sMain)
Deprecated.
|
public static final java.lang.String version
OutTextPreparer.ForCmd
also an integer index can be used as var if container is an Integer.
For that in #addCmd(String, int, int, ECmd, String, Class, Map, Map)
in case forCmd (called in parse(Class, Map, Map)
it is tested whether "0.." is written.
But the real important effect is, the argument container returns an Integer. This is evaluated in #execFor(Appendable, ForCmd, int, Object, DataTextPreparer)
.
The solution runs yet with integer index starting from 0. The solution should be a little bit improved:
TODO either it is necessary to have a start index other than 0, ore superfluous statements should be removed.
OutTextPreparer.DataTextPreparer.setArgumentOptional(String, Object)
OutTextPreparer.ForCmd.ixEntryKey
, #execFor(Appendable, ForCmd, int, Object, DataTextPreparer)
:
Now the <:for:var.... creates also a var_key for the key value.
DataTextPreparer#DataTextPreparer(OutTextPreparer)
: now checks whether the OutTextPreparer is initialized,
prevent construction (thows) if not. This is if cmds
are empty.
This prevents faulty instances if the OutTextPreparer.DataTextPreparer
is built to early, with a non initialized OutTextPreparer
.
readTemplateList(InputStream, String, Object, Map)
.
readTemplateCreatePreparer(Class, String, Map, Object, Map)
replaces the older form without Class,
but readStreamTemplateCreatePreparer(InputStream, String, Map, Object, Map)
is also available.
The argument String lineStart is no more supported from the newer form.
All deprecated operations XXXreadTemplate(InputStream, String)
etc. are marked with XXX, can but should not be used.
#execSub(Appendable, DataTextPreparer, int, int)
:
The arguments are not prepared firstly, instead as argument of the cmd. This is very more better for debugging.
For that a subroutine #dataForCmd(Cmd, DataTextPreparer, Appendable)
was created.
<:type:vaue:classPath>
,
able to switch off with OutTextPreparer.DataTextPreparer.setCheck(boolean)
#readTemplateCreatePreparer(InputStream, String, Map, Object, Map)
and readTemplateList(InputStream, String, Object, Map)
:
more arguments dataRoot, idxConstData, for compatibility provide null for both.
With this on template level outside of scripts <:set:name=value>
is supported now for constant data.
#parseExec(String, int, int, StringPartScanLineCol, Class, Map, Map)
:
Changed behavior for <:exec:...> using the capability of DataAccess.DataAccess(StringPartScan, Map, Class, char)
and then DataAccess.access(org.vishia.util.DataAccess.DatapathElement, Object, boolean, boolean, Map, Object[], boolean, org.vishia.util.DataAccess.Dst)
for execution. This supports more as one argument. Before, <:exec:name(arg,...)> has only supported one element.
Syntax change: No colon after operation name, instead operation(args , ...)
OutTextPreparer.DataTextPreparer.args
.
For that ixOUT
is stored as whose index in that array args.
The writer reference is stored automatically for each level in the associated data on start of #execSub(Appendable, DataTextPreparer, int, int)
.
It can be used to recursively generate outputs in Java operations called via %lt;:exec:...>.
OutTextPreparer(String, String, String)
does not parse.
After definition of all otx call parse(Class, Map, Map)
to parse.
This is not implemented on the other ctor, they are held compatible.
#execCall(Appendable, CallCmd, DataTextPreparer, OutTextPreparer)
:
bugfix for <:exec:...> in deeper <:call:...> level, the exec instance is given now.
#idxScript
, new #readTemplateCreatePreparer(InputStream, Class, Map)
.
#addCmdSimpleVar(String, int, int, ECmd, String, Class)
.
This allows now also using the 'idxConstValues' for const texts.
#execClass
instead 'clazzPattern'
#readTemplateCreatePreparer(InputStream, String, Class, Map, String)
now works completely with a String file given script.
#readTemplate(InputStream, String)
to support texts from file. Used firstly for org.vishia.java2Vhdl.Java2Vhdl
This is 2023-05-12 deprecated because #readTemplateCreatePreparer(InputStream, String, Class, Map, String)
does all and replaces it.
CalculatorExpr.Operand#Operand(StringPartScan, Map, Class, boolean)
yet not complete.
public static final java.util.Map<java.lang.String,java.lang.Object> idxConstDataDefault
protected java.util.Map<java.lang.String,DataAccess.IntegerIx> nameVariables
int ixOUT
public final java.lang.String pattern
#parse(Class, String)
only for debug.java.lang.String sLineoutStart
int nLineoutStart
int nrLineStartInFile
int ixVarLineoutStart
protected java.util.List<java.lang.String> listArgs
int ctCall
java.util.List<OutTextPreparer.Cmd> cmds
public final java.lang.String sIdent
public OutTextPreparer(java.lang.String ident, java.lang.Class<?> execClass, java.lang.String pattern)
ident
- execClass
- pattern
- java.lang.IllegalArgumentException
- if the pattern is faulty.
This exception do not need to be caught immediately on the calling level, do not spend effort.
Because the pattern should be given error-free, it is hard programmed.
If the pattern has an error then the application throws on higher level if the calling level class is instantiated,
and should be fixed in programming.
Note: On some faulty pattern the prepared cmd for output contains the error message.public OutTextPreparer(java.lang.String ident, java.lang.String pattern)
ident
- name of otxpattern
- Only a simple pattern without <:call...> or <:exec...>, the ctor parses it.java.lang.IllegalArgumentException
- if the pattern is faulty.
This exception do not need to be caught immediately on the calling level, do not spend effort.
Because the pattern should be given error-free, it is hard programmed.
If the pattern has an error then the application throws on higher level if the calling level class is instantiated,
and should be fixed in programming.
Note: On some faulty pattern the prepared cmd for output contains the error message.public OutTextPreparer(java.lang.String ident, java.lang.Class<?> execClass, java.lang.String variables, java.lang.String pattern)
ident
- Any identification not used for the generated text.execClass
- If the access via reflection should be done, null possiblevariables
- One variable or list of identifier separated with comma, whiteSpaces possible.pattern
- The pattern in string given form.
This pattern will be parsed and divided in parts for a fast text generation.java.lang.IllegalArgumentException
- if the pattern is faulty.
This exception do not need to be caught immediately on the calling level, do not spend effort.
Because the pattern should be given error-free, it is hard programmed.
If the pattern has an error then the application throws on higher level if the calling level class is instantiated,
and should be fixed in programming.
Note: On some faulty pattern the prepared cmd for output contains the error message.@Deprecated private OutTextPreparer(java.lang.String ident, java.lang.Class<?> execClass, java.lang.String variables, java.lang.String pattern, java.util.Map<java.lang.String,java.lang.Object> idxConstData, java.util.Map<java.lang.String,OutTextPreparer> idxScript)
#readTemplateCreatePreparer(InputStream, Class, Map)
ident
- Name of the sub pattern, used for error outputs.execClass
- If the access via reflection should be done, null possiblevariables
- One variable or list of identifier separated with comma, whiteSpaces possible.pattern
- The pattern in string given form.
This pattern will be parsed and divided in parts for a fast text generation.idxConstData
- Container for call able scripts, maybe contain all scripts, also for more const datajava.text.ParseException
java.lang.IllegalArgumentException
- if the pattern is faulty.
This exception do not need to be caught immediately on the calling level, do not spend effort.
Because the pattern should be given error-free, it is hard programmed.
If the pattern has an error then the application throws on higher level if the calling level class is instantiated,
and should be fixed in programming.
Note: On some faulty pattern the prepared cmd for output contains the error message.public OutTextPreparer(java.lang.String ident, java.lang.String variables, java.lang.String pattern, int nrLineStartInFile)
#readTemplateCreatePreparer(InputStream, String, Map)
.
Afterwards #parse(Class, Map)
have to be called as second phase for translate the scripts.
#readTemplateCreatePreparer(InputStream, String, Map)
, the principle is used there.ident
- Name of the sub pattern, used for error outputs.variables
- One variable or list of identifier separated with comma, whiteSpaces possible.pattern
- The pattern in string given form.
This pattern will be parsed and divided in parts for a fast text generation.nrLineStartInFile
- line number where the pattern starts in a file, maybe 0.never.
public OutTextPreparer(java.lang.String ident, java.lang.String variables, java.lang.String pattern)
#parse(Class, Map)
have to be called as second phase for translate the scripts.
#readTemplateCreatePreparer(InputStream, String, Map)
, the principle is used there.
private OutTextPreparer otxNode = new OutTextPreparer("exampleNode", "arg", "pattern of the script" + "<:if:arg><&arg>... in more lines <.if>" ); //..... MapidxScript = new TreeMap<>(); idxScript.put(this.otxNode.sIdent, this.otxNode); idxScript.put(this.otxCfgHead.sIdent, this.otxCfgHead); try { OutTextPreparer.parseTemplates(idxScript, this.getClass(), null, log); ,,,,
ident
- Name of the sub pattern, used for error outputs.variables
- One variable or list of identifier separated with comma, whiteSpaces possible.pattern
- The pattern in string given form.
This pattern will be parsed and divided in parts for a fast text generation.never.
public OutTextPreparer(java.lang.String ident, java.util.List<java.lang.String> variables, java.lang.String pattern)
#parse(Class, Map)
have to be called as second phase for translate the scripts
which can all use the definitons.
See also #readTemplateCreatePreparer(InputStream, Class, Map)
, the principle is used there.ident
- Name of the sub pattern, used for error outputs.variables
- List of variable.pattern
- The pattern in string given form.
This pattern will be parsed and divided in parts for a fast text generation.idxConstData
- Container for call able scripts, maybe contain all scripts, also for more const datanever.
public OutTextPreparer(java.lang.String ident, java.lang.Class<?> execClass, java.lang.String variables, java.lang.String pattern, java.util.Map<java.lang.String,java.lang.Object> idxConstData)
static OutTextPreparer otxMyText = new OutTextPreparer ( "otxMyText" // The name of the OutText usable for call , UserClass.class // A class which's static operations and data can be used , "arg1, arg2", // Name of arguments, see text below "A simple text with newline: \n" // The output text pattern + "<&arg1>: a variable value" + "<&arg1.operation(arg2)>: Invocation of any operation in arguments resulting in an text" + "<:call:otxSubText:arg1:arg2:...>: call of any sub text maybe with args" + "<:exec:operation(arg1, arg2, ....)> : call of any static operation in the given reflection class maybe with args" ;
ident
- Any identification not used for the generated text.execClass
- If the access via reflection should be done, null possiblevariables
- One variable or list of identifier separated with comma, whiteSpaces possible.pattern
- The pattern in string given form.
This pattern will be parsed and divided in parts for a fast text generation.idxConstData
- Container for call able scripts, maybe contain all scripts, also for more const datajava.text.ParseException
java.lang.IllegalArgumentException
- if the pattern is faulty.
This exception do not need to be caught immediately on the calling level, do not spend effort.
Because the pattern should be given error-free, it is hard programmed.
If the pattern has an error then the application throws on higher level if the calling level class is instantiated,
and should be fixed in programming.
Note: On some faulty pattern the prepared cmd for output contains the error message.public OutTextPreparer(java.lang.String ident, java.lang.Class<?> execClass, java.util.List<java.lang.String> variables, java.lang.String pattern)
variables
- Identifier given as list, parsing is not necessary.
Able to use if the variable idents are anyway given in a list.java.lang.IllegalArgumentException
- if the pattern is faulty.
This exception do not need to be caught immediately on the calling level, do not spend effort.
Because the pattern should be given error-free, it is hard programmed.
If the pattern has an error then the application throws on higher level if the calling level class is instantiated,
and should be fixed in programming.
Note: On some faulty pattern the prepared cmd for output contains the error message.public static void readTemplateCreatePreparer(java.lang.Class<?> classInJar, java.lang.String path, java.util.Map<java.lang.String,OutTextPreparer> idxScript, java.lang.Object dataRoot, java.util.Map<java.lang.String,java.lang.Object> idxConstData) throws java.io.IOException, java.text.ParseException
OutTextPreparer
instances but does not parse.
To parse all read scripts call parseTemplates(Map, Class, Map, LogMessage)
afterwards.
This assures that all sub scripts in all templates can be <:call...> independent of the definition order.classInJar
- null or a Class in the jar as start point of pathpath
- if classInJar is given, the relative path from classInJar to read a file from jar using Class.getResourceAsStream(String)
.
If this file is not available, a FileNotFoundException is thrown: Note: Class.getResourceAsStream(String)
does not throw by itself.
If classInJar==null this is a path in the file system to use this file. Both variants are supported.idxScript
- container where the read scripts are stored, sorted by its name <:otx:NAME:...>
The scripts are created, the text is referred via pattern
but the script is not parsed yet.
Later parsing allows that a script can be <:call:...> which is defined after the calling script.dataRoot
- null admissible, possibility to set values from there in <:set:name=&value>
idxConstData
- necessary if <:set:name=value>
is used.
null admissible if the inp does not contain <:set:name=&value>
outside of scriptsjava.io.IOException
- general possible on reading inpjava.text.ParseException
- if the inp has syntax errorspublic static void readStreamTemplateCreatePreparer(java.io.InputStream inp, java.lang.String lineStart, java.util.Map<java.lang.String,OutTextPreparer> idxScript, java.lang.Object dataRoot, java.util.Map<java.lang.String,java.lang.Object> idxConstData) throws java.io.IOException, java.text.ParseException
OutTextPreparer
instances but does not parse.
To parse all read scripts call parseTemplates(Map, Class, Map, LogMessage)
afterwards.
This assures that all sub scripts in all templates can be <:call...> independent of the definition order.inp
- opened input stream, maybe also a file in jar, see readTemplateCreatePreparer(Class, String, Map, Object, Map)
lineStart
- idxScript
- container where the read scripts are stored, sorted by its name <:otx:NAME:...>
The scripts are created, the text is referred via pattern
but the script is not parsed yet.
Later parsing allows that a script can be <:call:...> which is defined after the calling script.dataRoot
- null admissible, possibility to set values from there in <:set:name=&value>
idxConstData
- necessary if <:set:name=value>
is used.
null admissible if the inp does not contain <:set:name=&value>
outside of scriptsjava.io.IOException
- general possible on reading inpjava.text.ParseException
- on error on a '<:set:... ' line or also formal error on a '<:otx:...' line.
It does not parse the script here, inner parse errors in the script are not detected here,
see parseTemplates(Map, Class, Map, LogMessage)
public static java.util.List<java.lang.String> readTemplateList(java.io.InputStream inp, java.lang.String lineStart, java.lang.Object dataRoot, java.util.Map<java.lang.String,java.lang.Object> idxConstData) throws java.io.IOException, java.text.ParseException
inp
- lineStart
- null for newer versions if all scripts starts with <:otx:, elsewhere the designation of a new script.
Then the arguments should be written after the lineStart string in "(arg, ...)"dataRoot
- null or can be used for access <:set:name=&element> inside dataRoot, the current value in element will be stored with name.idxConstData
- necessary as destination if the script contains <:set:name=value>, elsewhere can be nulljava.io.IOException
java.text.ParseException
#readTemplateCreatePreparer(InputStream, String, Class)
<:otx: patternName : variable : var2 > ##comment content with <&ariables> ##comment more lines<.otx> free text between pattern <:otx: nextPatternName ... etc., 2024-01-15 more arguments dataRoot, idxConstData, for compatibility provide null for both.
private static void readStreamTemplateCreatePreparer(java.util.Map<java.lang.String,OutTextPreparer> idxScript, java.util.List<java.lang.String> ret, java.io.InputStream inp, java.lang.String lineStart, java.lang.Object dataRoot, java.util.Map<java.lang.String,java.lang.Object> idxConstData) throws java.io.IOException, java.text.ParseException
inp
- lineStart
- null for newer versions if all scripts starts with <:otx:, elsewhere the designation of a new script.
Then the arguments should be written after the lineStart string in "(arg, ...)"dataRoot
- null or can be used for access <:set:name=&element> inside dataRoot, the current value in element will be stored with name.idxConstData
- necessary as destination if the script contains <:set:name=value>, elsewhere can be nulljava.io.IOException
java.text.ParseException
#readTemplateCreatePreparer(InputStream, String, Class)
<:otx: patternName : variable : var2 > ##comment content with <&ariables> ##comment more lines<.otx> free text between pattern <:otx: nextPatternName ... etc., 2024-01-15 more arguments dataRoot, idxConstData, for compatibility provide null for both.
public static void parseTemplates(java.util.Map<java.lang.String,OutTextPreparer> idxScript, java.lang.Class<?> execClass, java.util.Map<java.lang.String,java.lang.Object> idxConstData, LogMessage log) throws java.text.ParseException
#readTemplateCreatePreparer(InputStream, String, Map)
.
It calls parse(Class, Map, Map)
for all sub scripts stored in idxScript.idxScript
- the index of the sub scripts, filled. Used to parse for all, also used for <:call:...>execClass
- May be null, from this class some operations or data or also hard coded OutTextPreparer
instances can be gotten.
Static operations can be called and static data can be accessed. Instance operations and data can be accessed
if OutTextPreparer.DataTextPreparer.setExecObj(Object)
is set with the proper instance.idxConstData
- May be null, from this index some constant data and also sub scripts can be gotten.java.text.ParseException
@Deprecated public static java.util.Map<java.lang.String,java.lang.String> XXXreadTemplate(java.io.InputStream inp, java.lang.String lineStart) throws java.io.IOException
#readTemplateCreatePreparer(InputStream, String, Class, Map, String)
for all.#readTemplateList(InputStream, String)
=== patternName content <&withVariables> more lines === nextPatternName etc.With this template Strings several OutTextPreparer can be created due to the schema (Example for Java2Vhdl)
InputStream inTpl = Java2Vhdl.class.getResourceAsStream("VhdlTemplate.txt"); //pathInJar with slash: from root. MaptplTexts = OutTextPreparer.readTemplate(inTpl, "==="); inTpl.close(); this.vhdlHead = new OutTextPreparer("vhdlHead", null, "fpgaName", tplTexts.get("vhdlHead")); this.vhdlAfterPort = new OutTextPreparer("vhdlAfterPort", null, "fpgaName", tplTexts.get("vhdlAfterPort")); this.vhdlConst = new OutTextPreparer("vhdlConst", null, "name, type, value", tplTexts.get("vhdlConst")); this.vhdlCmpnDef = new OutTextPreparer("vhdlCmpnDef", null, "name, vars", tplTexts.get("vhdlCmpnDef")); this.vhdlCmpnCall = new OutTextPreparer("vhdlCmpnCall", null, "name, typeVhdl, preAssignments, vars", tplTexts.get("vhdlCmpnCall"));
inp
- The open input to read, can also a resource in jar, then use Class.getResourceAsStream(String)
to openlineStart
- String which marks a new pattern segment, for the exmaple it should be "=== "java.io.IOException
@Deprecated public static OutTextPreparer XXXreadTemplateCreatePreparer(java.io.InputStream inp, java.lang.String lineStart, java.lang.Class<?> execClass, java.util.Map<java.lang.String,java.lang.Object> idxConstData, java.lang.String sMainScript) throws java.io.IOException, java.text.ParseException
#readTemplateCreatePreparer(InputStream, String, Map)
.inp
- An opened input stream, which can be for example also part of a zip file content
or gotten via Class.getResourceAsStream(String)
from a jar file,
or also of course via FileReader.FileReader(java.io.File)
or via InputStreamReader.InputStreamReader(InputStream, String)
to read a file with specific encoding.lineStart
- The pattern which marks the start of a output text. It was "===" in examples, now deprecated.execClass
- a given class which's content is accessed as persistent data.idxConstData
- An index to access const persistent data,
and also to store all created OutTextPreparer instances. This is important for <:call:otx...>sMainScript
- name of the main script to return, or null.java.io.IOException
- on file errorjava.text.ParseException
- on parsing error of the script.<:otx: patternName : variable : variable2 > ##comment content with <&variables> ##comment more lines<.otx> free text between pattern <:otx: nextPatternName :args> <:call:patternName:variables = args> --- more text <.otx> etc.
@Deprecated private static void XXXreadTemplateCreatePreparerPriv(java.io.InputStream inp, java.lang.String lineStart, java.lang.Class<?> execClass, java.util.Map<java.lang.String,java.lang.Object> idxConstData, java.util.Map<java.lang.String,OutTextPreparer> idxScript) throws java.io.IOException, java.text.ParseException
#readTemplateCreatePreparer(InputStream, String, Map)
.#readTemplateCreatePreparer(InputStream, String, Map)
.
see #readTemplateCreatePreparer(InputStream, Class)
inp
- stream input for some scripts.lineStart
- null, this is only for the old form with line separationexecClass
- null, only necessary for parsing if idxScript is not givenidxConstData
- null or possible access to constant dataidxScript
- null, then put the script in idxConstData, elsewhere index of all scripts.
If given, then the inp is firstly parsed in a first pass to gather all scripts,
the second path is executed afterwards. Then a script can be <:call:...> which is defined after the calling script.java.io.IOException
- general possible on reading inpjava.text.ParseException
- if the inp has syntax errors@Deprecated public static void XXXreadStreamTemplateCreatePreparer(java.io.InputStream inp, java.lang.String lineStart, java.util.Map<java.lang.String,OutTextPreparer> idxScript, java.lang.Object dataRoot, java.util.Map<java.lang.String,java.lang.Object> idxConstData) throws java.io.IOException, java.text.ParseException
#readStreamTemplateCreatePreparerNew(InputStream, String, Map, Object, Map)
OutTextPreparer
instances but does not parse.
To parse all read scripts call parseTemplates(Map, Class, Map, LogMessage)
afterwards.
This assures that all sub scripts in all templates can be <:call...> independent of the definition order.inp
- stream input for some scripts.lineStart
- null, this is only for the old form with line separationidxScript
- index of all scripts. The scripts are created, the text is referred via pattern
but the script is not parsed yet.
Later parsing allows that a script can be <:call:...> which is defined after the calling script.dataRoot
- null admissible, possibility to set values from there in <:set:name=&value>
idxConstData
- necessary if <:set:name=value>
is used.
null admissible if the inp does not contain <:set:name=&value>
outside of scriptsjava.io.IOException
- general possible on reading inpjava.text.ParseException
- if the inp has syntax errors@Deprecated public static java.util.Map<java.lang.String,OutTextPreparer> XXXreadTemplateCreatePreparer(java.io.InputStream inp, java.lang.Class<?> execClass) throws java.io.IOException, java.text.ParseException
#readTemplateCreatePreparer(InputStream, String, Map)
.#readTemplateCreatePreparer(InputStream, String, Class, Map, String)
if you have not specific const Data for parsing the script.inp
- An opened input stream, which can be for example also part of a zip file content
or gotten via Class.getResourceAsStream(String)
from a jar file,
or also of course via FileReader.FileReader(java.io.File)
or via InputStreamReader.InputStreamReader(InputStream, String)
to read a file with specific encoding.execClass
- a given class which's content is accessed as persistent data.java.io.IOException
java.text.ParseException
#readTemplateCreatePreparer(InputStream, String, Class, Map, String)
are usual not necessary for that approach, because it was the older concept to define some const data in the Map,
and the Map is completed with the found scripts.
Here now it is simpler, the operation returns the new Map filled with the content of the read script.@Deprecated public static java.util.Map<java.lang.String,OutTextPreparer> XXXreadTemplateCreatePreparer(java.io.InputStream inp, java.lang.Class<?> execClass, java.util.Map<java.lang.String,java.lang.Object> idxConstData) throws java.io.IOException, java.text.ParseException
#readTemplateCreatePreparer(InputStream, String, Map)
.inp
- An opened input stream, which can be for example also part of a zip file content
or gotten via Class.getResourceAsStream(String)
from a jar file,
or also of course via FileReader.FileReader(java.io.File)
or via InputStreamReader.InputStreamReader(InputStream, String)
to read a file with specific encoding.execClass
- a given class which's content is accessed as persistent data.idxConstData
- java.io.IOException
java.text.ParseException
@Deprecated public static java.util.Map<java.lang.String,OutTextPreparer> XXXreadTemplateCreatePreparer(java.io.InputStream inp, java.util.Map<java.lang.String,java.lang.Object> idxConstData) throws java.io.IOException, java.text.ParseException
#readTemplateCreatePreparer(InputStream, String, Map)
.inp
- An opened input stream, which can be for example also part of a zip file content
or gotten via Class.getResourceAsStream(String)
from a jar file,
or also of course via FileReader.FileReader(java.io.File)
or via InputStreamReader.InputStreamReader(InputStream, String)
to read a file with specific encoding.execClass
- a given class which's content is accessed as persistent data.idxConstData
- java.io.IOException
java.text.ParseException
@Deprecated public static void XXXwriteOtx(java.io.File fout, java.lang.Object data, java.io.InputStream inTpl, java.lang.Class<?> execClass, java.lang.String sMain) throws java.io.IOException
fout
- The file to writedata
- Data for the output with the script, only one is possible.inTpl
- opened input stream which offers the otx-template to read.
This inTpl is closed here after read.execClass
- a given class which's content is accessed as persistent data.sMain
- Name of the start or main template in the read script.java.io.IOException
private void parseVariables(java.lang.String variables)
setVariables(List)
Additional the variables 'OUT', 'OTX', 'OTXCMD', 'OTXDATA' are set.
sLineoutStart
to detect it in the script.
ixVarLineoutStart
.
The content of this variable is then output as newline sequence.
It should contain '\n' or other desired newline sequence on first position,
and then indentation characters.
variables
- String with identifier names, separated with comma, white spaces admissible.
first name in the String gets the index 0private void setVariables(java.util.List<java.lang.String> listArgs)
OutTextPreparer.Cmd
OutTextPreparer.DataTextPreparer
listArgs
- first argument in the list gets the index 0public void parse(java.lang.Class<?> execClass, java.util.Map<java.lang.String,java.lang.Object> idxConstDataArg, java.util.Map<java.lang.String,OutTextPreparer> idxScript) throws java.text.ParseException
#readTemplateCreatePreparer(InputStream, Class, Map)
for two-phase-translation.execClass
- used to parse <:exec:...>, the class where the operation should be located.idxScript
- Map with all sub scripts to support <:call:subscript..>java.text.ParseException
public OutTextPreparer.DataTextPreparer createArgumentDataObj()
exec(Appendable, DataTextPreparer)
run.
The arguments should be filled using OutTextPreparer.DataTextPreparer.setArgument(String, Object)
by name
or OutTextPreparer.DataTextPreparer.setArgument(int, Object)
by index if the order of arguments are known.
exec(Appendable, DataTextPreparer)
is concurrently executed (multiple threads,
multicore processing), then any thread should have its own data.
Also if it is nested used, of course the nested usage needs its own instance.
parse(Class, Map, Map)
should be successfully called before.public OutTextPreparer.DataTextPreparer getArgumentData(java.lang.Object execInstance)
OutTextPreparer.DataTextPreparer.setExecObj(Object)
execInstance
- It should be an instance of the given reflection class on ctor.public void exec(java.lang.Appendable wr, OutTextPreparer.DataTextPreparer args) throws java.io.IOException
execLineCt(WriteDst, DataTextPreparer)
It is for compatibility and simplifies usage.wr
- If it is an instance of OutTextPreparer.WriteDst
it is taken and calls execLineCt(WriteDst, DataTextPreparer)
.
Else a new instance WriteDst#WriteDst(Appendable, int)
is created started with lineCt = 1args
- see execLineCt(WriteDst, DataTextPreparer)
java.io.IOException
public void execLineCt(OutTextPreparer.WriteDst wrCt, OutTextPreparer.DataTextPreparer args) throws java.io.IOException
wr
- The output channel. If it is a Flushable
then after this operation flush() is called.
This allows view ouutput on file level. flush() is also possible to call inside from user level
in any called sub operations where the wr instance is known, simple using this.
args
- for preparation.
The value instance should be gotten with createArgumentDataObj()
proper to the instance of this, because the order of arguments should be match.
It is internally tested.java.lang.Exception
java.io.IOException
private void execSub(OutTextPreparer.WriteDst wdArg, OutTextPreparer.DataTextPreparer args, int ixStart, int ixEndExcl) throws java.io.IOException
wr
- The output channelargs
- for preparation.ixStart
- from this cmd in cmds
java.io.IOException
private java.lang.Object dataForCmd(OutTextPreparer.Cmd cmd, OutTextPreparer.DataTextPreparer args, OutTextPreparer.WriteDst wrCt) throws java.io.IOException
java.io.IOException
private java.lang.Object execDataAccess(java.lang.Appendable wr, OutTextPreparer.Cmd cmd, OutTextPreparer.DataTextPreparer args) throws java.io.IOException
wr
- only used on exception to write an elaborately infocmd
- contains CalculatorExpr.Operand.ixValue
for first variable
and possible CalculatorExpr.Operand.dataAccess
for deeper values.
If it is instanceof OutTextPreparer.ValueCmd
then OutTextPreparer.ValueCmd.sFormat
is used to format numeric and time values if givenargs
- dynamic data for accessjava.io.IOException
private int execIf(OutTextPreparer.WriteDst wrCt, OutTextPreparer.IfCmd ifcmd, int ixCmd, java.lang.Object data, OutTextPreparer.DataTextPreparer args) throws java.io.IOException
wr
- the output channelcmd
- The ForCmdixCmd
- the index of the cmd in cmds
container
- The container argumentargs
- actual args of the calling leveljava.lang.Exception
java.io.IOException
private void execSubFor(OutTextPreparer.WriteDst wdArg, OutTextPreparer.DataTextPreparer args, OutTextPreparer.ForCmd cmd, int ixStart, int ixEndExcl) throws java.io.IOException
wr
- The output channelargs
- for preparation.ixStart
- from this cmd in cmds
java.io.IOException
private void execFor(OutTextPreparer.WriteDst wrCt, OutTextPreparer.ForCmd cmd, int ixCmd, java.lang.Object container, OutTextPreparer.DataTextPreparer args) throws java.io.IOException
wr
- the output channelcmd
- The ForCmdixCmd
- the index of the cmd in cmds
container
- The container argumentargs
- actual args of the calling leveljava.lang.Exception
java.io.IOException
private void execCall(OutTextPreparer.WriteDst wrCt, OutTextPreparer.CallCmd cmd, OutTextPreparer.DataTextPreparer args, OutTextPreparer callVar) throws java.io.IOException
wr
- the output channelcmd
- The CallCmdargs
- actual args of the calling levelcallVar
- The OutTextPreparer which is called here.java.lang.Exception
java.io.IOException
public java.lang.String toString()
toString
in class java.lang.Object
void debug()