Search in sources :

Example 1 with PropagationPath

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();
}
Also used : PropagationPath(org.osate.xtext.aadl2.errormodel.errorModel.PropagationPath) ErrorModelSubclause(org.osate.xtext.aadl2.errormodel.errorModel.ErrorModelSubclause) LinkedHashMap(java.util.LinkedHashMap)

Example 2 with PropagationPath

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);
        }
    }
}
Also used : PropagationPath(org.osate.xtext.aadl2.errormodel.errorModel.PropagationPath) ComponentInstance(org.osate.aadl2.instance.ComponentInstance)

Example 3 with 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);
        }
    }
}
Also used : PropagationPath(org.osate.xtext.aadl2.errormodel.errorModel.PropagationPath) ComponentInstance(org.osate.aadl2.instance.ComponentInstance)

Example 4 with 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);
}
Also used : ComponentInstance(org.osate.aadl2.instance.ComponentInstance) ErrorPropagation(org.osate.xtext.aadl2.errormodel.errorModel.ErrorPropagation)

Example 5 with PropagationPath

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();
    });
}
Also used : URI(org.eclipse.emf.common.util.URI) Feature(org.osate.aadl2.Feature) PropagationPoint(org.osate.xtext.aadl2.errormodel.errorModel.PropagationPoint) GetCreateConnectionOperationContext(org.osate.ge.palette.GetCreateConnectionOperationContext) ResourceSet(org.eclipse.emf.ecore.resource.ResourceSet) ArrayList(java.util.ArrayList) BusinessObjectContext(org.osate.ge.BusinessObjectContext) BasePaletteCommand(org.osate.ge.palette.BasePaletteCommand) CanStartConnectionContext(org.osate.ge.palette.CanStartConnectionContext) CreateConnectionPaletteCommand(org.osate.ge.palette.CreateConnectionPaletteCommand) Subcomponent(org.osate.aadl2.Subcomponent) FeatureGroup(org.osate.aadl2.FeatureGroup) AadlGraphicalEditorException(org.osate.ge.aadl2.AadlGraphicalEditorException) SubcomponentElement(org.osate.xtext.aadl2.errormodel.errorModel.SubcomponentElement) QualifiedPropagationPoint(org.osate.xtext.aadl2.errormodel.errorModel.QualifiedPropagationPoint) Operation(org.osate.ge.operations.Operation) EObject(org.eclipse.emf.ecore.EObject) PropagationPath(org.osate.xtext.aadl2.errormodel.errorModel.PropagationPath) ErrorModelNamingUtil(org.osate.ge.errormodel.util.ErrorModelNamingUtil) ErrorModelFactory(org.osate.xtext.aadl2.errormodel.errorModel.ErrorModelFactory) List(java.util.List) StepResultBuilder(org.osate.ge.operations.StepResultBuilder) ErrorModelSubclause(org.osate.xtext.aadl2.errormodel.errorModel.ErrorModelSubclause) ErrorModelGeUtil(org.osate.ge.errormodel.util.ErrorModelGeUtil) Optional(java.util.Optional) NamedElement(org.osate.aadl2.NamedElement) PropagationPath(org.osate.xtext.aadl2.errormodel.errorModel.PropagationPath) BusinessObjectContext(org.osate.ge.BusinessObjectContext)

Aggregations

PropagationPath (org.osate.xtext.aadl2.errormodel.errorModel.PropagationPath)8 ComponentInstance (org.osate.aadl2.instance.ComponentInstance)4 ErrorPropagation (org.osate.xtext.aadl2.errormodel.errorModel.ErrorPropagation)4 PropagationPoint (org.osate.xtext.aadl2.errormodel.errorModel.PropagationPoint)4 EObject (org.eclipse.emf.ecore.EObject)2 Classifier (org.osate.aadl2.Classifier)2 ComponentImplementation (org.osate.aadl2.ComponentImplementation)2 BusinessObjectContext (org.osate.ge.BusinessObjectContext)2 ErrorFlow (org.osate.xtext.aadl2.errormodel.errorModel.ErrorFlow)2 ErrorModelSubclause (org.osate.xtext.aadl2.errormodel.errorModel.ErrorModelSubclause)2 TypeSet (org.osate.xtext.aadl2.errormodel.errorModel.TypeSet)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 LinkedHashMap (java.util.LinkedHashMap)1 List (java.util.List)1 Optional (java.util.Optional)1 URI (org.eclipse.emf.common.util.URI)1 EPackage (org.eclipse.emf.ecore.EPackage)1 ResourceSet (org.eclipse.emf.ecore.resource.ResourceSet)1