package org.geogebra.common.kernel.statistics;
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.geos.GeoElement;
import org.geogebra.common.kernel.geos.GeoList;
import org.geogebra.common.kernel.geos.GeoNumeric;
import org.geogebra.common.main.MyError;
/**
* ZProportionTest
*/
public class CmdZMeanEstimate extends CommandProcessor {
/**
* Create new command processor
*
* @param kernel
* kernel
*/
public CmdZMeanEstimate(Kernel kernel) {
super(kernel);
}
@Override
public GeoElement[] process(Command c) throws MyError {
int n = c.getArgumentNumber();
boolean[] ok = new boolean[n];
GeoElement[] arg;
arg = resArgs(c);
switch (n) {
case 3:
if ((ok[0] = arg[0].isGeoList()) && (ok[1] = arg[1].isGeoNumeric())
&& (ok[2] = arg[2].isGeoNumeric())) {
AlgoZMeanEstimate algo = new AlgoZMeanEstimate(cons,
c.getLabel(), (GeoList) arg[0], (GeoNumeric) arg[1],
(GeoNumeric) arg[2]);
GeoElement[] ret = { algo.getResult() };
return ret;
}
throw argErr(app, c, getBadArg(ok, arg));
case 4:
if ((ok[0] = arg[0].isGeoNumeric())
&& (ok[1] = arg[1].isGeoNumeric())
&& (ok[2] = arg[2].isGeoNumeric())
&& (ok[3] = arg[3].isGeoNumeric())) {
AlgoZMeanEstimate algo = new AlgoZMeanEstimate(cons,
c.getLabel(), (GeoNumeric) arg[0], (GeoNumeric) arg[1],
(GeoNumeric) arg[2], (GeoNumeric) arg[3]);
GeoElement[] ret = { algo.getResult() };
return ret;
}
throw argErr(app, c, getBadArg(ok, arg));
default:
throw argNumErr(app, c, n);
}
}
}