use of org.eclipse.winery.topologygraph.matching.patterndetection.ComponentPatternCandidate in project winery by eclipse.
the class ComponentPatternDetection method addRelationMappings.
private void addRelationMappings(ComponentPatternCandidate componentPatternCandidate, OTPatternRefinementModel adaptedPrm) {
TNodeTemplate detectorElement = componentPatternCandidate.getDetectorElement();
TNodeTemplate refinementElement = componentPatternCandidate.getRefinementElement();
OTPatternRefinementModel otherPrm = componentPatternCandidate.getOtherPrm();
TNodeTemplate otherDetectorElement = componentPatternCandidate.getOtherDetectorElement();
// Redirect and add Relation Mappings of PDRM_x
if (otherPrm.getRelationMappings() != null) {
otherPrm.getRelationMappings().stream().filter(mapping -> mapping.getDetectorElement().getId().equals(otherDetectorElement.getId()) && mapping.getRefinementElement().getType().equals(refinementElement.getType())).forEach(mapping -> {
mapping.setDetectorElement(detectorElement);
mapping.setRefinementElement(refinementElement);
adaptedPrm.getRelationMappings().add(mapping);
});
}
}
Aggregations