Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "VIATRA2/Live Transformations/HelloWorld"
(New page: The following "hello world" trigger shows another important property of the live transformation engine, the handling of the ASMfunctions. These can be considered as global variables, the v...) |
m (Added outdated page notice) |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
− | The following "hello world" trigger | + | == Outdated page == |
+ | This page contains obsolete information about the VPM based VIATRA2 and preserved for archive purposes only.<br /> | ||
+ | The currently maintained wiki is available at http://wiki.eclipse.org/VIATRA | ||
+ | |||
+ | __NOTOC__ | ||
+ | |||
+ | The following "hello world" trigger is actually the simplest trigger one can write. If we start this trigger, then the action sequence will be executed after each entity creation in the model space. | ||
<source lang="java"> | <source lang="java"> | ||
machine HelloTriggerWorld | machine HelloTriggerWorld | ||
{ | { | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
@Trigger(priority='100', mode='always', sensitivity='rise', startup='passive', execution='iterate') | @Trigger(priority='100', mode='always', sensitivity='rise', startup='passive', execution='iterate') | ||
gtrule testTrigger(inout E) = | gtrule testTrigger(inout E) = | ||
Line 23: | Line 23: | ||
{ | { | ||
println( "Trigger Action triggered by: " + E ); | println( "Trigger Action triggered by: " + E ); | ||
− | |||
− | |||
} | } | ||
} | } | ||
Line 32: | Line 30: | ||
seq | seq | ||
{ | { | ||
− | |||
println ( startTrigger("testTrigger") ); | println ( startTrigger("testTrigger") ); | ||
} | } | ||
} | } | ||
</source> | </source> |
Latest revision as of 04:13, 30 April 2015
Outdated page
This page contains obsolete information about the VPM based VIATRA2 and preserved for archive purposes only.
The currently maintained wiki is available at http://wiki.eclipse.org/VIATRA
The following "hello world" trigger is actually the simplest trigger one can write. If we start this trigger, then the action sequence will be executed after each entity creation in the model space.
machine HelloTriggerWorld { @Trigger(priority='100', mode='always', sensitivity='rise', startup='passive', execution='iterate') gtrule testTrigger(inout E) = { // This pattern triggers the action sequence. precondition pattern lhs(E)= { entity(E); } // The action sequence. action { println( "Trigger Action triggered by: " + E ); } } //Main rule, the startTrigger() method invokes the engine. rule main() = seq { println ( startTrigger("testTrigger") ); } }