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

org.mule.mvel2.ast.IntAdd Maven / Gradle / Ivy

Go to download

MVEL is a powerful expression language for Java-based applications. It provides a plethora of features and is suited for everything from the smallest property binding and extraction, to full blown scripts. This is a fork of MVEL customized for use in Mule.

There is a newer version: 2.1.9-MULE-019
Show newest version
package org.mule.mvel2.ast;

import org.mule.mvel2.Operator;
import org.mule.mvel2.ParserContext;
import org.mule.mvel2.integration.VariableResolverFactory;

public class IntAdd extends BinaryOperation implements IntOptimized {

  public IntAdd(ASTNode left, ASTNode right, ParserContext pCtx) {
    super(Operator.ADD, pCtx);
    this.left = left;
    this.right = right;
  }

  @Override
  public Object getReducedValueAccelerated(Object ctx, Object thisValue, VariableResolverFactory factory) {
    return ((Integer) left.getReducedValueAccelerated(ctx, thisValue, factory))
        + ((Integer) right.getReducedValueAccelerated(ctx, thisValue, factory));
  }

  @Override
  public Object getReducedValue(Object ctx, Object thisValue, VariableResolverFactory factory) {
    return ((Integer) left.getReducedValue(ctx, thisValue, factory))
        + ((Integer) right.getReducedValue(ctx, thisValue, factory));
  }

  @Override
  public Class getEgressType() {
    return Integer.class;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy