Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[henshin-dev] Henshin Trace object

Hi all,

I have a problem with the Henshin Trace object. I create in a rule a Trace between two elements of different meta models and I want to add the Trace object to both instance models:

// Add new elements.
for (EObject root : roots) {
if (root.getClass().getPackage().getName().equals(SA_PACKAGE)) {
if (!oldSAElements.contains(root)) {
saInstanceModel.getContents().add(root);
}
} else if (root.getClass().getPackage().getName().equals(FAULTTREE_PACKAGE)) {
if (!oldFaulttreeElements.contains(root)) {
faulttreeInstanceModel.getContents().add(root);
}
} else if (root.getClass().getPackage().getName().equals(TRACE_PACKAGE)) {
if (root instanceof Trace) {
// TODO: Trace is added to only one model?
Trace trace = (Trace) root;
saInstanceModel.getContents().add(trace);
faulttreeInstanceModel.getContents().add(trace);
}
} else {
throw new RuntimeException("Unknown model class: " + root.getClass());
}
}

But the faulttreeInstanceModel gets always the Trace object. Isn't it possible to add a Trace twice or any advice for this problem?

Cheers,
Yannic

Back to the top