|
- WLanguage properties that can be used with the List type
- WLanguage functions for managing the lists
- The lists and the multithread
- Browsing the lists
- Special cases
List (Type of variable) In french: Liste (Type de variable)
Syntax
Declaring and initializing a list Hide the details
<List Name> is List of <Type of List Elements>
<List name>: Name of the List variable to declare. <Type of List Elements>: Type of the elements found in the list. All types of variables can be used EXCEPT for the arrays, the associative arrays, the queues, the stacks and the lists. Versions 20 and laterAll types of variables can be used including the arrays, the associative arrays, the queues, the stacks and the lists. For example:
<variable> is List of arrays of int
<variable> is List of fixed arrays of 5 int
<variable> is List of associative arrays of int
<variable> is List of Queues of int
<variable> is List of Stacks of int
<variable> is List of Lists of int
New in version 20All types of variables can be used including the arrays, the associative arrays, the queues, the stacks and the lists. For example:
<variable> is List of arrays of int
<variable> is List of fixed arrays of 5 int
<variable> is List of associative arrays of int
<variable> is List of Queues of int
<variable> is List of Stacks of int
<variable> is List of Lists of int
All types of variables can be used including the arrays, the associative arrays, the queues, the stacks and the lists. For example:
<variable> is List of arrays of int
<variable> is List of fixed arrays of 5 int
<variable> is List of associative arrays of int
<variable> is List of Queues of int
<variable> is List of Stacks of int
<variable> is List of Lists of int
Remarks WLanguage properties that can be used with the List type The following properties can be used to handle a List variable. | | Property name | Effect |
---|
Occurrence | Returns the number of occurrences of the List variable. | Empty | - True if the list is empty,
- False otherwise.
| Note: These properties can be used with one of the following syntaxes: - <Variable name>..<Property name>
- <Variable name>.<Property name>
WLanguage functions for managing the lists The following functions can be used to handle a List variable.
| | Versions 14 and laterAdd New in version 14Add Add | Adds an element in last position: - of a one-dimensional WLanguage array.
- of an advanced array property (array of events of gglCalendar, etc.).
- from a WLanguage list.
| Delete | Deletes an element at a given position: - from a one-dimensional WLanguage array.
- from an advanced array property (array of gglCalendar events, etc.).
- from an associative array.
- from a WLanguage list.
| DeleteAll | Deletes all the elements: - from a one-dimensional or two-dimensional WLanguage array.
- from an associative array.
- from an advanced array property (array of gglCalendar events, etc.).
- from a WLanguage queue.
- from a WLanguage stack.
- from a WLanguage list.
| Deserialize | Deserializes a buffer or a character string containing the data of a class, structure, array (including an associative array), queue, stack, list or advanced variable as well as their sub-elements. | Insert | Inserts an element at a given position: - into a one-dimensional WLanguage array.
- into an associative array.
- into an advanced array property (array of gglCalendar events, etc.).
- into a WLanguage list.
| ListInfo | Retrieves the characteristics of a WLanguage list: types of elements and number of elements. | Serialize | Transforms the following elements into a specific format:- a structure (and its sub-elements),
- a class (and its sub-elements),
- an array (including the associative arrays),
- a queue,
- a stack,
- a list.
|
The lists and the multithread The management of multithread is taken into account when adding, inserting and deleting an element. You also have the ability to use properties during a multithread management but the result is not permanent. For example:
IF MyList..Occurrence > 0 THEN // The list may be empty when the thread reaches this point END
The FOR EACH syntax can be used to browse the lists. The syntax used corresponds to the one used for the arrays:
FOR EACH [ELEMENT] <Variable> [, <Counter> [, <Counter>]] OF <List> [<Direction>] ... END
The elements can be modified during the browse. If the list is modified during a browse, the browse is affected by the additions and by the deletions. The functions available during the browse are as follows: - Syntax 1:
Insert(<List Name>, BeforeCurrentElement, <Value>)
Caution: the element will be browsed by the next iteration if the loop is a descending loop. - Syntax 2:
Insert(<List Name>, AfterCurrentElement, <Value>)
Caution: the element will be browsed by the next iteration if the loop is an ascending loop. - Syntax 3:
Delete(List Name, CurrentElement)
- The content of the list can be displayed in the debugger.
- A list can be used to type a procedure parameter.
- A list can be copied by the = operator. You also have the ability to copy an instance of class or structure containing a list.
- A list can be initialized by a list of elements.
This page is also available for…
|
|
|
| |
| Click [Add] to post a comment |
|
| |
|
| |
| |
| |
| |
| |
| |
| | |
| |