<<[1.Structure of AToM3 Objects]     :::      [3. Specifying Constraints and Actions]>>

2. Structure of AToM3 Models

In AToM3, models are stored as a graphs. This graph is implemented as a class that inherits from ASG, which in its turn inherits from ASGNode. The nodes in the graph are instances of classes that inherit from ASGNode. The important attributes and methods of the ASG class are shown in the following class diagram:

Figure 1: Structure of ASG objects.

The attributes have the following meaning: The methods have the following meaning:

2.1. Example

Following with the previous example, suppose you have edited the model properties (accessible through the meny Model|Edit Model Attributes) as follows:

Figure 2: Editing the model properties

If you click on Generate Code, several Python files are generated:

def createNewaTest(self, wherex, wherey, screenCoordinates = 1):

where wherex and wherey are the coordinates where the object is to be created. If they are already converted into canvas coordinated, then the screenCoordinates parameter must be 0, else it must be 1.

In this same file there's another method (fillTypesInformation) which is used to provide ATOM3 with the allowed types that can be used when the meta-model is loaded. More about this in the ATOM3 class section.

  • A Python file which contains a model of the user interface to be loaded with the formalism. This file is named in our case Indeed this file can be loaded in AToM3 as a model (it's a model in the Buttons formalism) or as a meta-model (and then the model in the Buttons formalism will get interpreted by AToM3 , which will create the actual buttons in the user interface). By default the Buttons model is populated with a button for each object defined in the meta-model (in our case two buttons: one to create aTest objects and another to create aRel objects). If you open as a model, and you inspect the Python code that is executed when the Button is pressed you will see that there are invokations to the methods created in : createNewaTest() and createNewaRel(). You can of course modify this Buttons model to add new buttons, or delete those you don't want, but beware!: if you save this model with the same name, and later you re-generate code for the meta-model, you'll loose your changes, as this file will get overwritten. So if you are going modify your meta-model later, save the modified Buttons model with another name!. In section Debugging and common programming patterns, we'll show some examples of creating buttons to execute graph grammars.

  • <<[1.Structure of AToM3 Objects]     :::      [3. Specifying Constraints and Actions]>>

    Maintained by Juan de Lara. Last modified 22 July 2002.