| Prev | Next | Start of Chapter | End of Chapter | Contents | Glossary | Index | Comments | (14 out of 19)

Using Specialized Definitions

In addition to the class-definition, which can define a subclass of any extensible class, G2 provides three specialized types of definitions:

These specialized definitions are supported to provide compatibility with previous versions of G2, which did not provide a generic class definition capability. This section briefly describes the use of specialized definitions for those who encounter them in existing G2 applications.

The specialized definitions are very similar to CLASS-DEFINITIONs. The only difference is that each one provides as ordinary table attributes the attributes characteristic of every class of its type. In a CLASS-DEFINITION, these attributes appear as Initializable-system-attributes after the Direct-superior-classes are specified. The grammar for specifying their values is the same in either case.

For example, the following two figures show a CLASS-DEFINITION and an equivalent OBJECT-DEFINITION. Note the two techniques for initializing the stubs attribute.



Mixing Generic and Specialized Definitions

A specialized definition can inherit a class-definition, subject to the restriction that a specialized definition cannot inherit any superior class that is not of its type. For example, an OBJECT-DEFINITION can inherit a CLASS-DEFINITION only when the CLASS-DEFINITION inherits, and thus defines, an object class.

A class-definition can inherit any class, subject only the restriction on absurd combinations of foundation classes, as described under Meaningless Multiple Inheritance.

Creating an Object Definition

An OBJECT-DEFINITION can define a subclass of any object class.

To create an OBJECT-DEFINITION:

  1. Choose:

    The icon of an OBJECT-DEFINITION looks like this:


  2. Click to place the new definition on a workspace. See Storing Definitions on Workspaces for related information.

    The attributes of a CONNECTION-DEFINITION are included in the table under Class Definition Attributes, and the general considerations listed in that section apply.

  3. Carry out the instructions under Completing Class Definitions, omitting the two sections that pertain to Initializable-system-attributes:

    The primary direct superior must be object or a subclass of object.

  4. Carry out the instructions under Specifying Instantiability.

  5. Provide or obtain values for the following attributes as described in the sections indicated. To provide a value, edit the value cell of the attribute, as with any table attribute.

    Attribute Section
    attribute-displays
    Specifying Attribute Displays
    stubs
    Specifying Connection Stubs
    icon-description
    Specifying an Icon

Creating a Connection Definition

A CONNECTION-DEFINITION can define a subclass of any connection class.

To create a CONNECTION-DEFINITION:

  1. Choose:

    The icon of a CONNECTION-DEFINITION looks like this:


  2. Click to place the new definition on a workspace. See Storing Definitions on Workspaces for related information.

    The attributes of a CONNECTION-DEFINITION are included in the table under Class Definition Attributes, and the general considerations listed in that section apply.

  3. Carry out the instructions under Completing Class Definitions, omitting the two sections that pertain to Initializable-system-attributes:

    The primary direct superior must be connection or a subclass of connection.

  4. Provide or obtain values for the following attributes as described in the sections indicated. To provide a value, edit the value cell of the attribute, as with any table attribute.

    Attribute Section
    Cross-section-pattern
    Defining Connection Regions
    Stub-length
    Specifying a Stub Length
    Junction-block
    Defining the Junction Block to Use

Creating a Message Definition

A MESSAGE-DEFINITION can define a subclass of any message class.

To create a MESSAGE-DEFINITION:

  1. Choose:

    The icon of a MESSAGE-DEFINITION looks like this:


  2. Click to place the new definition on a workspace. See Storing Definitions on Workspaces for related information.

    The attributes of a CONNECTION-DEFINITION are included in the table under Class Definition Attributes, and the general considerations listed in that section apply.

  3. Carry out the instructions under Completing Class Definitions, omitting the two sections that pertain to Initializable-system-attributes:

    The primary direct superior must be message or a subclass of message.

  4. Carry out the instructions under Specifying Instantiability.

  5. Provide or obtain values for the following attribute as described in the section indicated. To provide a value, edit the value cell of the attribute, as with any table attribute.

    Attribute Section
    Default-message-properties
    Specifying Default Message Properties

| Prev | Next | Start of Chapter | End of Chapter | Contents | Glossary | Index | Comments | (14 out of 19)

Copyright © 1997 Gensym Corporation, Inc.