Search in sources :

Example 1 with BoolLiteral

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

the class StextTestFactory method _createValue.

public static PrimitiveValueExpression _createValue(boolean b) {
    PrimitiveValueExpression pve = ExpressionsFactory.eINSTANCE.createPrimitiveValueExpression();
    BoolLiteral boolLit = ExpressionsFactory.eINSTANCE.createBoolLiteral();
    boolLit.setValue(b);
    pve.setValue(boolLit);
    return pve;
}
Also used : BoolLiteral(org.yakindu.base.expressions.expressions.BoolLiteral) PrimitiveValueExpression(org.yakindu.base.expressions.expressions.PrimitiveValueExpression)

Example 2 with BoolLiteral

use of org.yakindu.base.expressions.expressions.BoolLiteral 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 3 with BoolLiteral

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

the class FeatureParameterValueImpl method setValue.

/**
 * <!-- begin-user-doc --> <!-- end-user-doc -->
 *
 * @generated NOT
 */
@Override
public void setValue(boolean bool) {
    BoolLiteral boolLiteral = ExpressionsFactory.eINSTANCE.createBoolLiteral();
    boolLiteral.setValue(bool);
    setValue(boolLiteral);
}
Also used : BoolLiteral(org.yakindu.base.expressions.expressions.BoolLiteral)

Aggregations

BoolLiteral (org.yakindu.base.expressions.expressions.BoolLiteral)3 PrimitiveValueExpression (org.yakindu.base.expressions.expressions.PrimitiveValueExpression)2 DoubleLiteral (org.yakindu.base.expressions.expressions.DoubleLiteral)1 FloatLiteral (org.yakindu.base.expressions.expressions.FloatLiteral)1 IntLiteral (org.yakindu.base.expressions.expressions.IntLiteral)1 Literal (org.yakindu.base.expressions.expressions.Literal)1 StringLiteral (org.yakindu.base.expressions.expressions.StringLiteral)1