OBJECT, for use in defining classes of objects.
OBJECT that provide variables, parameters, lists, arrays, and many other things.
OBJECT and any system-defined or user-defined subclass of OBJECT as an object class.
To create an object class:
CLASS-DEFINITION whose primary direct superior is OBJECT or any subclass of OBJECT, following the directions under:
Icon-description) exist in every object class:
attribute-displays
stubs
CLASS-DEFINITION that inherits any object class, the attribute-displays and stubs attributes appear as initializable system attributes in the definition. The grammar for providing their default values is described under Specifying Default Values for Inherited Attributes. For details see:Each system-defined subclass of
OBJECT adds the initializable system attributes that it needs in order to carry out its purpose. Some of these are described in this section under:
CONNECTION-POST, is functionally more closely associated with connections than with objects, which are typically used to represent knowledge. Instructions for creating connection posts appear under Creating Connection Post Classes.
For information on other initializable system attributes of object classes, see the documentation in this manual for the particular class.
Specifying Attribute Displays
The Attribute-displays attribute lets you display the values and, optionally, the names of, one or more system- or user-defined attributes of class instances. show attribute display option in their table menu, as shown here on the History-keeping-spec attribute of a variable.
![]() |
While you can display most attribute values by choosing that option, the
Attribute-displays attribute in a definition provides additional functionality.Attribute-displays attribute lets you optionally display the attribute name, and position the display at a location of your choice. Attribute-displays attribute, enter the name of any system- or user-defined attributes, and select one or more of the phrases that appear in the Text Editor.
When you specify attribute displays, instances of the object include those displays at creation time and remain in effect until you change them in the attribute table of the instance. Alternatively, you can use the Change attribute in the class definition to update the attribute displays of all instances. For information about changing attribute displays with the Change attribute, see the section Using the Change Attribute.
Specifying Connection Stubs
Connection stubs are short connections attached to and extending from an object. They are the starting point for connections between objects. This figure shows an object with stubs extending to the left and right.
![]() |
All stubs have the qualities of elasticity and style. You can lengthen a stub by dragging the stub end that is not attached to the object or item. In style, a stub is either orthogonal or diagonal.
Stubs attribute indicates the number of stubs and the location of where each attaches to class instances.
{none | inherited | {a | an} [ {input | output} ] connection-class
[portname] located at {top | bottom | right | left} integer
[with style {orthogonal | diagonal} ] }
![]() |
By default, stubs are non-directional and associated with the system-defined CONNECTION class. For a complete description of using connections, see Chapter 17, Connections.
You can assign a name to a stub, and reference it by that name in expressions. A named stub is called a port. Specify a port's name by including a portname in the
Stubs attribute that specifies the stub.input or output stub in the Stubs attribute. Providing direction to a stub gives you more control over connections made to it, such as restricting the direction of flow. For example, G2 does not let you connect an input stub to another input stub, or an output stub to another output stub. When a connection is directional, G2 can reason about the objects it connects this way:
any auto-object connected at an input of auto-object2
Stubs attribute:
![]() |
any auto-object connected at the outflow-port of auto-object2
whenever the mileage of auto-object > 100
change the inside-stripe stripe-color of every production-line-connection to red
Note: G2 does not restrict connections to the stubs you define. Unless you specify no-manual-connections as a Configuration in the class definition (which limits connections to the stub locations), you can make any number of additional connections to an object.
Inheriting Default Values for Stubs
Icons and stubs are closely related, but they are specified by two different attributes of a definition. Where multiple inheritance exists, this independence could result in mismatched icons and stubs, so the G2 class inheritance rules contain a special provision that prevents it. none. Specifying Other Object Class Attributes
Each system-defined subclass of object adds the initializable system attributes that it needs in order to carry out its purpose. This section describes the attributes of variables, parameters, lists, and arrays. For information on other initializable system attributes of object classes, see the documentation in this manual for the particular class. Attribute Initializations for Variables and Parameters
The Attribute-initializations applicable to variables and parameters are as follows:
You can also select
supply simulation subtable as a default setting for a variable definition. Instances will then include a simulation subtable available from the variable's simulation-details attribute.
Note: For more information about specifying history keeping for variables and parameters, see Chapter 15, Variables and Parameters.
Attribute Initializations for Lists and Arrays
The attribute-initializations applicable for lists and arrays are as follows:
Note: You cannot change the allow duplicate elements for a g2-list or the element type for a g2-array while G2 is running when instances exist.
For array classes of a specific type, such as an integer-array, the Text Editor does not prevent you from entering elements of the incorrect type. Specifying such elements causes G2 to replace any element of an incorrect type with the default value for the array class.