Class QUEUE

Name

QUEUE  --  Class are destined to control queues make from arbitrary data.

Synopsis

 QueueNew() --> QUEUE object

Description

Class are destined to control queues make from arbitrary data.

Attributes

<ClassName> QUEUE
<Data> Array, array of arbitrary data.

Methods

EMPTY Check queue.
FREE Free queue.
GET Get data from queue.
HEAD Get first data from queue.
LEN Get queue length.
PUT Put data to queue.
QUEUENEW QUEUE object constructor.
TAIL Get last data from queue.

Method QUEUE:EMPTY()

 Empty() --> TRUE || FALSE

Empty() returns TRUE if queue is empty and FALSE if other.

Method QUEUE:FREE()

 Free() --> TRUE

Free() is removes all items from queue and returns TRUE.

Method QUEUE:GET()

 Get() --> <vData>

Get() is returns first queues element and removes it from queue.

If queue is empty Get() returns NIL.

Method QUEUE:HEAD()

 Head() --> <vData>

Head() is returns first queues element but not removes it from queue.

If queue is empty Head() returns NIL.

Method QUEUE:LEN()

 Len() --> <nLen>

Len() is returns queue length - the count elements into queue.

If queue is empty Len() returns 0.

Method QUEUE:PUT()

 Put(<vData>) --> <nItem>

Put() is inserts new element into queue immediately after to the last element and returns it number.

Method QUEUE:QUEUENEW()

 QueueNew() --> QUEUE object

QueueNew() is constructs and returns new QUEUE object. That class can be use to manipulating( put, get, read) queues made from arbitrary types data.

Method QUEUE:TAIL()

 Tail() --> <vData>

Tail() is returns last queues element but not removes it from queue.

If queue is empty Tail() returns NIL.

Example:

  que := QueueNew()	// --> new Queue object
 que:Put( Time() )	// --> 1
 que:Put( Date() )	// --> 2
 
 ? que:Len()		// --> 2
 
 ? que:Tail()		// --> 17-03-2003
 ? que:Len()		// --> 2
 
 que:Get()		// --> "12:14:56:01"
 ? que:Len()		// --> 1
 
 que:Free()
 ? que:Len()		// --> 0
 

Platforms

No dependies of platform.