use of org.osate.xtext.aadl2.errormodel.errorModel.PropagationPath in project osate2 by osate.
the class EMV2Util method getAllPropagationPaths.
/**
* return list of PropagationPaths including those inherited from classifiers being extended
* @param cl Classifier
* @return Collection<PropagationPath> list of PropagationPaths as HashMap for quick lookup of names
*/
public static Collection<PropagationPath> getAllPropagationPaths(Classifier cl) {
HashMap<String, PropagationPath> result = new LinkedHashMap<>();
EList<ErrorModelSubclause> emslist = getAllContainingClassifierEMV2Subclauses(cl);
for (ErrorModelSubclause errorModelSubclause : emslist) {
EList<PropagationPath> eflist = errorModelSubclause.getPaths();
for (PropagationPath propPointConn : eflist) {
if (!result.containsKey(propPointConn.getName())) {
result.put(propPointConn.getName(), propPointConn);
}
}
}
return result.values();
}
use of org.osate.xtext.aadl2.errormodel.errorModel.PropagationPath in project osate2 by osate.
the class AnalysisModel method populateUserDeclaredPropagationPaths.
/**
* populate with user declared propagation paths declared in this component
* instance the paths are between subcomponents
*
* @param ci
* ComponentInstance
*/
protected void populateUserDeclaredPropagationPaths(InstanceObject obj) {
if (obj instanceof ComponentInstance) {
ComponentInstance ci = (ComponentInstance) obj;
Collection<PropagationPath> pplist = EMV2Util.getAllPropagationPaths(ci.getComponentClassifier());
for (PropagationPath propagationPath : pplist) {
addUserDeclaredPropagationPath(ci, propagationPath);
}
}
}
use of org.osate.xtext.aadl2.errormodel.errorModel.PropagationPath in project osate2 by osate.
the class Util method populateUserDeclaredPropagationPaths.
protected static void populateUserDeclaredPropagationPaths(PropagationGraph pg, InstanceObject obj) {
if (obj instanceof ComponentInstance) {
ComponentInstance ci = (ComponentInstance) obj;
Collection<PropagationPath> pplist = EMV2Util.getAllPropagationPaths(ci.getComponentClassifier());
for (PropagationPath propagationPath : pplist) {
addUserDeclaredPropagationPath(pg, ci, propagationPath);
}
}
}
use of org.osate.xtext.aadl2.errormodel.errorModel.PropagationPath in project osate2 by osate.
the class Util method addUserDeclaredPropagationPath.
private static void addUserDeclaredPropagationPath(PropagationGraph pg, ComponentInstance ci, PropagationPath pp) {
ErrorPropagation srcEP = null;
ErrorPropagation dstEP = null;
ComponentInstance srcCI = getComponentInstance(ci, EMV2Util.getSubcomponents(pp.getSource()));
ComponentInstance dstCI = getComponentInstance(ci, EMV2Util.getSubcomponents(pp.getTarget()));
if (srcCI != null) {
srcEP = EMV2Util.findErrorPropagation(srcCI.getComponentClassifier(), EMV2Util.getEndPoint(pp.getSource()).getName(), DirectionType.OUT);
if (srcEP == null) {
srcEP = EMV2Util.findErrorPropagation(srcCI.getComponentClassifier(), EMV2Util.getEndPoint(pp.getSource()).getName(), DirectionType.IN);
}
}
if (dstCI != null) {
dstEP = EMV2Util.findErrorPropagation(dstCI.getComponentClassifier(), EMV2Util.getEndPoint(pp.getTarget()).getName(), DirectionType.IN);
if (dstEP == null) {
dstEP = EMV2Util.findErrorPropagation(dstCI.getComponentClassifier(), EMV2Util.getEndPoint(pp.getTarget()).getName(), DirectionType.OUT);
}
}
addPropagationpathRecord(pg, srcCI, srcEP, dstCI, dstEP);
}
use of org.osate.xtext.aadl2.errormodel.errorModel.PropagationPath in project osate2 by osate.
the class CreatePropagatonPathPaletteCommand method getOperation.
@Override
public Optional<Operation> getOperation(final GetCreateConnectionOperationContext ctx) {
// Check the type of the destination business object
if (!isValidEndpoint(ctx.getDestination())) {
return Optional.empty();
}
// Find the common ancestor which is a source for the classifier to update
final BusinessObjectContext classifierSourceBoc = BusinessObjectContext.getFirstCommonAncestor(ctx.getSource().getParent(), ctx.getDestination().getParent()).flatMap(ancestor -> ErrorModelGeUtil.getClassifierSourceBoc(ancestor)).orElse(null);
if (classifierSourceBoc == null) {
return Optional.empty();
}
return ErrorModelGeUtil.createErrorModelSubclauseModifyOperation(classifierSourceBoc, subclause -> {
final PropagationPath newPath = ErrorModelFactory.eINSTANCE.createPropagationPath();
final String newName = ErrorModelNamingUtil.buildUniqueIdentifier(subclause.getContainingClassifier(), "new_propagation_path");
newPath.setName(newName);
newPath.setSource(createQualifiedPropagationPoint(subclause, ctx.getSource(), classifierSourceBoc));
newPath.setTarget(createQualifiedPropagationPoint(subclause, ctx.getDestination(), classifierSourceBoc));
subclause.getPaths().add(newPath);
return StepResultBuilder.create().showNewBusinessObject(classifierSourceBoc, newPath).build();
});
}
Aggregations