blob: 82b05f7ae898c2f1a1e181749e42c9ebc09e5fed [file] [log] [blame]
modeltype ECORE uses 'http://www.eclipse.org/emf/2002/Ecore';
transformation t(
in inModel : ECORE, out outModel : ECORE);
main() {
inModel.rootObjects()[EPackage]->map p2p();
}
constructor EClass::EClass(s : String, op : EOperation) {
name := s;
eOperations += op;
}
mapping EPackage::p2p() : EPackage {
name := self.name;
eClassifiers += self.eClassifiers->map c2c();
}
mapping EClassifier::c2c() : EClassifier {
init {
if (self.name = 'A') then {
result := new EDataType();
} else {
result := new EClass();
} endif;
}
name := 'mapped' + self.name;
}