Created
November 4, 2013 14:38
-
-
Save edipofederle/7303403 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
//Dúvidas no comentários | |
private void removeInterfaceRelationships (Interface interface_, Architecture offspring){ | |
List<Relationship> relationships = new ArrayList<Relationship> (interface_.getRelationships()); | |
if(!relationships.isEmpty()){ | |
Iterator<Relationship> iteratorRelationships = relationships.iterator(); | |
while (iteratorRelationships.hasNext()){ | |
Relationship relationship= iteratorRelationships.next(); | |
if (relationship instanceof AbstractionRelationship){ | |
AbstractionRelationship abstraction = (AbstractionRelationship) relationship; | |
if (abstraction.getParent().equals(interface_)) // Pegar client ou supplier? | |
offspring.removeImplementedInterfaceFromComponent(interface_, abstraction.getChild()); // Pegar client ou supplier? (ambos sao Element) | |
} | |
else { | |
if (relationship instanceof DependencyRelationship){ | |
DependencyRelationship dependency = (DependencyRelationship) relationship; | |
if (dependency.getInterface().equals(interface_)) // Pegar client ou supplier? (ambos sao Element) | |
offspring.removeRequiredInterfaceFromComponent(interface_, dependency.getComponent());) // Pegar client ou supplier? (ambos sao Element) | |
} | |
} | |
} | |
} | |
} | |
} | |
//=================================================================================== | |
private void addDependenciesToInterface(Interface itf, Architecture offspring, Architecture parent, Concern feature){ | |
Collection<DependencyRelationship> allDependencies = parent.getAllDependencies(); | |
for (DependencyRelationship dependency: allDependencies){ | |
if (dependency.getInterface().equals(itf) && dependency.getInterface().containsConcern(feature)){ // Pegar client ou supplier? (ambos sao Element) | |
Package auxComp = offspring.findPackageByName(dependency.getPackageOfDependency().getName()); | |
offspring.addRequiredInterfaceToComponent(itf, auxComp); | |
} | |
} | |
} | |
//=================================================================================== | |
private void updateInterfaceDependencies(Interface interface_, Architecture offspring, Architecture parent){ | |
Collection<Relationship> relationships = parent.getAllRelationships(); | |
for (Relationship relationship:relationships){ | |
if (relationship instanceof DependencyRelationship){ | |
DependencyRelationship dependency = (DependencyRelationship) relationship; | |
Interface itf = dependency.getInterface(); //// Pegar client ou supplier? (ambos sao Element) | |
if (itf.equals(interface_)) { | |
Package targetComp = offspring.findPackageByName(dependency.getComponent().getName()); // Pegar client ou supplier? (ambos sao Element) | |
if (targetComp!=null){ | |
offspring.addExternalInterface(interface_); | |
offspring.addRequiredInterfaceToComponent(interface_, targetComp); | |
} | |
} | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment