Skip to content
Snippets Groups Projects
Commit 29c37343 authored by Alexander Diewald's avatar Alexander Diewald
Browse files

- HotFix: Correct the ComponentMultiAllocation Constraint validation to handle...

- HotFix: Correct the ComponentMultiAllocation Constraint validation to handle Instantiated Components.
parent 1bb92e43
No related branches found
No related tags found
No related merge requests found
......@@ -24,6 +24,7 @@ import java.util.Collection;
import java.util.Collections;
import org.eclipse.emf.ecore.EObject;
import org.fortiss.af3.component.model.Component;
import org.fortiss.af3.exploration.alg.dse.backend.opt4j.encoding.taskmapping.instantiatedmapping.InstantiatedTaskMappingEncoding;
import org.fortiss.af3.exploration.alg.dse.backend.opt4j.encoding.taskmapping.instantiatedmapping.InstantiatedTaskMappingEntry;
import org.fortiss.af3.exploration.alg.dse.backend.opt4j.extensions.compositegene.phenotype.FlatPhenotypeMap;
......@@ -107,10 +108,19 @@ public class ComponentMultiAllocationConstraintEvaluator<S extends InstantiatedT
/** {@inheritDoc} */
@Override
public boolean validateInternal(ExplorationConstraint<?> expTarget, T solution, Value<?> value) {
Collection<IMappingEntry> entries =
solution.getIMappingEntriesOf(systemModelAdapter
.getDeployableComponentOf(((ComponentMultiAllocationConstraint)expTarget)
.getComponent()));
Component constrComp = ((ComponentMultiAllocationConstraint)expTarget).getComponent();
Collection<IMappingEntry> entries = new ArrayList<>();
for(IMappingEntry mappingEntry : solution.getIMappingEntries()) {
IDeployableComponentAdapter<?> compAdp = mappingEntry.getDeployableComponent();
if(compAdp.getObject() == constrComp) {
entries.add(mappingEntry);
} else if(compAdp.isInstantiation() &&
compAdp.getReplacedComponent().getObject() == constrComp) {
// CompocompAdp.getReplacedComponent().getObject();
entries.add(mappingEntry);
}
}
if(entries.isEmpty()) {
return false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment