use of org.eclipse.xtext.example.arithmetics.arithmetics.Expression in project xtext-eclipse by eclipse.
the class DivImpl method basicSetLeft.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetLeft(Expression newLeft, NotificationChain msgs) {
Expression oldLeft = left;
left = newLeft;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ArithmeticsPackage.DIV__LEFT, oldLeft, newLeft);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
use of org.eclipse.xtext.example.arithmetics.arithmetics.Expression in project xtext-eclipse by eclipse.
the class CalculatorTest method evaluatesTo.
private void evaluatesTo(CharSequence content, double expected) throws Exception {
Module module = parseHelper.parse("module test " + content);
Statement firstStatement = module.getStatements().get(0);
Iterable<Expression> expressions = Iterables.filter(firstStatement.eContents(), Expression.class);
Expression expression = Iterables.getFirst(expressions, null);
BigDecimal result = calculator.evaluate(expression);
Assert.assertEquals(expected, result.doubleValue(), 0.0001);
}
Aggregations