Child pages
  • Shapes - an introductory MPS tutorial

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

With these languages imported we should be able to enter the code that discovers the correct static field declaration within the Color class:

Image RemovedImage Added

The node-ptr/.../ construct allows you to obtain a node in the imported models of a specified concept represented with the given name. Since there only exists one Color class in JDK, the reference identified as node-ptr/Color/ will be unique and will be pointing into the model to the Color class.

Note: Make sure you pick the right Color concept  element from the completion menu:

Image Removed

. It must be java.awt.Color, not the Color concept from the Shapes language.

Image Added

Node pointer represent persistent references to nodes. To get a reference to the real node in memory, the node pointer must be resolved in the model repository. Use the following code to obtain the repository and resolve the Color node from it:

Image Added

The downcast operator gives you access to the underlying Java API, which is currently the only way to get a repository in this place.

Image Added

Using the collections language you can complete a concise query:

Image RemovedImage Added

Since node is an instance of the Circle concept, node.color is the circle's reference to the color (an instance of ColorReference) and node.color.target is a Color (an instance of the Shapes.Color concept) from the accessory model.

...