Download QNAP2 version 9.3 User's Guide

Transcript
2
& of 12 real elements.
Objects (except objects of type CUSTOMER or of any type referencing type CUSTOMER)
may be created either through the static declaration facility or dynamically using the NEW
function (a reference to the created object is returned as the function value).
Example:
/DECLARE/
& declaring an object type
& identifier with formal parameters
OBJECT NODE (N,T);
INTEGER N;
QUEUE CPU;
QUEUE DISK(N);
& attributes of the object type
REAL T;
END;
/DECLARE/
INTEGER I;
QUEUE A;
&
&
REF QUEUE PROC(10);&
&
REF NODE RND;
&
&
an object of type
QUEUE is created.
an array of 10 references
is created.
a reference to an object
of type NODE is created
NODE (5, 10.2) ND1,ND2;
& static creation of 2 objects
& of type NODE
/EXEC/ RND:= NEW(NODE, 3, 0.5);
& dynamic creation of an object
& of type NODE
/EXEC/ FOR I:=1 STEP 1 UNTIL 10
DO PROC(I):=NEW(QUEUE);
& dynamic creation of
& 10 objects of type QUEUE.
An object deletion mechanism is provided with the DISPOSE procedure.
The /RESTART/ command removes all objects.
Objects of type CUSTOMER or of any type referencing type CUSTOMER can be created
only during the simulation process. As a part of the simulator they may be created:
through a source station (station type SOURCE),
through a static initialization inside stations (parameter INIT),
through calls to the NEW function.
User's Guide
Algorithmic Language 21