[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[henshin-dev] Problem with "destructive operations" on rule-nodes
|
Hello all,
I have a problem whilst doing matches with Henshin API.
As Christian suggested some time ago, I set the types of nodes in rules via
getType() and setType() methods.
This happens via some instances of the class "ClicheInstance" which owns
the method getAllMatches (see attached source).
Now I found out that the modifications I apply to the transformation
model seem to be applied down to the resource, so that I get funny
effects when using different modifications to rules and transformations
on one transformation model at a time.
I had a look at the Henshin sources and got the following question:
Am I right that if I want do to several type modifications at a time, my
only chance is to create seperate HenshinResourceSets for each of the
ClicheInstance-instances?
Jens
public Iterable<Match> getAllMatches() {
Module module = model.getTransformationModule();
EGraph modelGraph = model.getModelGraph();
Rule rule = (Rule) module.getUnit(cliche);
EngineImpl transformationEngine = new EngineImpl();
for (Assignment a : nodeAssignmentList) {
EClass cls = ((Rule) module.getUnit("lib." + a.getValue()))
.getLhs().getNode("libNode").getType();
rule.getLhs().getNode(a.getName()).setType(cls);
rule.getRhs().getNode(a.getName()).setType(cls);
}
return transformationEngine.findMatches(rule, modelGraph, null);
}