package org.matheclipse.core.generic;
import org.matheclipse.core.expression.F;
import org.matheclipse.core.interfaces.IAST;
import org.matheclipse.core.interfaces.IExpr;
import com.google.common.base.Function;
/**
* Collect the arguments in a new constructed internal AST.
*
*/
public class UnaryCollect implements Function {
protected IAST fAST;
/**
* Define an unary AST with the header head. This new AST
* collects the arguments of the apply() method.
*
* @param head
* the AST's head expresion
*/
public UnaryCollect(final IExpr head) {
fAST = F.ast(head, 1, false);
}
/**
* Add firstArg to this collection
*
*/
public IExpr apply(final IExpr firstArg) {
fAST.add(firstArg);
return fAST;
}
public IAST getCollectedAST() {
return fAST;
}
}
Ads help maintain this website.