RadixWare Programmer Guide/Definition Types/Application Definition Segment/Algorithmic Blocks

From RadixWiki
Jump to: navigation, search

The following types of algoblocks are supported in the algorithm scheme editor:

Program Block

This block executes the JML code specified in settings. The block can have one input and several outputs. The block appearance:

Programm appearance.jpg

Program Block Editor

Programm editor.jpg

The block editor contains the following elements:

  • Name. The block name.
  • Editing area. The area is used to define the program code in the JML language.
  • Outputs Setup Area. The area contains the Exits button. Clicking the button opens the block output editor and a list of buttons with the output names. Click the button with the name of the required output to add it to the code editing area. Depending on the returned output, the thread goes to a certain block. The transfer to output is performed by using a key word return.

example.jpg

The figure below presents a block with three outputs:

Programm outputs.png

Example of the program code for the particular block:

if (x < 0) {

return exit1;

} else if (x == 0) {

return exit2;

} else if (x > 0) {

return exit3;

}

Wait Block

The block stops the process execution for the period specified in settings or before the strobe specified in settings is activated. Before waiting, the code specified in settings is executed. The block appearance:

Wait appearance.jpg

Wait Block Editor

Wait editor.jpg

The block editor contains the following elements:

  • Name. The block name.
  • Pre-Execute page. The page is used to create the program code in JML language; the code is executed before waiting.
  • Post-Execute page. The page is used to create the program code in JML language; the code is executed when the waiting period (specified in the settings) is over (Timeout) or the strobe occurs.
  • Properties page. The page contains the parameters defining the conditions under which the process will be continued:
    • Strobe. If this strobe is activated, the block exits. The value is selected from a list of strobe methods of the current algorithm class.
    • Timeout. If the flag is set, it is possible to specify the period over which the block exits.

Scope Block

This block contains a part of the algorithm. The block can be used to restrict the scope of variables and to define the local exception handlers. The block restricts the scope, but not the lifetime of the local variables. The local variables are not cleared when exiting the scope block; their values are saved before reentering. The block appearance:

Scope appearance.jpg

The subalgorithm is edited in the Flowchart child definition that is created automatically when adding the Scope block to the editor of algorithm scheme. When the subalgorithm execution is completed, the control passes to the main algorithm.

Include

This block transfers control to the algorithm specified in the settings. Before calling the algorithm, the additional code can be executed. After terminating the algorithm being called, the control returns to the source algorithm. The block appearance:

Include appearance.jpg

Include Block Editor

Include editor.jpg

The block editor contains the following elements:

  • Name. The block name.
  • Algorithm. The algorithm that is called in the current block.
  • Pre-execute area. The area is used to define the program code in the JML language that defines the algorithm input data.

Fork Block

This block is used to create new process threads. It creates the threads one less than a number of lines attached to its output. The block appearance:

Fork appearance.jpg

Merge Block

This block is used to synchronize and/or discriminate several process threads. The block settings define a number of threads to be synchronized. The threads that reached this block suspend the execution until their number reaches a specified value. The other threads that reached this block are terminated. The control transfers to the block output with a number equal to the number of the last activated input. The block appearance:

Merge appearance.jpg

Merge Block Editor

Merge editor.jpg

The block editor contains the following elements:

  • Sync thread count from n. The number of threads to be synchronized.
  • Entry count. The number of block inputs/outputs. The parameter value can be used to indicate the thread that was last activated.

Throw Block

This block generates the exception defined in the block settings. When the exception occurs, the system searches for the respective block - the exception handler. The search algorithm is the following:

  1. All exception handlers of the current sub-algorithm (Scope) are checked. If the correspondence is found, the exception is placed to the stack of exceptions of the current thread and to the exception variable. At that, the control transfers to the exception handler.
  2. If the exception is not found in the current sub-algorithm, the transfer to the parent sub-algorithm is performed. At that, if the exception being processed occurs in the exception handler, the upper item is discarded from the stack of exceptions at exiting the sub-algorithm.

The block appearance:

Throw appearance.jpg

Throw Block Editor

Throw editor.jpg

The block editor contains the following elements:

  • Exception. The type of exception generated by the block.
  • Parameters area. The area used to define the program code in the JML language; this code defines the exception parameters.
Example.jpg For example, if the exception type is NullPointer, and the ("Object not defined") is defined in the parameters, the exception as follows will be generated: throw new NullPointer("Object not defined").

Catch Block

This block is used to catch the exceptions. The block settings define the type of exceptions to be caught. The block itself includes the sub-algorithm that starts up when the block is activated. The subalgorithm is edited in the Flowchart child definition that is created automatically when adding a Catch block to the editor of algorithm scheme. Once the sub-algorithm is executed, the parent sub-algorithm exits. The block appearance:

Catch appearance.jpg

Catch Block Editor

Catch editor.jpg

The block editor contains the following elements:

  • Name. The name block.
  • Exception. The type of exception being processed in the block.

Terminate Thread Block

This block terminates the execution of any process threads that reaches it. The block appearance:

Terminate thread appearance.jpg

Terminate Process Block

This block terminates the process execution when any process threads reaches it. The block appearance:

Terminate process appearance.jpg

Return

This block exits the algorithm or the sub-algorithm. The block appearance:

Return appearance.jpg

Empty Block

This block is an empty block and is used to visualize an algorithm. The block appearance:

Empty appearance.jpg

Note

This block is used to document the algorithm. The block appearance:

Note appearance.jpg

Variable

The blocks of this type contain the local variables used in the algorithm. The block appearance:

Variable appearance.jpg

Variable Block Editor

Variable editor.jpg

The block editor contains the following elements:

  • Name. The block name.
  • Type. The variable data type. The data type is selected using the standard dialog of type selection.
  • Persistent. If the flag is set, the variable value will be saved in the process context when the algorithm is suspended. If the flag is not set, the variable will contain the source value after the algorithm activation.
  • Init value. The variable initial value.