Created
November 25, 2013 13:12
-
-
Save edipofederle/7641000 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void moveAttributeAllComponents(Architecture arch, Package sourceComp, Package targetComp, Class sourceClass, List<Attribute> AttributesClass, Class newClass) throws JMException { | |
Attribute targetAttribute = randomObject (AttributesClass); | |
sourceClass.moveAttributeToClass(targetAttribute, newClass); | |
for (Concern con: targetAttribute.getOwnConcerns()){ | |
try { | |
newClass.addConcern(con.getName()); | |
} catch (ConcernNotFoundException e) { | |
e.printStackTrace(); | |
} | |
} | |
if (targetComp.equals(sourceComp)){ | |
AssociationRelationship newRelationship = new AssociationRelationship(newClass, sourceClass); | |
arch.getAllRelationships().add(newRelationship); | |
} | |
else{ | |
Collection<Interface> allItfsTargetComp = targetComp.getImplementedInterfaces(); | |
Interface targetInterface = null; | |
for (Interface itf: allItfsTargetComp){ | |
for (Concern con : targetAttribute.getOwnConcerns()) | |
if (itf.containsConcern(con)) | |
targetInterface = itf; | |
} | |
if (targetInterface==null){ | |
if (targetComp.getImplementedInterfaces().isEmpty()) targetInterface=arch.createInterface("Interface"+ OPLA.contInt_++); | |
} else{ targetInterface= randomObject(new ArrayList<Interface> (targetComp.getImplementedInterfaces()));} | |
arch.addRequiredInterface(targetInterface, sourceComp); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment