6.2. Create an animation representation

After the debug presentation has been defined, we can complete it to add an animation layer.

6.2.1. Create the Animation Layer

  • Right click on "Diagram extension MarkedGraph" to select New Diagram Element / Additional Layer.
  • Set its "id" to "Animation".

6.2.2. Display the firable transition with a green background color

  • Right click on "Animation" to select "New Customization / Style Customizations".
  • Right click on "Style Customizations" to select "New Customization / Style Customization".
  • On "Style Customization", set the "Predicate Expression" to:

    [self.eGet('inputs')->forAll(p | p.eGet('runtimeTokenCount').toString().toInteger() > 0) /]
  • Right click on "Style Customization" to select "New Customization / Property Customization (by selection)"
  • For "Applied On" property, select "Square white".
  • For "Property Name", set "color" (completion is available with CTRL-SPACE)
  • For "Value Selection", set "light_green"

6.2.3. Set the background color of a place to light_yellow

Perform the same action as above to set the background color of places to yellow.

You have to select the first element named "ecliple white" (the second one is used to diplay the name).

6.2.4. Display the runtime token count in a place

  • Right click on "Style Customization" to select "New Customization / Property Customization (by expression)"
  • For "Applied On" property, select the first "Ellipse white".
  • For "Property Name", set "labelExpression" (completion is available with CTRL-SPACE)
  • For "Value Selection", set "feature:runtimeTokenCount"

6.2.5. Add the Animation service

  • Right click on "MarkedGraphAnimationViewpoint" to select "New Extension / Java Extension".
  • Set "Qualified Class Name" to "org.gemoc.sample.markedgraph.animation.services.MarkedgraphAnimationServices".
  • In the project, org.gemoc.sample.markedgraph.animation project, in "src/org.gemoc.sample.markedgraph.animation.services", copy the MarkedgraphDebugServices.java file to MarkedgraphAnimationServices.java, and edit the file to

    • replace AbstractGemocDebuggerServices by AbstractGemocAnimatorServices in its source code (two times: import and extends)
    • replace "Debug" by "Animation" (two times).