Programming

<<[Index] :::  [Structure of AToM3 Models]>>

1. Structure of AToM3 Objects

All the objects that are drawn in the canvas (including links!) inherit from ASGNode. These objects conatin the semantic information as well as a pointer (graphObject_) to the graphical appearance, if any. The following picture shows the important attributes of the ASGNode class from a user point of view.


Figure 1: Attributes of ASGNode.

Next figure shows the main methods:

Figure 2: Methods of ASGNode.

1.1. Example

Suposse you are building a meta-model using the Entity-Relationship formalism, and you have created the following entity:

Figure 3: An example

and associated it a graphical form, and that you have defined the following POSTCondition (named lessThan1000) on EDIT:

ivalue = self.aNumber.getValue()
if ivalue >= 1000: return ("The value you entered("+str(ivalue)+") is too big", self)
return None
which checks that the aNumber attribute has a value lower than 1000. Constraints will be explained in the following section.
Then if you click on Model|Generate code, AToM3 generates (besides other files) a file called aTest.py in the directory for code generation. You can see how the generated class inherits from ASGNode and how two new methods have been added: Besides, the methods preCondition and postCondition have been filled in order to call the appropriate constraints. Observe that graphical constraints are also called at the end of these methods.

Another important detail is that the attribute parent has been added in the constructor. This atttribute is a pointer to the ATOM3 class instance where this object is located.


<<[Index] :::  [Structure of AToM3 Models]>>


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