use of com.rockwellcollins.atc.agree.agree.Expr in project AMASE by loonwerks.
the class SafetyValidator method checkIntervalEqStatement.
/**
* Interval eq stmts:
* Checks:
* - Only primitive types supported for intervals.
* - The interval type matches high and low parameters of interval.
* - High and low parameters of interval are same type.
* @param intervalEq
*/
@Check(CheckType.FAST)
public void checkIntervalEqStatement(IntervalEq intervalEq) {
Arg arg = intervalEq.getLhs_int();
String typeName = "";
SafetyInterval interval = intervalEq.getInterv();
Expr low = interval.getLow();
Expr high = interval.getHigh();
if (arg.getType() instanceof PrimType) {
typeName = ((PrimType) arg.getType()).getName();
if (typeName.equalsIgnoreCase("bool")) {
error(arg, "Boolean intervals are not allowed. Only real or int intervals are supported.");
}
} else {
error(arg, "The only types that are supported for intervals are real and int.");
}
// Negative values are allowed: hence the check for UnaryExpr
if (low instanceof UnaryExpr) {
UnaryExpr unex_low = (UnaryExpr) low;
if (!(unex_low.getExpr() instanceof IntLitExpr) & !(unex_low.getExpr() instanceof RealLitExpr)) {
error(low, "Only real and integer types are supported for intervals.");
}
if (high instanceof UnaryExpr) {
UnaryExpr unex_high = (UnaryExpr) high;
if (!(unex_high.getExpr() instanceof IntLitExpr) & !(unex_high.getExpr() instanceof RealLitExpr)) {
error(high, "Only real and integer types are supported for intervals.");
}
testLowAndHighTypes(intervalEq, typeName, unex_low.getExpr(), unex_high.getExpr());
} else {
testLowAndHighTypes(intervalEq, typeName, unex_low.getExpr(), high);
}
} else {
testLowAndHighTypes(intervalEq, typeName, low, high);
}
}
use of com.rockwellcollins.atc.agree.agree.Expr in project AMASE by loonwerks.
the class SetEqImpl method basicSetL1.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetL1(Expr newL1, NotificationChain msgs) {
Expr oldL1 = l1;
l1 = newL1;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SafetyPackage.SET_EQ__L1, oldL1, newL1);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
use of com.rockwellcollins.atc.agree.agree.Expr in project AMASE by loonwerks.
the class SafetyIntervalImpl method basicSetLow.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetLow(Expr newLow, NotificationChain msgs) {
Expr oldLow = low;
low = newLow;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SafetyPackage.SAFETY_INTERVAL__LOW, oldLow, newLow);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
use of com.rockwellcollins.atc.agree.agree.Expr in project AMASE by loonwerks.
the class EqValueImpl method basicSetExpr.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetExpr(Expr newExpr, NotificationChain msgs) {
Expr oldExpr = expr;
expr = newExpr;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SafetyPackage.EQ_VALUE__EXPR, oldExpr, newExpr);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
use of com.rockwellcollins.atc.agree.agree.Expr in project VERDICT by ge-high-assurance.
the class Agree2Vdm method translateAssumeStatement.
private ContractItem translateAssumeStatement(AssumeStatement assumeStmt, HashSet<String> dataTypeDecl, HashSet<String> nodeDecl, Model model) {
ContractItem contractItem = new ContractItem();
contractItem.setName(assumeStmt.getStr());
Expr agreeExpr = assumeStmt.getExpr();
Expression vdmlustrExpr = getVdmExpressionFromAgreeExpression(agreeExpr, dataTypeDecl, nodeDecl, model);
contractItem.setExpression(vdmlustrExpr);
return contractItem;
}
Aggregations