Search in sources :

Example 1 with Literal

use of org.yakindu.base.expressions.expressions.Literal in project statecharts by Yakindu.

the class Assert method assertExpressionEquals.

public static void assertExpressionEquals(String expected, Expression current) {
    String currentValue = null;
    if (current instanceof PrimitiveValueExpression) {
        Literal literal = ((PrimitiveValueExpression) current).getValue();
        if (literal instanceof BoolLiteral) {
            currentValue = Boolean.toString(((BoolLiteral) literal).isValue());
        } else if (literal instanceof IntLiteral) {
            currentValue = Long.toString(((IntLiteral) literal).getValue());
        } else if (literal instanceof DoubleLiteral) {
            currentValue = Double.toString(((DoubleLiteral) literal).getValue());
        } else if (literal instanceof FloatLiteral) {
            currentValue = Double.toString(((FloatLiteral) literal).getValue());
        } else if (literal instanceof StringLiteral) {
            currentValue = (((StringLiteral) literal).getValue());
        }
    }
    assertEquals(expected, currentValue);
}
Also used : BoolLiteral(org.yakindu.base.expressions.expressions.BoolLiteral) StringLiteral(org.yakindu.base.expressions.expressions.StringLiteral) FloatLiteral(org.yakindu.base.expressions.expressions.FloatLiteral) FloatLiteral(org.yakindu.base.expressions.expressions.FloatLiteral) StringLiteral(org.yakindu.base.expressions.expressions.StringLiteral) Literal(org.yakindu.base.expressions.expressions.Literal) DoubleLiteral(org.yakindu.base.expressions.expressions.DoubleLiteral) IntLiteral(org.yakindu.base.expressions.expressions.IntLiteral) BoolLiteral(org.yakindu.base.expressions.expressions.BoolLiteral) IntLiteral(org.yakindu.base.expressions.expressions.IntLiteral) DoubleLiteral(org.yakindu.base.expressions.expressions.DoubleLiteral) PrimitiveValueExpression(org.yakindu.base.expressions.expressions.PrimitiveValueExpression)

Example 2 with Literal

use of org.yakindu.base.expressions.expressions.Literal in project statecharts by Yakindu.

the class PrimitiveValueExpressionImpl method basicSetValue.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public NotificationChain basicSetValue(Literal newValue, NotificationChain msgs) {
    Literal oldValue = value;
    value = newValue;
    if (eNotificationRequired()) {
        ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ExpressionsPackage.PRIMITIVE_VALUE_EXPRESSION__VALUE, oldValue, newValue);
        if (msgs == null)
            msgs = notification;
        else
            msgs.add(notification);
    }
    return msgs;
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) Literal(org.yakindu.base.expressions.expressions.Literal)

Aggregations

Literal (org.yakindu.base.expressions.expressions.Literal)2 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)1 BoolLiteral (org.yakindu.base.expressions.expressions.BoolLiteral)1 DoubleLiteral (org.yakindu.base.expressions.expressions.DoubleLiteral)1 FloatLiteral (org.yakindu.base.expressions.expressions.FloatLiteral)1 IntLiteral (org.yakindu.base.expressions.expressions.IntLiteral)1 PrimitiveValueExpression (org.yakindu.base.expressions.expressions.PrimitiveValueExpression)1 StringLiteral (org.yakindu.base.expressions.expressions.StringLiteral)1