/** * Create a function with 2 arguments without evaluation. * * @param head * @param a0 * @param a1 * @return */ public final static IASTAppendable binary(final IExpr head, final IExpr a0, final IExpr a1) { return new AST(new IExpr[] { head, a0, a1 }); }
/** * Returns a new {@code HMArrayList} with the same elements, the same size and the same capacity as this * {@code HMArrayList}. * * @return a shallow copy of this {@code ArrayList} * @see java.lang.Cloneable */ @Override public IAST clone() { return new AST(arg0, arg1, arg2); }
/** * Create a new abstract syntax tree (AST). * * @param arr * @param head * the header expression of the function. If the ast represents a function like * <code>f[x,y], Sin[x],...</code>, the <code>head</code> will be an instance of type ISymbol. * @return */ public static IASTAppendable ast(final IExpr[] arr, final IExpr head) { return new AST(head, arr); }
/** * Returns a new {@code HMArrayList} with the same elements, the same size and the same capacity as this * {@code HMArrayList}. * * @return a shallow copy of this {@code ArrayList} * @see java.lang.Cloneable */ @Override public IAST clone() { return new AST(arg0); }
@Override public IASTAppendable copyAppendable() { return new AST(arg0); }
/** * Create a function with 1 argument without evaluation. * * @param head * @param a0 * @return */ public final static IASTAppendable unary(final IExpr head, final IExpr a0) { return new AST(new IExpr[] { head, a0 }); }
public final static IASTMutable quinary(final IExpr head, final IExpr a0, final IExpr a1, final IExpr a2, final IExpr a3, final IExpr a4) { return new AST(new IExpr[] { head, a0, a1, a2, a3, a4 }); }
/** * Returns a new {@code HMArrayList} with the same elements, the same size and the same capacity as this * {@code HMArrayList}. * * @return a shallow copy of this {@code ArrayList} * @see java.lang.Cloneable */ @Override public IAST clone() { return new AST(arg0, arg1); }
public final static IASTAppendable quaternary(final IExpr head, final IExpr a0, final IExpr a1, final IExpr a2, final IExpr a3) { return new AST(new IExpr[] { head, a0, a1, a2, a3 }); }
@Override public IASTAppendable copyAppendable() { AST ast = new AST(); // ast.fProperties = null; ast.array = array.clone(); ast.hashValue = 0; ast.firstIndex = firstIndex; ast.lastIndex = lastIndex; return ast; }
/** * * @param intialCapacity * the initial capacity (i.e. number of arguments without the header element) of the list. * @param head * @return */ public static AST newInstance(final int intialCapacity, final IExpr head) { AST ast = new AST(intialCapacity + 1, false); ast.append(head); return ast; }
public static AST newInstance(final IExpr head) { // AST ast; // if (Config.SERVER_MODE) { // ast = FACTORY.object(); // } else { // ast = new AST(5, false); // } AST ast = new AST(5, false); ast.add(head); return ast; }
public static AST newInstance(final IExpr head) { AST ast = new AST(5, false); ast.append(head); return ast; }
protected static AST newInstance(final int intialCapacity, final IAST ast, int endPosition) { AST result = new AST(intialCapacity, false); result.appendAll(ast, 0, endPosition); return result; }
public static AST newInstance(final ISymbol symbol, final int... arr) { IExpr[] eArr = new IExpr[arr.length + 1]; eArr[0] = symbol; for (int i = 1; i <= arr.length; i++) { eArr[i] = AbstractIntegerSym.valueOf(arr[i - 1]); } return new AST(eArr); }
/** * * @param intialCapacity * the initial capacity (i.e. number of arguments without the header * element) of the list. * @param head * @return */ public static AST newInstance(final int intialCapacity, final IExpr head) { AST ast = new AST(intialCapacity + 1, false); ast.add(head); return ast; }
public IAST removeFromEnd(int fromPosition) { if (0 < fromPosition && fromPosition <= size()) { if (fromPosition == size()) { return this; } AST ast = new AST(array); ast.firstIndex = firstIndex; ast.lastIndex = firstIndex + fromPosition; return ast; } else { throw new IndexOutOfBoundsException( "Index: " + Integer.valueOf(fromPosition) + ", Size: " + Integer.valueOf(lastIndex - firstIndex)); } }
public static AST newInstance(final IExpr[] arr, final IExpr head) { AST ast = new AST(arr.length + 1, false); ast.add(head); for (int i = 0; i < arr.length; i++) { ast.add(arr[i]); } return ast; }
public static AST newInstance(final ISymbol symbol, final org.apache.commons.math3.complex.Complex[] arr) { // AST ast; // if (Config.SERVER_MODE) { // ast = FACTORY.object(); // } else { // ast = new AST(5, false); // } AST ast = new AST(5, false); ast.add(symbol); for (int i = 1; i <= arr.length; i++) { ast.add(i, ComplexNum.valueOf(arr[i - 1].getReal(),arr[i - 1].getImaginary())); } return ast; }
/** {@inheritDoc} */ @Override public IASTAppendable copyFrom(int index) { AST result = new AST(size() - index + 1, false); result.append(head()); result.appendAll(this, index, size()); return result; }