All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.drools.mvel.parser.ast.expr.WithStatement Maven / Gradle / Ivy

The newest version!
package org.drools.mvel.parser.ast.expr;

import java.util.List;

import com.github.javaparser.TokenRange;
import com.github.javaparser.ast.Node;
import com.github.javaparser.ast.NodeList;
import com.github.javaparser.ast.expr.Expression;
import com.github.javaparser.ast.stmt.Statement;
import com.github.javaparser.ast.visitor.GenericVisitor;
import com.github.javaparser.ast.visitor.VoidVisitor;
import org.drools.mvel.parser.ast.visitor.DrlGenericVisitor;
import org.drools.mvel.parser.ast.visitor.DrlVoidVisitor;

public class WithStatement extends Statement {

    private final Expression modifyObject;
    private final NodeList expressions;

    public WithStatement(TokenRange tokenRange, Expression modifyObject, NodeList expressions) {
        super(tokenRange);
        this.modifyObject = modifyObject;
        this.expressions = expressions;
    }

    @Override
    public  R accept(GenericVisitor v, A arg) {
        return ((DrlGenericVisitor)v).visit(this, arg);
    }

    @Override
    public  void accept(VoidVisitor v, A arg) {
        ((DrlVoidVisitor)v).visit(this, arg);
    }

    public NodeList getExpressions() {
        return expressions;
    }

    public Expression getWithObject() {
        return modifyObject;
    }

    @Override
    public List getChildNodes() {
        NodeList nodeList = NodeList.nodeList();
        for (Statement e : expressions) {
            if (e != null) {
                nodeList.add(e);
            }
        }
        return nodeList;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy