public RefOntoUML.GeneralizationSet DealGeneralizationSet( org.eclipse.uml2.uml.GeneralizationSet gs1) { System.out.print("[Generalization Set] "); RefOntoUML.GeneralizationSet gs2 = myfactory.createGeneralizationSet(); DealNamedElement(gs1, gs2); // Add all the generalizations for (org.eclipse.uml2.uml.Generalization gen1 : gs1.getGeneralizations()) { RefOntoUML.Generalization gen2 = (RefOntoUML.Generalization) GetElement(gen1); // Poderia ter setado apenas um dos dois (GeneralizationSet::Generalization, // Generalization::GeneralizationSet), ja que sao EOpposites gs2.getGeneralization().add(gen2); gen2.getGeneralizationSet().add(gs2); } // isCovering, isDisjoint gs2.setIsCovering(gs1.isCovering()); gs2.setIsDisjoint(gs1.isDisjoint()); // They are PackageableElements, don't forget it RelateElements(gs1, gs2); return gs2; }
public void DealGeneralization(org.eclipse.uml2.uml.Generalization gen1) { System.out.print("[Generalization]: "); RefOntoUML.Generalization gen2 = myfactory.createGeneralization(); // source (Specific) org.eclipse.uml2.uml.Classifier e1 = gen1.getSpecific(); RefOntoUML.Classifier e2 = (RefOntoUML.Classifier) GetElement(e1); System.out.print(e1.getName() + " -> "); // Poderia ter setado apenas um dos dois (Generalization::Specific, Classifier::Generalization), // ja que sao EOpposites gen2.setSpecific(e2); // O Specific tem posse do generalization e2.getGeneralization().add(gen2); // target (General) e1 = gen1.getGeneral(); e2 = (RefOntoUML.Classifier) GetElement(e1); System.out.println(e1.getName()); gen2.setGeneral(e2); // Important for GeneralizationSet RelateElements(gen1, gen2); }