use of org.osate.aadl2.StringLiteral in project AGREE by loonwerks.
the class AgreeASTBuilder method caseGetPropertyExpr.
@Override
public Expr caseGetPropertyExpr(GetPropertyExpr expr) {
NamedElement propName = expr.getProp();
PropertyExpression propVal;
if (propName instanceof Property) {
ComponentRef cr = expr.getComponentRef();
NamedElement compName = null;
if (cr instanceof DoubleDotRef) {
compName = ((DoubleDotRef) cr).getElm();
} else if (cr instanceof ThisRef) {
compName = curInst;
}
Property prop = (Property) propName;
propVal = AgreeUtils.getPropExpression(compName, prop);
if (propVal == null) {
if (Activator.getDefault().getPreferenceStore().getBoolean(PreferenceConstants.PREF_UNSPECIFIED_AADL_PROPERTIES)) {
String propInputName = unspecifiedAadlPropertyPrefix + compName.getName() + dotChar + prop.getName();
unspecifiedAadlProperties.put(propInputName, expr);
return new IdExpr(propInputName);
} else {
throw new AgreeException("Could not locate property value '" + prop.getQualifiedName() + "' in component '" + compName.getName() + "'. Is it possible " + "that a 'this' statement is used in a context in which it wasn't supposed to?" + " Analysis of unspecified AADL properties as inputs may be enabled in the AGREE preferences.");
}
}
} else {
propVal = AgreeUtils.getPropExpression((PropertyConstant) propName);
if (propVal == null) {
throw new AgreeException("Could not locate property value '" + propName.getQualifiedName());
}
}
Expr res = null;
if (propVal != null) {
if (propVal instanceof StringLiteral) {
// nodeStr += value.getValue() + ")";
throw new AgreeException("Property value for '" + propName.getQualifiedName() + "' cannot be of string type");
} else if (propVal instanceof NamedValue) {
// EnumerationLiteral enVal = (EnumerationLiteral) absVal;
throw new AgreeException("Property value for '" + propName.getQualifiedName() + "' cannot be of enumeration type");
} else if (propVal instanceof BooleanLiteral) {
BooleanLiteral value = (BooleanLiteral) propVal;
res = new BoolExpr(value.getValue());
} else if (propVal instanceof IntegerLiteral) {
IntegerLiteral value = (IntegerLiteral) propVal;
res = new IntExpr(BigInteger.valueOf((long) value.getScaledValue()));
} else {
assert (propVal instanceof RealLiteral);
RealLiteral value = (RealLiteral) propVal;
res = new RealExpr(BigDecimal.valueOf(value.getValue()));
}
}
assert (res != null);
return res;
}
use of org.osate.aadl2.StringLiteral in project AGREE by loonwerks.
the class MATLABFunctionHandler method setMatlabExportInfo.
private void setMatlabExportInfo(ComponentType ct, ModelInfo info) {
ListValue lv = getOrCreateSourceText(ct);
StringLiteral sl1 = (StringLiteral) lv.createOwnedListElement(Aadl2Package.eINSTANCE.getStringLiteral());
sl1.setValue(savePathToAADLProperty(info.outputDirPath));
StringLiteral sl2 = (StringLiteral) lv.createOwnedListElement(Aadl2Package.eINSTANCE.getStringLiteral());
sl2.setValue(savePathToAADLProperty(info.implMdlPath));
StringLiteral sl3 = (StringLiteral) lv.createOwnedListElement(Aadl2Package.eINSTANCE.getStringLiteral());
sl3.setValue(savePathToAADLProperty(info.verifyMdlName));
StringLiteral sl4 = (StringLiteral) lv.createOwnedListElement(Aadl2Package.eINSTANCE.getStringLiteral());
sl4.setValue(savePathToAADLProperty(info.subsystemName));
}
use of org.osate.aadl2.StringLiteral in project osate2 by osate.
the class CommonSemanticSequencer method sequence.
@Override
public void sequence(ISerializationContext context, EObject semanticObject) {
EPackage epackage = semanticObject.eClass().getEPackage();
ParserRule rule = context.getParserRule();
Action action = context.getAssignedAction();
Set<Parameter> parameters = context.getEnabledBooleanParameters();
if (epackage == Aadl2Package.eINSTANCE)
switch(semanticObject.eClass().getClassifierID()) {
case Aadl2Package.AADL_BOOLEAN:
sequence_TypeRef(context, (AadlBoolean) semanticObject);
return;
case Aadl2Package.AADL_INTEGER:
sequence_TypeRef(context, (AadlInteger) semanticObject);
return;
case Aadl2Package.AADL_REAL:
sequence_TypeRef(context, (AadlReal) semanticObject);
return;
case Aadl2Package.AADL_STRING:
sequence_TypeRef(context, (AadlString) semanticObject);
return;
case Aadl2Package.BOOLEAN_LITERAL:
sequence_ABooleanLiteral(context, (BooleanLiteral) semanticObject);
return;
case Aadl2Package.INTEGER_LITERAL:
sequence_AIntegerTerm(context, (IntegerLiteral) semanticObject);
return;
case Aadl2Package.REAL_LITERAL:
sequence_ARealTerm(context, (RealLiteral) semanticObject);
return;
case Aadl2Package.STRING_LITERAL:
sequence_StringTerm(context, (StringLiteral) semanticObject);
return;
}
else if (epackage == CommonPackage.eINSTANCE)
switch(semanticObject.eClass().getClassifierID()) {
case CommonPackage.ABINARY_OPERATION:
sequence_AAdditiveExpression_AAndExpression_AEqualityExpression_AMultiplicativeExpression_AOrExpression_ARelationalExpression(context, (ABinaryOperation) semanticObject);
return;
case CommonPackage.ACONDITIONAL:
sequence_AIfExpression(context, (AConditional) semanticObject);
return;
case CommonPackage.AFUNCTION_CALL:
sequence_AFunctionCall(context, (AFunctionCall) semanticObject);
return;
case CommonPackage.AMODEL_REFERENCE:
sequence_AModelReference(context, (AModelReference) semanticObject);
return;
case CommonPackage.APROPERTY_REFERENCE:
if (rule == grammarAccess.getAModelOrPropertyReferenceRule() || rule == grammarAccess.getAExpressionRule() || rule == grammarAccess.getAOrExpressionRule() || action == grammarAccess.getAOrExpressionAccess().getABinaryOperationLeftAction_1_0_0_0() || rule == grammarAccess.getAAndExpressionRule() || action == grammarAccess.getAAndExpressionAccess().getABinaryOperationLeftAction_1_0_0_0() || rule == grammarAccess.getAEqualityExpressionRule() || action == grammarAccess.getAEqualityExpressionAccess().getABinaryOperationLeftAction_1_0_0_0() || rule == grammarAccess.getARelationalExpressionRule() || action == grammarAccess.getARelationalExpressionAccess().getABinaryOperationLeftAction_1_0_0_0() || rule == grammarAccess.getAAdditiveExpressionRule() || action == grammarAccess.getAAdditiveExpressionAccess().getABinaryOperationLeftAction_1_0_0_0() || rule == grammarAccess.getAMultiplicativeExpressionRule() || action == grammarAccess.getAMultiplicativeExpressionAccess().getABinaryOperationLeftAction_1_0_0_0() || rule == grammarAccess.getAUnaryOperationRule() || rule == grammarAccess.getAUnitExpressionRule() || action == grammarAccess.getAUnitExpressionAccess().getAUnitExpressionExpressionAction_1_0() || rule == grammarAccess.getAPrimaryExpressionRule() || rule == grammarAccess.getAParenthesizedExpressionRule()) {
sequence_AModelOrPropertyReference_APropertyReference(context, (APropertyReference) semanticObject);
return;
} else if (rule == grammarAccess.getAPropertyReferenceRule()) {
sequence_APropertyReference(context, (APropertyReference) semanticObject);
return;
} else
break;
case CommonPackage.ARANGE:
sequence_ARangeExpression(context, (ARange) semanticObject);
return;
case CommonPackage.AUNARY_OPERATION:
sequence_AUnaryOperation(context, (AUnaryOperation) semanticObject);
return;
case CommonPackage.AUNIT_EXPRESSION:
if (rule == grammarAccess.getAExpressionRule() || rule == grammarAccess.getAOrExpressionRule() || action == grammarAccess.getAOrExpressionAccess().getABinaryOperationLeftAction_1_0_0_0() || rule == grammarAccess.getAAndExpressionRule() || action == grammarAccess.getAAndExpressionAccess().getABinaryOperationLeftAction_1_0_0_0() || rule == grammarAccess.getAEqualityExpressionRule() || action == grammarAccess.getAEqualityExpressionAccess().getABinaryOperationLeftAction_1_0_0_0() || rule == grammarAccess.getARelationalExpressionRule() || action == grammarAccess.getARelationalExpressionAccess().getABinaryOperationLeftAction_1_0_0_0() || rule == grammarAccess.getAAdditiveExpressionRule() || action == grammarAccess.getAAdditiveExpressionAccess().getABinaryOperationLeftAction_1_0_0_0() || rule == grammarAccess.getAMultiplicativeExpressionRule() || action == grammarAccess.getAMultiplicativeExpressionAccess().getABinaryOperationLeftAction_1_0_0_0() || rule == grammarAccess.getAUnaryOperationRule() || rule == grammarAccess.getAUnitExpressionRule() || action == grammarAccess.getAUnitExpressionAccess().getAUnitExpressionExpressionAction_1_0() || rule == grammarAccess.getAPrimaryExpressionRule() || rule == grammarAccess.getAParenthesizedExpressionRule()) {
sequence_AUnitExpression(context, (AUnitExpression) semanticObject);
return;
} else if (rule == grammarAccess.getShowValueRule()) {
sequence_ShowValue(context, (AUnitExpression) semanticObject);
return;
} else
break;
case CommonPackage.AVARIABLE_REFERENCE:
sequence_AVariableReference(context, (AVariableReference) semanticObject);
return;
case CommonPackage.COMPUTE_DECLARATION:
sequence_ComputeDeclaration(context, (ComputeDeclaration) semanticObject);
return;
case CommonPackage.DESCRIPTION:
sequence_Description(context, (Description) semanticObject);
return;
case CommonPackage.DESCRIPTION_ELEMENT:
sequence_DescriptionElement(context, (DescriptionElement) semanticObject);
return;
case CommonPackage.IMAGE_REFERENCE:
sequence_ImageReference(context, (ImageReference) semanticObject);
return;
case CommonPackage.MODEL_REF:
sequence_TypeRef(context, (ModelRef) semanticObject);
return;
case CommonPackage.PROPERTY_REF:
sequence_PropertyRef(context, (PropertyRef) semanticObject);
return;
case CommonPackage.RATIONALE:
sequence_Rationale(context, (Rationale) semanticObject);
return;
case CommonPackage.TYPE_REF:
sequence_TypeRef(context, (TypeRef) semanticObject);
return;
case CommonPackage.UNCERTAINTY:
sequence_Uncertainty(context, (Uncertainty) semanticObject);
return;
case CommonPackage.VAL_DECLARATION:
sequence_ValDeclaration(context, (ValDeclaration) semanticObject);
return;
}
if (errorAcceptor != null)
errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
use of org.osate.aadl2.StringLiteral in project osate2 by osate.
the class ReqSpecSemanticSequencer method sequence.
@Override
public void sequence(ISerializationContext context, EObject semanticObject) {
EPackage epackage = semanticObject.eClass().getEPackage();
ParserRule rule = context.getParserRule();
Action action = context.getAssignedAction();
Set<Parameter> parameters = context.getEnabledBooleanParameters();
if (epackage == Aadl2Package.eINSTANCE)
switch(semanticObject.eClass().getClassifierID()) {
case Aadl2Package.AADL_BOOLEAN:
sequence_TypeRef(context, (AadlBoolean) semanticObject);
return;
case Aadl2Package.AADL_INTEGER:
sequence_TypeRef(context, (AadlInteger) semanticObject);
return;
case Aadl2Package.AADL_REAL:
sequence_TypeRef(context, (AadlReal) semanticObject);
return;
case Aadl2Package.AADL_STRING:
sequence_TypeRef(context, (AadlString) semanticObject);
return;
case Aadl2Package.BOOLEAN_LITERAL:
sequence_ABooleanLiteral(context, (BooleanLiteral) semanticObject);
return;
case Aadl2Package.INTEGER_LITERAL:
sequence_AIntegerTerm(context, (IntegerLiteral) semanticObject);
return;
case Aadl2Package.REAL_LITERAL:
sequence_ARealTerm(context, (RealLiteral) semanticObject);
return;
case Aadl2Package.STRING_LITERAL:
sequence_StringTerm(context, (StringLiteral) semanticObject);
return;
}
else if (epackage == CommonPackage.eINSTANCE)
switch(semanticObject.eClass().getClassifierID()) {
case CommonPackage.ABINARY_OPERATION:
sequence_AAdditiveExpression_AAndExpression_AEqualityExpression_AMultiplicativeExpression_AOrExpression_ARelationalExpression(context, (ABinaryOperation) semanticObject);
return;
case CommonPackage.ACONDITIONAL:
sequence_AIfExpression(context, (AConditional) semanticObject);
return;
case CommonPackage.AFUNCTION_CALL:
sequence_AFunctionCall(context, (AFunctionCall) semanticObject);
return;
case CommonPackage.AMODEL_REFERENCE:
sequence_AModelReference(context, (AModelReference) semanticObject);
return;
case CommonPackage.APROPERTY_REFERENCE:
if (rule == grammarAccess.getAModelOrPropertyReferenceRule() || rule == grammarAccess.getAExpressionRule() || rule == grammarAccess.getAOrExpressionRule() || action == grammarAccess.getAOrExpressionAccess().getABinaryOperationLeftAction_1_0_0_0() || rule == grammarAccess.getAAndExpressionRule() || action == grammarAccess.getAAndExpressionAccess().getABinaryOperationLeftAction_1_0_0_0() || rule == grammarAccess.getAEqualityExpressionRule() || action == grammarAccess.getAEqualityExpressionAccess().getABinaryOperationLeftAction_1_0_0_0() || rule == grammarAccess.getARelationalExpressionRule() || action == grammarAccess.getARelationalExpressionAccess().getABinaryOperationLeftAction_1_0_0_0() || rule == grammarAccess.getAAdditiveExpressionRule() || action == grammarAccess.getAAdditiveExpressionAccess().getABinaryOperationLeftAction_1_0_0_0() || rule == grammarAccess.getAMultiplicativeExpressionRule() || action == grammarAccess.getAMultiplicativeExpressionAccess().getABinaryOperationLeftAction_1_0_0_0() || rule == grammarAccess.getAUnaryOperationRule() || rule == grammarAccess.getAUnitExpressionRule() || action == grammarAccess.getAUnitExpressionAccess().getAUnitExpressionExpressionAction_1_0() || rule == grammarAccess.getAPrimaryExpressionRule() || rule == grammarAccess.getAParenthesizedExpressionRule()) {
sequence_AModelOrPropertyReference_APropertyReference(context, (APropertyReference) semanticObject);
return;
} else if (rule == grammarAccess.getAPropertyReferenceRule()) {
sequence_APropertyReference(context, (APropertyReference) semanticObject);
return;
} else
break;
case CommonPackage.ARANGE:
sequence_ARangeExpression(context, (ARange) semanticObject);
return;
case CommonPackage.AUNARY_OPERATION:
sequence_AUnaryOperation(context, (AUnaryOperation) semanticObject);
return;
case CommonPackage.AUNIT_EXPRESSION:
if (rule == grammarAccess.getAExpressionRule() || rule == grammarAccess.getAOrExpressionRule() || action == grammarAccess.getAOrExpressionAccess().getABinaryOperationLeftAction_1_0_0_0() || rule == grammarAccess.getAAndExpressionRule() || action == grammarAccess.getAAndExpressionAccess().getABinaryOperationLeftAction_1_0_0_0() || rule == grammarAccess.getAEqualityExpressionRule() || action == grammarAccess.getAEqualityExpressionAccess().getABinaryOperationLeftAction_1_0_0_0() || rule == grammarAccess.getARelationalExpressionRule() || action == grammarAccess.getARelationalExpressionAccess().getABinaryOperationLeftAction_1_0_0_0() || rule == grammarAccess.getAAdditiveExpressionRule() || action == grammarAccess.getAAdditiveExpressionAccess().getABinaryOperationLeftAction_1_0_0_0() || rule == grammarAccess.getAMultiplicativeExpressionRule() || action == grammarAccess.getAMultiplicativeExpressionAccess().getABinaryOperationLeftAction_1_0_0_0() || rule == grammarAccess.getAUnaryOperationRule() || rule == grammarAccess.getAUnitExpressionRule() || action == grammarAccess.getAUnitExpressionAccess().getAUnitExpressionExpressionAction_1_0() || rule == grammarAccess.getAPrimaryExpressionRule() || rule == grammarAccess.getAParenthesizedExpressionRule()) {
sequence_AUnitExpression(context, (AUnitExpression) semanticObject);
return;
} else if (rule == grammarAccess.getShowValueRule()) {
sequence_ShowValue(context, (AUnitExpression) semanticObject);
return;
} else
break;
case CommonPackage.AVARIABLE_REFERENCE:
sequence_AVariableReference(context, (AVariableReference) semanticObject);
return;
case CommonPackage.COMPUTE_DECLARATION:
sequence_ComputeDeclaration(context, (ComputeDeclaration) semanticObject);
return;
case CommonPackage.DESCRIPTION:
sequence_Description(context, (Description) semanticObject);
return;
case CommonPackage.DESCRIPTION_ELEMENT:
sequence_DescriptionElement(context, (DescriptionElement) semanticObject);
return;
case CommonPackage.IMAGE_REFERENCE:
sequence_ImageReference(context, (ImageReference) semanticObject);
return;
case CommonPackage.MODEL_REF:
sequence_TypeRef(context, (ModelRef) semanticObject);
return;
case CommonPackage.PROPERTY_REF:
sequence_PropertyRef(context, (PropertyRef) semanticObject);
return;
case CommonPackage.RATIONALE:
sequence_Rationale(context, (Rationale) semanticObject);
return;
case CommonPackage.TYPE_REF:
sequence_TypeRef(context, (TypeRef) semanticObject);
return;
case CommonPackage.UNCERTAINTY:
sequence_Uncertainty(context, (Uncertainty) semanticObject);
return;
}
else if (epackage == ReqSpecPackage.eINSTANCE)
switch(semanticObject.eClass().getClassifierID()) {
case ReqSpecPackage.DESIRED_VALUE:
sequence_DesiredValue(context, (DesiredValue) semanticObject);
return;
case ReqSpecPackage.DOCUMENT_SECTION:
sequence_DocumentSection(context, (DocumentSection) semanticObject);
return;
case ReqSpecPackage.EXTERNAL_DOCUMENT:
sequence_ExternalDocument(context, (ExternalDocument) semanticObject);
return;
case ReqSpecPackage.GLOBAL_CONSTANTS:
sequence_GlobalConstants(context, (GlobalConstants) semanticObject);
return;
case ReqSpecPackage.GLOBAL_REQUIREMENT_SET:
sequence_GlobalRequirementSet(context, (GlobalRequirementSet) semanticObject);
return;
case ReqSpecPackage.GOAL:
if (rule == grammarAccess.getDocGoalRule()) {
sequence_DocGoal(context, (Goal) semanticObject);
return;
} else if (rule == grammarAccess.getContractualElementRule() || rule == grammarAccess.getGoalRule()) {
sequence_Goal(context, (Goal) semanticObject);
return;
} else
break;
case ReqSpecPackage.INCLUDE_GLOBAL_REQUIREMENT:
sequence_IncludeGlobalRequirement(context, (IncludeGlobalRequirement) semanticObject);
return;
case ReqSpecPackage.INFORMAL_PREDICATE:
sequence_InformalPredicate(context, (InformalPredicate) semanticObject);
return;
case ReqSpecPackage.REQ_DOCUMENT:
sequence_ReqDocument(context, (ReqDocument) semanticObject);
return;
case ReqSpecPackage.REQ_SPEC:
sequence_ReqSpec(context, (ReqSpec) semanticObject);
return;
case ReqSpecPackage.REQ_VAL_DECLARATION:
sequence_ValDeclaration(context, (ReqValDeclaration) semanticObject);
return;
case ReqSpecPackage.REQUIREMENT:
if (rule == grammarAccess.getDocRequirementRule()) {
sequence_DocRequirement(context, (Requirement) semanticObject);
return;
} else if (rule == grammarAccess.getGlobalRequirementRule()) {
sequence_GlobalRequirement(context, (Requirement) semanticObject);
return;
} else if (rule == grammarAccess.getContractualElementRule() || rule == grammarAccess.getSystemRequirementRule()) {
sequence_SystemRequirement(context, (Requirement) semanticObject);
return;
} else
break;
case ReqSpecPackage.STAKEHOLDER_GOALS:
sequence_StakeholderGoals(context, (StakeholderGoals) semanticObject);
return;
case ReqSpecPackage.SYSTEM_REQUIREMENT_SET:
sequence_SystemRequirementSet(context, (SystemRequirementSet) semanticObject);
return;
case ReqSpecPackage.VALUE_PREDICATE:
sequence_ValuePredicate(context, (ValuePredicate) semanticObject);
return;
case ReqSpecPackage.WHEN_CONDITION:
sequence_WhenCondition(context, (WhenCondition) semanticObject);
return;
}
if (errorAcceptor != null)
errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
use of org.osate.aadl2.StringLiteral in project osate2 by osate.
the class StringExprImpl method basicSetVal.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetVal(StringLiteral newVal, NotificationChain msgs) {
StringLiteral oldVal = val;
val = newVal;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ResolutePackage.STRING_EXPR__VAL, oldVal, newVal);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
Aggregations