Download as a PDF
Transcript
Figure 5: The rule AddTransition
that the Next relation has not yet been converted. The LHS of this rule consists of four different
objects. If you want to match the diagram and let the rest of the match be completed automatically
you would enter the following code:
Vector mappings = new Vector();
mappings.add(null);
mappings.add(null);
mappings.add(fixedDiagramEObject);
mappings.add(null);
In this case AGG will try to find a match for the Next, ActivityDiagram and PetriNet objects
while keeping the Diagram fixed. You can also pass null for the whole vector so a random match
will be chosen. The last applyRule parameter Parameter is used to set the input parameters for
the rule as defined in the EMT file. Input parameter can be defined in the following way:
Parameter parameter = new Parameter();
parameter.addParameter(String name, EObject value, String type);
In case of primitive types, for example:
parameter.addIntParameter(String name, int value);
A valid code block for defining the input parameter for the rule AddTransition would look like
this:
Parameter parameter = new Parameter();
parameter.add("newName", "transition1", "String");
After defining the match and the input parameters, the rule can be applied by:
interpreter.applyRule(root, "AddTransition", mapping, parameter);
8