MultipleArrayFunction.java :  » Algebra » symja » org » matheclipse » core » generic » Java Open Source

Java Open Source » Algebra » symja 
symja » org » matheclipse » core » generic » MultipleArrayFunction.java
package org.matheclipse.core.generic;

import org.matheclipse.core.eval.EvalEngine;
import org.matheclipse.core.interfaces.IAST;
import org.matheclipse.core.interfaces.IExpr;
import org.matheclipse.generic.interfaces.IArrayFunction;

public class MultipleArrayFunction implements IArrayFunction<IExpr> {
  final EvalEngine fEngine;

  final IAST fHeadAST;

  public MultipleArrayFunction(final EvalEngine engine, final IAST headAST) {
    fEngine = engine;
    fHeadAST = headAST;
  }

  public IExpr evaluate(final Object[] index) {
    final IAST ast = fHeadAST.clone();
    for (int i = 0; i < index.length; i++) {
      ast.add((IExpr) index[i]);
    }
    return fEngine.evaluate(ast);
  }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.