AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / WLanguage / Funciones WLanguage / Funciones estándar / Funciones de colas, pilas, listas y arrays / Funciones de colas, pilas y listas
  • WLanguage properties that can be used with the Queue type
  • WLanguage functions for managing queues
  • The queues and the multithread
  • Browsing the queues
  • Special cases
WINDEV
WindowsLinuxJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac Catalyst
Otros
Procedimientos almacenados
A Queue variable is a structured type that groups a set of elements of the same type. The elements are added at the end of queue and they are retrieved in enqueue order.
For example, if the elements are added in the following order: 1, 2, 3, they will be retrieved in the same order 1, 2, 3.
Ejemplo
MyQueue is Queue of int

// Enqueue the values 1, 2 and 3
Enqueue(MyQueue, 1)
Enqueue(MyQueue, 2)
Enqueue(MyQueue, 3)

// Display the trace: 1, 2, 3
x is int
WHILE Dequeue(MyQueue, x)
	Trace(x)
END
Sintaxis

Declaring and initializing a queue Ocultar los detalles

<Queue Name> is Queue of <Type of Queue Elements>
<Queue Name>:
Name of the queue variable to declare.
<Type of Queue Elements>:
Type of elements found in the queue.
All types of variables can be used including the arrays, the associative arrays, the queues, the stacks and the lists. For example:
<variable> is queue of arrays of int

<variable> is queue of fixed arrays of 5 int

<variable> is queue of associative arrays of int

<variable> is queue of queues of int

<variable> is queue of stacks of int

<variable> is queue of lists of int
Observaciones

WLanguage properties that can be used with the Queue type

The following properties can be used to handle Queue variables:
Property nameEffect
AdditionCompletedReturns and modifies the addition mode of elements.
This property is used for the multithread management.
Empty
  • True if the queue is empty,
  • False otherwise.
NbPendingThreadReturns the number of pending threads.
This property is used for the multithread management.
OccurrenceReturns the number of queue occurrences.

WLanguage functions for managing queues

The following functions can be used to handle Queue variables:
DeleteAllDeletes all 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.
DequeueElimina un elemento de la cola.
DeserializeDeserializes a buffer or a character string containing the data from a class, structure, array (including an associative array), queue, stack, list or advanced variable, as well as their subelements.
EnqueueAdds an element to the queue.
QueueInfoRecupera las características de una cola: tipos de elementos y número de elementos.
SerializarTransforma los siguientes elementos en un formato específico:
  • una estructura (y sus subelementos),
  • una clase (y sus subelementos),
  • y array (incluyendo el arrays asociativo),
  • a queue,
  • una pila,
  • a list.

The queues and the multithread

The management of multithread is taken into account when adding and deleting an element (Enqueue and Dequeue).
You also have the ability to use properties during a multithread management but the result is not permanent. For example:
IF MyQueue.Occurrence > 0 THEN
	// The queue may be empty when the thread reaches this point

END

Browsing the queues

The FOR EACH syntax can be used to browse the queues. The elements are browsed in enqueue order that is similar to the dequeue order.
The syntax used corresponds to the one used for the arrays:
FOR EACH [ELEMENT] <Variable> [, <Counter> [, <Counter>]] OF <Queue>
...
END

The elements can be modified during the browse. If the queue is modified during a browse, the elements browsed will be the ones found when the browse was initialized:
  • the elements enqueued after the initialization of the browse will not be browsed.
  • the elements dequeued after the initialization of the browse will still be browsed.

Special cases

  • In the debugger, the content of the queue is displayed in dequeue order.
  • A queue can be used to type a procedure parameter.
  • A queue can be copied with the = operator. You also have the ability to copy an instance of class or structure containing a queue.
  • A queue can be initialized by a list of elements in enqueue order.
Versión mínima requerida
  • Versión 14
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 23/10/2024

Señalar un error o enviar una sugerencia | Ayuda local