package org.geogebra.common.kernel.cas;
import org.geogebra.common.kernel.Kernel;
import org.geogebra.common.kernel.arithmetic.Command;
import org.geogebra.common.kernel.commands.CommandProcessor;
import org.geogebra.common.kernel.commands.EvalInfo;
import org.geogebra.common.kernel.geos.CasEvaluableFunction;
import org.geogebra.common.kernel.geos.GeoElement;
import org.geogebra.common.main.MyError;
/**
* PartialFractions
*/
public class CmdPartialFractions extends CommandProcessor {
/**
* Create new command processor
*
* @param kernel
* kernel
*/
public CmdPartialFractions(Kernel kernel) {
super(kernel);
}
@Override
final public GeoElement[] process(Command c, EvalInfo info) throws MyError {
int n = c.getArgumentNumber();
GeoElement[] arg;
arg = resArgs(c);
switch (n) {
case 1:
if (arg[0] instanceof CasEvaluableFunction) {
AlgoPartialFractions algo = new AlgoPartialFractions(cons,
c.getLabel(), (CasEvaluableFunction) arg[0], info);
GeoElement[] ret = { algo.getResult() };
return ret;
}
throw argErr(app, c, arg[0]);
// more than one argument
default:
throw argNumErr(app, c, n);
}
}
}