| Prev | Next | Start of Chapter | End of Chapter | Contents | Glossary | Index | Comments | (10 out of 13)

Detecting Connection and Disconnection Events

Several rules can detect changes in any connection, or in a direct connection only.

You can constrain the execution of the body of a rule that detects a connection/disconnection event by making such execution conditional on one of the functions described under Detecting Connectedness.

Generic Connection and Disconnection Events

A whenever rule can detect the establishment or breaking of a connection between two items irrespective of:

The grammar is:

For example:

Direct Connection and Disconnection Events

A whenever rule can detect the establishment or breaking of a direct connection between two items. The rule can fire for any direct connection, or only if the connection is:

The grammar is:

When referring to a connecting that is directly connected to an item, G2 permits the use of a local variable. You cannot use a local variable when referring to a connection being directly disconnected from an item. Not using a local variable for a disconnected connection prevents the possibility of attempting to refer to a deleted item in the rule consequent.

Examples:

| Prev | Next | Start of Chapter | End of Chapter | Contents | Glossary | Index | Comments | (10 out of 13)

Copyright © 1997 Gensym Corporation, Inc.