Search in sources :

Example 16 with Operation

use of org.osate.aadl2.Operation 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)

Example 17 with Operation

use of org.osate.aadl2.Operation in project osate2 by osate.

the class CreateErrorPathPaletteCommand method getOperation.

@Override
public Optional<Operation> getOperation(final GetCreateConnectionOperationContext ctx) {
    // Check if the destination is a potential end
    if (!ErrorFlowPaletteCommandUtil.isPotentialEnd(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.createErrorModelSubclausePromptAndModifyOperation(classifierSourceBoc, () -> {
        final CombinedErrorModelSubclause combined = CombinedErrorModelSubclause.create(ErrorModelGeUtil.getClassifier(classifierSourceBoc).get());
        // Validate both the source and the destination
        return (ErrorFlowPaletteCommandUtil.validateAndShowError(combined, ctx.getSource(), DirectionType.IN) && ErrorFlowPaletteCommandUtil.validateAndShowError(combined, ctx.getDestination(), DirectionType.OUT)) ? Optional.of(true) : Optional.empty();
    }, (subclause, unused) -> {
        final ErrorPath newFlow = ErrorModelFactory.eINSTANCE.createErrorPath();
        // Set name
        final String newName = ErrorModelNamingUtil.buildUniqueIdentifier(subclause.getContainingClassifier(), "new_error_flow");
        newFlow.setName(newName);
        // Set the incoming and outgoing fields of the flow
        final CombinedErrorModelSubclause combined = CombinedErrorModelSubclause.create(subclause.getContainingClassifier());
        final boolean allSrc = ErrorFlowPaletteCommandUtil.isAll(ctx.getSource());
        if (allSrc) {
            newFlow.setAllIncoming(allSrc);
        } else {
            newFlow.setIncoming(ErrorFlowPaletteCommandUtil.findErrorPropagationOrThrow(combined, ctx.getSource(), DirectionType.IN));
        }
        final boolean allDst = ErrorFlowPaletteCommandUtil.isAll(ctx.getDestination());
        if (allDst) {
            newFlow.setAllOutgoing(allDst);
        } else {
            newFlow.setOutgoing(ErrorFlowPaletteCommandUtil.findErrorPropagationOrThrow(combined, ctx.getDestination(), DirectionType.OUT));
        }
        // Add the flow to the subclause
        subclause.getFlows().add(newFlow);
        return StepResultBuilder.create().showNewBusinessObject(classifierSourceBoc, newFlow).build();
    });
}
Also used : Operation(org.osate.ge.operations.Operation) ErrorPath(org.osate.xtext.aadl2.errormodel.errorModel.ErrorPath) CombinedErrorModelSubclause(org.osate.ge.errormodel.combined.CombinedErrorModelSubclause) GetCreateConnectionOperationContext(org.osate.ge.palette.GetCreateConnectionOperationContext) ErrorModelNamingUtil(org.osate.ge.errormodel.util.ErrorModelNamingUtil) ErrorModelFactory(org.osate.xtext.aadl2.errormodel.errorModel.ErrorModelFactory) StepResultBuilder(org.osate.ge.operations.StepResultBuilder) BusinessObjectContext(org.osate.ge.BusinessObjectContext) BasePaletteCommand(org.osate.ge.palette.BasePaletteCommand) CanStartConnectionContext(org.osate.ge.palette.CanStartConnectionContext) CreateConnectionPaletteCommand(org.osate.ge.palette.CreateConnectionPaletteCommand) ErrorModelGeUtil(org.osate.ge.errormodel.util.ErrorModelGeUtil) Optional(java.util.Optional) DirectionType(org.osate.aadl2.DirectionType) ErrorPath(org.osate.xtext.aadl2.errormodel.errorModel.ErrorPath) CombinedErrorModelSubclause(org.osate.ge.errormodel.combined.CombinedErrorModelSubclause) BusinessObjectContext(org.osate.ge.BusinessObjectContext)

Example 18 with Operation

use of org.osate.aadl2.Operation in project osate2 by osate.

the class CreateErrorPropagationPaletteCommand method getOperation.

@Override
public Optional<Operation> getOperation(final GetTargetedOperationContext ctx) {
    final Object bo = ctx.getTarget().getBusinessObject();
    if (bo instanceof Feature) {
        return createPropgationCreationOperation(ctx.getTarget(), (newPropagation, subclause) -> {
            // Find the feature in the context of the EMV subclause. This is needed for reliable serialization.
            final List<URI> path = ErrorModelGeUtil.createQualifiedPropagationPointPath(ctx.getTarget(), ErrorModelGeUtil.getClassifierSourceBoc(ctx.getTarget()).get(), new ArrayList<>());
            newPropagation.setFeatureorPPRef(buildFeatureReference(subclause.eResource().getResourceSet(), path));
        });
    } else if (bo instanceof KeywordPropagationPoint) {
        final KeywordPropagationPoint kw = (KeywordPropagationPoint) bo;
        if (kw.getType() != KeywordPropagationPointType.ALL) {
            return createPropgationCreationOperation(ctx.getTarget(), (newPropagation, subclause) -> newPropagation.setKind(kw.getType().getKind()));
        }
    } else if (bo instanceof PropagationPoint) {
        return createPropgationCreationOperation(ctx.getTarget(), (newPropagation, subclause) -> {
            // Find the propagation in the context of the EMV subclause.
            // Check inherited subclauses as well. This is needed for reliable serialization.
            final CombinedErrorModelSubclause combined = CombinedErrorModelSubclause.create(subclause.getContainingClassifier());
            final String boName = ((PropagationPoint) bo).getName();
            final PropagationPoint pp = combined.getPoints().filter(p -> Objects.equal(p.getName(), boName)).findAny().orElseThrow(() -> new AadlGraphicalEditorException("Unable to find propagation point"));
            final FeatureorPPReference ppRef = ErrorModelFactory.eINSTANCE.createFeatureorPPReference();
            ppRef.setFeatureorPP(pp);
            newPropagation.setFeatureorPPRef(ppRef);
        });
    }
    return Optional.empty();
}
Also used : URI(org.eclipse.emf.common.util.URI) Feature(org.osate.aadl2.Feature) PropagationPoint(org.osate.xtext.aadl2.errormodel.errorModel.PropagationPoint) KeywordPropagationPointType(org.osate.ge.errormodel.model.KeywordPropagationPointType) ResourceSet(org.eclipse.emf.ecore.resource.ResourceSet) ArrayList(java.util.ArrayList) PropagationTreeUtil(org.osate.ge.errormodel.combined.PropagationTreeUtil) ErrorPropagation(org.osate.xtext.aadl2.errormodel.errorModel.ErrorPropagation) BusinessObjectContext(org.osate.ge.BusinessObjectContext) BasePaletteCommand(org.osate.ge.palette.BasePaletteCommand) ErrorModelUiUtil(org.osate.ge.errormodel.ui.ErrorModelUiUtil) BiConsumer(java.util.function.BiConsumer) DirectionType(org.osate.aadl2.DirectionType) Objects(com.google.common.base.Objects) MessageDialog(org.eclipse.jface.dialogs.MessageDialog) AadlGraphicalEditorException(org.osate.ge.aadl2.AadlGraphicalEditorException) GetTargetedOperationContext(org.osate.ge.palette.GetTargetedOperationContext) Operation(org.osate.ge.operations.Operation) CombinedErrorModelSubclause(org.osate.ge.errormodel.combined.CombinedErrorModelSubclause) EObject(org.eclipse.emf.ecore.EObject) AadlPackage(org.osate.aadl2.AadlPackage) KeywordPropagationPoint(org.osate.ge.errormodel.model.KeywordPropagationPoint) Display(org.eclipse.swt.widgets.Display) FeatureorPPReference(org.osate.xtext.aadl2.errormodel.errorModel.FeatureorPPReference) ErrorModelFactory(org.osate.xtext.aadl2.errormodel.errorModel.ErrorModelFactory) List(java.util.List) StepResultBuilder(org.osate.ge.operations.StepResultBuilder) PropagationNode(org.osate.ge.errormodel.combined.PropagationNode) StringUtil(org.osate.ge.StringUtil) ErrorModelSubclause(org.osate.xtext.aadl2.errormodel.errorModel.ErrorModelSubclause) ErrorModelGeUtil(org.osate.ge.errormodel.util.ErrorModelGeUtil) Optional(java.util.Optional) NamedElement(org.osate.aadl2.NamedElement) TargetedPaletteCommand(org.osate.ge.palette.TargetedPaletteCommand) PropagationPoint(org.osate.xtext.aadl2.errormodel.errorModel.PropagationPoint) KeywordPropagationPoint(org.osate.ge.errormodel.model.KeywordPropagationPoint) AadlGraphicalEditorException(org.osate.ge.aadl2.AadlGraphicalEditorException) KeywordPropagationPoint(org.osate.ge.errormodel.model.KeywordPropagationPoint) EObject(org.eclipse.emf.ecore.EObject) CombinedErrorModelSubclause(org.osate.ge.errormodel.combined.CombinedErrorModelSubclause) Feature(org.osate.aadl2.Feature) URI(org.eclipse.emf.common.util.URI) FeatureorPPReference(org.osate.xtext.aadl2.errormodel.errorModel.FeatureorPPReference)

Example 19 with Operation

use of org.osate.aadl2.Operation in project osate2 by osate.

the class CreateErrorPropagationPaletteCommand method createPropgationCreationOperation.

/**
 * Creates an operation for creating a propagation for the target.
 * @param target is the target of the propagation. It should be the context which will be the parent of the propagation
 * @param init function called to finish initializing the propagation. It must set the kind or the feature or PP reference.
 * @return the operation or an empty optional if a classifier could not be determined.
 */
private Optional<Operation> createPropgationCreationOperation(final BusinessObjectContext target, final BiConsumer<ErrorPropagation, ErrorModelSubclause> init) {
    return ErrorModelGeUtil.getClassifierSourceBoc(target).flatMap(container -> {
        final AadlPackage pkg = container.getBusinessObject(NamedElement.class).map(ne -> ne.getElementRoot()).map(root -> root instanceof AadlPackage ? ((AadlPackage) root) : null).orElseThrow(() -> new AadlGraphicalEditorException("Unable to find model"));
        return ErrorModelGeUtil.createErrorModelSubclausePromptAndModifyOperation(container, () -> {
            if (propagationAlreadyExists(target)) {
                final String propagationOrContainmentLabel = (containment ? "containment" : "propagation");
                final String inputOrOutputLabel = direction == DirectionType.IN ? "intput" : "output";
                MessageDialog.openError(Display.getDefault().getActiveShell(), "Unable to create " + propagationOrContainmentLabel, "Propagation already exists. A propagation point may only have one " + inputOrOutputLabel + " error " + propagationOrContainmentLabel + " defined.");
                return Optional.empty();
            }
            return ErrorModelUiUtil.promptForTypeSet(pkg);
        }, (subclause, typeSet) -> {
            final ErrorPropagation newPropagation = ErrorModelFactory.eINSTANCE.createErrorPropagation();
            newPropagation.setTypeSet(typeSet);
            newPropagation.setNot(containment);
            newPropagation.setDirection(direction);
            init.accept(newPropagation, subclause);
            subclause.getPropagations().add(newPropagation);
            return StepResultBuilder.create().showNewBusinessObject(target, newPropagation).build();
        });
    });
}
Also used : URI(org.eclipse.emf.common.util.URI) Feature(org.osate.aadl2.Feature) PropagationPoint(org.osate.xtext.aadl2.errormodel.errorModel.PropagationPoint) KeywordPropagationPointType(org.osate.ge.errormodel.model.KeywordPropagationPointType) ResourceSet(org.eclipse.emf.ecore.resource.ResourceSet) ArrayList(java.util.ArrayList) PropagationTreeUtil(org.osate.ge.errormodel.combined.PropagationTreeUtil) ErrorPropagation(org.osate.xtext.aadl2.errormodel.errorModel.ErrorPropagation) BusinessObjectContext(org.osate.ge.BusinessObjectContext) BasePaletteCommand(org.osate.ge.palette.BasePaletteCommand) ErrorModelUiUtil(org.osate.ge.errormodel.ui.ErrorModelUiUtil) BiConsumer(java.util.function.BiConsumer) DirectionType(org.osate.aadl2.DirectionType) Objects(com.google.common.base.Objects) MessageDialog(org.eclipse.jface.dialogs.MessageDialog) AadlGraphicalEditorException(org.osate.ge.aadl2.AadlGraphicalEditorException) GetTargetedOperationContext(org.osate.ge.palette.GetTargetedOperationContext) Operation(org.osate.ge.operations.Operation) CombinedErrorModelSubclause(org.osate.ge.errormodel.combined.CombinedErrorModelSubclause) EObject(org.eclipse.emf.ecore.EObject) AadlPackage(org.osate.aadl2.AadlPackage) KeywordPropagationPoint(org.osate.ge.errormodel.model.KeywordPropagationPoint) Display(org.eclipse.swt.widgets.Display) FeatureorPPReference(org.osate.xtext.aadl2.errormodel.errorModel.FeatureorPPReference) ErrorModelFactory(org.osate.xtext.aadl2.errormodel.errorModel.ErrorModelFactory) List(java.util.List) StepResultBuilder(org.osate.ge.operations.StepResultBuilder) PropagationNode(org.osate.ge.errormodel.combined.PropagationNode) StringUtil(org.osate.ge.StringUtil) ErrorModelSubclause(org.osate.xtext.aadl2.errormodel.errorModel.ErrorModelSubclause) ErrorModelGeUtil(org.osate.ge.errormodel.util.ErrorModelGeUtil) Optional(java.util.Optional) NamedElement(org.osate.aadl2.NamedElement) TargetedPaletteCommand(org.osate.ge.palette.TargetedPaletteCommand) AadlPackage(org.osate.aadl2.AadlPackage) AadlGraphicalEditorException(org.osate.ge.aadl2.AadlGraphicalEditorException) ErrorPropagation(org.osate.xtext.aadl2.errormodel.errorModel.ErrorPropagation) NamedElement(org.osate.aadl2.NamedElement)

Example 20 with Operation

use of org.osate.aadl2.Operation in project osate2 by osate.

the class AadlBaTypeChecker method subprogramParameterListCheck.

// This method checks the given parameter labels and matches them against the
// subprogram parameters. It resolves target/value expression semantic
// ambiguities. On error, reports error and returns false.
// Event if the subprogram call action doesn't have any parameter labels,
// the subprogram type may have and vice versa : subprogramParameterListCheck
// / is also design for these cases.
/**
 * Document: AADL Behavior Annex draft
 * Version : 0.94
 * Type : Legality rule
 * Section : D.6 Behavior Action Language
 * Object : Check legality rule D.6.(L5)
 * Keys : parameter list match signature subprogram call
 */
private boolean subprogramParameterListCheck(CommAction comAct, EList<ParameterLabel> callParams, Classifier subprogType) {
    // Fetches sorted subprogram feature list.
    List<Feature> tmp = Aadl2Utils.orderFeatures(subprogType);
    List<Feature> subprogFeat = new ArrayList<Feature>(tmp.size());
    for (Feature feat : tmp) {
        if (feat instanceof DataAccess || feat instanceof Parameter) {
            subprogFeat.add(feat);
        }
    }
    // Preliminary checking : on error, reports error and exit early.
    if (callParams.size() != subprogFeat.size()) {
        String subprogramName = null;
        if (comAct.getReference() != null) {
            subprogramName = unparseReference(comAct.getReference());
        } else {
            subprogramName = unparseQualifiedNamedElement(comAct.getQualifiedName());
        }
        reportError(comAct, "Invalid number of argument(s) for the subprogram " + subprogramName);
        return false;
    }
    boolean isconsistent = true;
    boolean hasCheckingPassed = true;
    Enum<?> currentDirRight;
    ValueExpression valueExp;
    ListIterator<ParameterLabel> it = callParams.listIterator();
    Value v;
    Target tar;
    TypeHolder t1, t2;
    ValueAndTypeHolder vth;
    List<TypeHolder> typesFound = new ArrayList<TypeHolder>(callParams.size());
    List<Enum<?>> dirRightsFound = new ArrayList<Enum<?>>(callParams.size());
    List<TypeHolder> expectedTypes = new ArrayList<TypeHolder>(subprogFeat.size());
    List<Enum<?>> expectedDirRight = new ArrayList<Enum<?>>(subprogFeat.size());
    // driven by the subprogram signature.
    for (Feature feat : subprogFeat) {
        if (feat instanceof Parameter) {
            Parameter param = (Parameter) feat;
            currentDirRight = param.getDirection();
            expectedDirRight.add(currentDirRight);
        } else // DataAccess case.
        {
            DataAccess data = (DataAccess) feat;
            currentDirRight = Aadl2Utils.getDataAccessRight(data);
            expectedDirRight.add(currentDirRight);
        }
        valueExp = (ValueExpression) it.next();
        Classifier klass = AadlBaUtils.getClassifier(feat, _baParentContainer);
        // ValueExpression case.
        if (currentDirRight == DirectionType.IN || currentDirRight == Aadl2Utils.DataAccessRight.read_only) {
            vth = valueExpressionCheck(valueExp);
            if (vth != null) {
                try {
                    t1 = AadlBaUtils.getTypeHolder(klass);
                } catch (DimensionException de) {
                    reportDimensionException(de);
                    return false;
                }
                t2 = vth.typeHolder;
                expectedTypes.add(t1);
                typesFound.add(t2);
                dirRightsFound.add(DirectionType.IN);
                if (!_dataChecker.conformsTo(t1, t2, true)) {
                    isconsistent = false;
                }
            } else // Value expression checking error case.
            {
                // Error reporting has already been done.
                hasCheckingPassed = false;
            }
        } else if (currentDirRight != Aadl2Utils.DataAccessRight.unknown) {
            v = AadlBaUtils.isOnlyOneValue(valueExp);
            boolean isOnlyOneReference = false;
            if (v instanceof Reference) {
                Reference r = (Reference) v;
                if (r.getIds().size() == 1) {
                    isOnlyOneReference = true;
                }
            }
            if (// Target but not reference case.
            v instanceof Target && isOnlyOneReference) {
                TypeCheckRule stopOnThisRule = TypeCheckRule.DATA_ACCESS;
                tar = targetCheck((Target) v, stopOnThisRule);
                if (tar != null) {
                    try {
                        t1 = AadlBaUtils.getTypeHolder(klass);
                        t2 = AadlBaUtils.getTypeHolder(tar, _baParentContainer);
                    } catch (DimensionException de) {
                        reportDimensionException(de);
                        return false;
                    }
                    expectedTypes.add(t1);
                    typesFound.add(t2);
                    Enum<?> dirRightFound = AadlBaUtils.getDirectionType(tar);
                    if (dirRightFound == null) {
                        dirRightFound = AadlBaUtils.getDataAccessRight(tar);
                    }
                    dirRightsFound.add(dirRightFound);
                    if (!_dataChecker.conformsTo(t1, t2, true)) {
                        isconsistent = false;
                    } else {
                        // As checking passed and ambiguity between
                        // ValueExpression and Target has been resolved, it replaces
                        // the value expression by the target as parameter label.
                        it.set(tar);
                    }
                } else // Target checking error case.
                {
                    // Error reporting has already been done.
                    hasCheckingPassed = false;
                }
            } else // Value expression taken as a target -> warning arithmetic pointer operation.
            {
                // Due to target/value expression semantic ambiguity, the parsing
                // phase may have introduced a semantic errors :
                // If v == null :
                // The parameter label has
                // to be a value expression with a single value when the expected
                // subprogram parameter is IN_OUT or OUT.
                // If v is not instanceof Target but ValueExpression or Value
                // like :
                // _ IntegerConstant or ValueConstant
                // _ PortFreshValue
                // _ PortCountValue
                // _ PortDequeueValue
                // It resolves the type in order to format the warning message:
                vth = valueExpressionCheck(valueExp);
                if (vth != null) {
                    try {
                        t1 = AadlBaUtils.getTypeHolder(klass);
                    } catch (DimensionException de) {
                        reportDimensionException(de);
                        return false;
                    }
                    t2 = vth.typeHolder;
                    expectedTypes.add(t1);
                    typesFound.add(t2);
                    boolean inconsistentDir = false;
                    if (v instanceof Reference) {
                        Reference ref = (Reference) v;
                        ArrayableIdentifier refRootId = ref.getIds().get(0);
                        Enum<?> dirRightFound = null;
                        if (refRootId.getOsateRef() != null) {
                            dirRightFound = AadlBaUtils.getDirectionType(refRootId.getOsateRef());
                        }
                        if (dirRightFound == null && refRootId.getOsateRef() instanceof DataAccess) {
                            dirRightFound = Aadl2Utils.getDataAccessRight((DataAccess) refRootId.getOsateRef());
                        }
                        if (dirRightFound == DirectionType.IN || dirRightFound == Aadl2Utils.DataAccessRight.read_only) {
                            inconsistentDir = true;
                        }
                    } else {
                        inconsistentDir = true;
                        dirRightsFound.add(DirectionType.IN);
                    }
                    if (inconsistentDir) {
                        StringBuilder msg = new StringBuilder();
                        msg.append('\'');
                        msg.append(unparseNameElement(valueExp));
                        msg.append("\': is a read only value and it is used as a writable value");
                        // Reports a warning.
                        reportWarning(valueExp, msg.toString());
                    }
                } else {
                    // Error reporting has already been done.
                    hasCheckingPassed = false;
                }
            }
        } else {
            reportError(valueExp, "can't fetch data access right. Set the default " + "right in memory_properties.aadl");
        }
    }
    // Reports consistency error.
    if (!isconsistent && hasCheckingPassed) {
        String subprogramName = null;
        if (comAct.getReference() != null) {
            subprogramName = unparseReference(comAct.getReference());
        } else {
            subprogramName = unparseQualifiedNamedElement(comAct.getQualifiedName());
        }
        reportSubprogParamMatchingError(comAct, subprogramName, expectedTypes, expectedDirRight, typesFound, dirRightsFound);
    }
    return isconsistent && hasCheckingPassed;
}
Also used : LocationReference(org.osate.aadl2.parsesupport.LocationReference) Reference(org.osate.ba.declarative.Reference) DeclarativePropertyReference(org.osate.ba.declarative.DeclarativePropertyReference) ArrayList(java.util.ArrayList) Classifier(org.osate.aadl2.Classifier) ComponentClassifier(org.osate.aadl2.ComponentClassifier) DataClassifier(org.osate.aadl2.DataClassifier) ProcessorClassifier(org.osate.aadl2.ProcessorClassifier) Feature(org.osate.aadl2.Feature) ArrayableIdentifier(org.osate.ba.declarative.ArrayableIdentifier) DataAccess(org.osate.aadl2.DataAccess) NamedValue(org.osate.ba.declarative.NamedValue) NumberValue(org.osate.aadl2.NumberValue) ClassifierValue(org.osate.aadl2.ClassifierValue) Parameter(org.osate.aadl2.Parameter) DimensionException(org.osate.ba.utils.DimensionException)

Aggregations

ArrayList (java.util.ArrayList)86 Test (org.junit.Test)75 AbstractMessage (com.google.protobuf.AbstractMessage)65 Operation (com.google.cloud.compute.v1.Operation)49 Operation (com.google.container.v1.Operation)43 StatusCondition (com.google.container.v1.StatusCondition)40 Operation (com.google.container.v1beta1.Operation)24 StatusCondition (com.google.container.v1beta1.StatusCondition)23 InstancesClient (com.google.cloud.compute.v1.InstancesClient)20 Operation (com.reprezen.kaizen.oasparser.model3.Operation)16 Path (com.reprezen.kaizen.oasparser.model3.Path)15 Operation (net.opengis.ows.v_1_0_0.Operation)15 Instance (com.google.cloud.compute.v1.Instance)13 Parameter (com.reprezen.kaizen.oasparser.model3.Parameter)13 DomainType (net.opengis.ows.v_1_0_0.DomainType)13 AttachedDisk (com.google.cloud.compute.v1.AttachedDisk)12 AadlPackage (org.osate.aadl2.AadlPackage)12 InsertInstanceRequest (com.google.cloud.compute.v1.InsertInstanceRequest)11 List (java.util.List)9 Optional (java.util.Optional)9