Search in sources :

Example 6 with Expression

use of org.eclipse.xtext.resource.bug385636.Expression in project xtext-core by eclipse.

the class Expression_Not_LessImpl 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, Bug385636Package.EXPRESSION_NOT_LESS__LEFT, oldLeft, newLeft);
        if (msgs == null)
            msgs = notification;
        else
            msgs.add(notification);
    }
    return msgs;
}
Also used : Expression(org.eclipse.xtext.resource.bug385636.Expression) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

Example 7 with Expression

use of org.eclipse.xtext.resource.bug385636.Expression in project xtext-core by eclipse.

the class Expression_SmallerImpl 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, Bug385636Package.EXPRESSION_SMALLER__LEFT, oldLeft, newLeft);
        if (msgs == null)
            msgs = notification;
        else
            msgs.add(notification);
    }
    return msgs;
}
Also used : Expression(org.eclipse.xtext.resource.bug385636.Expression) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

Example 8 with Expression

use of org.eclipse.xtext.resource.bug385636.Expression in project drools by kiegroup.

the class DMNEvaluatorCompiler method compileList.

private DMNExpressionEvaluator compileList(DMNCompilerContext ctx, DMNModelImpl model, DMNBaseNode node, String listName, org.kie.dmn.model.v1_1.List expression) {
    org.kie.dmn.model.v1_1.List listDef = expression;
    DMNListEvaluator listEval = new DMNListEvaluator(node.getName(), node.getSource(), listDef);
    for (Expression expr : listDef.getExpression()) {
        listEval.addElement(compileExpression(ctx, model, node, listName, expr));
    }
    return listEval;
}
Also used : LiteralExpression(org.kie.dmn.model.v1_1.LiteralExpression) CompiledExpression(org.kie.dmn.feel.lang.CompiledExpression) Expression(org.kie.dmn.model.v1_1.Expression) DMNListEvaluator(org.kie.dmn.core.ast.DMNListEvaluator)

Example 9 with Expression

use of org.eclipse.xtext.resource.bug385636.Expression in project drools by kiegroup.

the class DMNListConverter method writeChildren.

@Override
protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) {
    super.writeChildren(writer, context, parent);
    List list = (List) parent;
    for (Expression e : list.getExpression()) {
        writeChildrenNode(writer, context, e, MarshallingUtils.defineExpressionNodeName(e));
    }
}
Also used : Expression(org.kie.dmn.model.v1_1.Expression) List(org.kie.dmn.model.v1_1.List)

Example 10 with Expression

use of org.eclipse.xtext.resource.bug385636.Expression in project newts by OpenNMS.

the class ResultDescriptor method expression.

public ResultDescriptor expression(String label, String expression) {
    final JexlEngine je = new JexlEngine();
    final Expression expr = je.createExpression(expression);
    final String[] labels = getLabels().toArray(new String[0]);
    CalculationFunction evaluate = new CalculationFunction() {

        private static final long serialVersionUID = -3328049421398096252L;

        @Override
        public double apply(double... ds) {
            JexlContext jc = new MapContext();
            for (int i = 0; i < labels.length; i++) {
                jc.set(labels[i], ds[i]);
            }
            return ((Number) expr.evaluate(jc)).doubleValue();
        }
    };
    return calculate(label, evaluate, labels);
}
Also used : JexlEngine(org.apache.commons.jexl2.JexlEngine) Expression(org.apache.commons.jexl2.Expression) JexlContext(org.apache.commons.jexl2.JexlContext) MapContext(org.apache.commons.jexl2.MapContext)

Aggregations

ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)7 Expression (org.eclipse.xtext.resource.bug385636.Expression)7 Expression (org.apache.commons.jexl2.Expression)6 MapContext (org.apache.commons.jexl2.MapContext)6 JexlContext (org.apache.commons.jexl2.JexlContext)5 Expression (org.kie.dmn.model.v1_1.Expression)5 JexlEngine (org.apache.commons.jexl2.JexlEngine)3 CompiledExpression (org.kie.dmn.feel.lang.CompiledExpression)3 LiteralExpression (org.kie.dmn.model.v1_1.LiteralExpression)3 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 DMNExpressionEvaluator (org.kie.dmn.core.api.DMNExpressionEvaluator)2 DMNListEvaluator (org.kie.dmn.core.ast.DMNListEvaluator)2 DMNRelationEvaluator (org.kie.dmn.core.ast.DMNRelationEvaluator)2 InformationItem (org.kie.dmn.model.v1_1.InformationItem)2 Relation (org.kie.dmn.model.v1_1.Relation)2 InetAddress (java.net.InetAddress)1 Collections (java.util.Collections)1 List (java.util.List)1 Map (java.util.Map)1