~ubuntu-branches/debian/sid/geogebra/sid

« back to all changes in this revision

Viewing changes to geogebra/kernel/commands/CmdMeanX.java

  • Committer: Package Import Robot
  • Author(s): Giovanni Mascellani
  • Date: 2012-01-10 11:37:41 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20120110113741-satwohsd4de4ite1
Tags: 4.0.19.0+dfsg1-1
* New upstream version (closes: #649893).
* Update dependency: icedtea-plugin -> icedtea-netx-common (LP: #893007).
* New thumbnailer configuration compatible with Gnome 3.
* Package building is now managed by javahelper instead of upstream
  build.xml.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package geogebra.kernel.commands;
 
2
 
 
3
import geogebra.kernel.GeoElement;
 
4
import geogebra.kernel.GeoList;
 
5
import geogebra.kernel.Kernel;
 
6
import geogebra.kernel.arithmetic.Command;
 
7
import geogebra.main.MyError;
 
8
 
 
9
class CmdMeanX extends CmdOneOrTwoListsFunction {
 
10
 
 
11
        public CmdMeanX(Kernel kernel) {
 
12
                super(kernel);
 
13
        }
 
14
        
 
15
        public GeoElement[] process(Command c) throws MyError {
 
16
                int n = c.getArgumentNumber();
 
17
                GeoElement[] arg;
 
18
                arg = resArgs(c);
 
19
                switch (n) {
 
20
                case 1:
 
21
                        arg = resArgs(c);
 
22
                        if (arg[0].isGeoList()) {
 
23
                                GeoElement[] ret = { 
 
24
                                                doCommand(c.getLabel(),
 
25
                                                (GeoList) arg[0]) };
 
26
                                return ret;
 
27
                        } else
 
28
                                throw argErr(app, c.getName(), arg[0]);
 
29
                
 
30
                default:
 
31
                        throw argNumErr(app, c.getName(), n);
 
32
                }
 
33
        }
 
34
 
 
35
        final protected GeoElement doCommand(String a, GeoList b)
 
36
        {
 
37
                return kernel.MeanX(a, b);
 
38
        }
 
39
 
 
40
        final protected GeoElement doCommand(String a, GeoList b, GeoList c)
 
41
        {
 
42
                throw argErr(app, a, b);
 
43
        }
 
44
 
 
45
 
 
46
}