/** * Create a new AST List instance * * @param size * the initial number of elements * @return a new AST List instance */ protected AST createAST(int size) { return (AST) F.ast(F.List, size, false); }
/** * Define an unary AST with the header <code>head</code>. This new AST * collects the arguments of the <code>apply()</code> method. * * @param head * the AST's head expresion */ public UnaryCollect(final IExpr head) { fAST = F.ast(head, 1, false); }
/** {@inheritDoc} */ @Override public IExpr apply(IExpr... expressions) { return F.ast(expressions, this); }
public static IAST Dot(final IExpr... a) {// 0, final IExpr a1, final IExpr // a2) { return ast(a, Dot); // return ternary(Dot, a0, a1, a2); }
public static IAST List(final IExpr... a) {// 0, final IExpr a1, final IExpr // a2) { return ast(a, List); // return ternary(List, a0, a1, a2); }
/** * Create a function with 2 arguments without evaluation. * * @param head * @param a0 * @param a1 * @return */ public final static IAST binary(final IExpr head, final IExpr a0, final IExpr a1) { return ast(new IExpr[] { a0, a1 }, head); }
/** * Define a binary AST with the header <code>head</code>. * * @param head * the AST's head expresion */ public IsBinaryTrue(final IExpr head) { fEngine = EvalEngine.get(); fAST = F.ast(head, 1, false); }
public static IAST List(final double... numbers) { INum a[] = new INum[numbers.length]; for (int i = 0; i < numbers.length; i++) { a[i] = F.num(numbers[i]); } return ast(a, List); }
public static IAST List(final long... numbers) { IInteger a[] = new IInteger[numbers.length]; for (int i = 0; i < numbers.length; i++) { a[i] = F.integer(numbers[i]); } return ast(a, List); }
/** * Create a function * * @param head * @param arg0 * @return */ public static IAST function(final IExpr head, final IExpr arg0) { final IAST list = ast(head); list.add(arg0); return list; }
/** * Create a function * * @param head * usually a String which tags the function * @return IAST * @see org.matheclipse.parser.client.IConstantHeaders */ public static IAST function(final String head) { final IAST list = ast($s(head)); return list; }
/** * Define an binary AST with the header <code>head</code>. * * @param head the AST's head expresion */ public BinaryEval(final IExpr head) { fEngine = EvalEngine.get(); fAST = F.ast(head, 1, false); }
/** * Create a function with 1 argument without evaluation. * * @param head * @param a0 * @return */ public final static IAST unary(final IExpr head, final IExpr a0) { final IAST ast = ast(head); ast.add(a0); return ast; }
/** * {@inheritDoc} */ public IExpr apply(List<? extends IExpr> leaves) { final IAST ast = F.ast(head()); for (int i = 0; i < leaves.size(); i++) { ast.add(leaves.get(i)); } return ast; }
public IAST apply(final IExpr head, final int start, final int end) { final IAST ast = F.ast(head); for (int i = start; i < end; i++) { ast.add(get(i)); } return ast; }
/** * {@inheritDoc} */ public IExpr apply(IExpr... leaves) { final IAST ast = F.ast(head()); for (int i = 0; i < leaves.length; i++) { ast.add(leaves[i]); } return ast; }
public IExpr apply(IExpr... leaves) { final IAST ast = F.ast(head()); for (int i = 0; i < leaves.length; i++) { ast.add(leaves[i]); } return ast; }
@Override public IExpr evaluate(final IAST ast) { Validate.checkRange(ast, 3); final IAST arg1AST = F.ast(ast.get(1)); final VisitorLevelSpecification level = new VisitorLevelSpecification(Functors.append(arg1AST), 0, Integer.MAX_VALUE, false); final IExpr result = ast.get(2).accept(level); return result == null ? ast.get(2) : result; }
public static IExpr evaluateNestList(final IAST ast, final IAST resultList) { IExpr arg3 = F.eval(ast.get(3)); if (arg3.isInteger()) { final int n = Validate.checkIntType(arg3); nestList(ast.get(2), n, Functors.append(F.ast(ast.get(1))), resultList); return resultList; } return null; }
@Override public IExpr evaluate(final IAST ast) { Validate.checkSize(ast, 4); if (ast.get(1).isSymbol() && ast.get(2).isAST() && ast.get(3).isAST()) { Generating<IExpr, IAST> gen = new Generating<IExpr, IAST>(F.List(), F.ast(ast.get(1)), 1, AST.COPY); return gen.outer((IAST) ast.get(2), (IAST) ast.get(3)); } return null; }