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

org.mvel2.ast.IntDiv Maven / Gradle / Ivy

Go to download

A fork of MVEL by Axibase. Original version is hosted here: https://github.com/mvel/mvel. 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.

There is a newer version: 2.4.5.11
Show newest version
package org.mvel2.ast;

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


public class IntDiv extends BinaryOperation implements IntOptimized {
  public IntDiv(ASTNode left, ASTNode right, ParserContext pCtx) {
    super(Operator.MULT, 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 void setRight(ASTNode node) {
    super.setRight(node);
  }

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy