use of org.osate.aadl2.NamedElement in project AGREE by loonwerks.
the class AgreeASTBuilder method caseTimeRiseExpr.
@Override
public Expr caseTimeRiseExpr(TimeRiseExpr timeExpr) {
NamedElement namedEl = timeExpr.getId();
String idStr = namedEl.getName();
AgreeVar var = timeRiseVarMap.get(idStr);
if (var == null) {
String varStr = idStr + AgreePatternTranslator.RISE_SUFFIX;
var = new AgreeVar(varStr, NamedType.REAL, namedEl);
timeRiseVarMap.put(idStr, var);
}
return new IdExpr(var.id);
}
use of org.osate.aadl2.NamedElement 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.NamedElement in project AGREE by loonwerks.
the class GetPropertyExprImpl method setProp.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setProp(NamedElement newProp) {
NamedElement oldProp = prop;
prop = newProp;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AgreePackage.GET_PROPERTY_EXPR__PROP, oldProp, prop));
}
use of org.osate.aadl2.NamedElement in project AGREE by loonwerks.
the class RecordUpdateExprImpl method setKey.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setKey(NamedElement newKey) {
NamedElement oldKey = key;
key = newKey;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AgreePackage.RECORD_UPDATE_EXPR__KEY, oldKey, key));
}
use of org.osate.aadl2.NamedElement in project AGREE by loonwerks.
the class TimeRiseExprImpl method setId.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setId(NamedElement newId) {
NamedElement oldId = id;
id = newId;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AgreePackage.TIME_RISE_EXPR__ID, oldId, id));
}
Aggregations