next up previous
Next: R (Resource) type nodes Up: G (Gate) type nodes Previous: Indexes

Examples

  1. G::

    When activated, this node scans the EL and nothing is made. From other nodes it is possible to extract and modify the messages of its EL.

  2.    Inspect (G) Sale, Repair :: IF Defect
                                    THEN BEGIN STOPSCAN; SENDTO(Repair) END
                                    ELSE SENDTO(Sale);

    If the boolean field Defect of the message (article) is TRUE, the examination of the list stops and the message is sent to Repair. Otherwise, it is sent to Sale. In the first case, the scan is stopped (will continue in the next activation during the same event); in the second case, the scan continues. Note that the STOPSCAN must be used only if it is necessary (see next example) because it increases the processing time by repeating the scanning of the network.

  3.     Semaf (G) Street :: STATE BEGIN Green := NOT Green; IT := 25 END;
                            IF (LL(IL_Street) < 20) AND Green
                            THEN SENDTO(Street); STOPSCAN;

    Each 25 units of time the boolean variable Green changes its true value. The node allows the messages (cars) to pass if Green is true and the IL of the successor node Street has less than 20 messages. When a message passes, the scanning of the EL is stopped to allow the change in the IL of Street. Without the STOPSCAN more than 20 messages would be sent to Street. On the other hand, if the condition is not fulfilled stopping of the scan avoids unnecessary examination of the EL. Eventually, future changes in the IL of Street will produce a network scanning an a new activation of Semaf.

  4.     Control (G) Machine[INO] :: SENDTO(Machine[FREE]);
    The message (object to be processed) is sent to the first free Machine (with free capacity). If there is no free Machine, the message remains in the EL of Control.
  5.     Selection (G) ::
               IF (Typ = Special) AND First
                THEN BEGIN SENDTO(Depot); BEGINSCAN; First := FALSE END
                ELSE IF NOT First THEN SENDTO(Depot);
    Among the messages in the EL of Selection there is one and only one with the field Typ = Special. Only after it passes, all the others may pass. The boolean variable First is originally TRUE.


domingo c
Mon Mar 20 17:31:11 PST 2000