Norwegian University of Science and Technology

Global navigation


Differences

This shows you the differences between the selected revision and the current version of the page.

research:diamodl:graphical-editor:user-guide:javascripting 2007/11/20 11:12 research:diamodl:graphical-editor:user-guide:javascripting 2007/11/20 11:27 current
Line 21: Line 21:
=== Ecore-specific functions === === Ecore-specific functions ===
A small set of functions for operating on Ecore model element (e.g. classes) are defined. A small set of functions for operating on Ecore model element (e.g. classes) are defined.
 +
 +The 'is' function tests whether the second argument is an instance of the first argument, which must be an Ecore class (EClass). In addition to the two-argument 'is' function, there is a one-argument 'is-<name>' function defined for each 'name' class, that tests whether the argument is of that class. E.g. the isPerson functions tests whether its argument is an instance of the 'Person' class.
 +
 +The 'create' function creates an instance of the first argument, which must be an Ecore class, initialised with the properties defined in the second argument, which must be a Map. I.e. an instance of the class is created, and for each entry in the Map, the property named by the entry's key is set to the entry's value. In addition to the two-argument 'create' function, there is a one-argument 'create-<name>' function defined for each 'name' class, that creates an instance of that class. E.g. the createPerson functions creates an instance of the 'Person' class, initialised with the properties defined by the Map argument.
 +



2007/11/20 11:27, Hallvard Trætteberg
NTNU, NO-7491 Trondheim. Telephone: +47 73 59 50 00. Contact us
Editorial responsibility: hal@idi.ntnu.no