01: /*
02: * @(#)init.java 1.2 04/12/06
03: *
04: * Copyright (c) 2001-2004 Sun Microsystems, Inc. All Rights Reserved.
05: *
06: * See the file "LICENSE.txt" for information on usage and redistribution
07: * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
08: */
09: package pnuts.math;
10:
11: import pnuts.lang.Context;
12: import pnuts.ext.ModuleBase;
13:
14: /**
15: * Initialization of the pnuts.math module.
16: */
17: public class init extends ModuleBase {
18:
19: static String[] javaFunctions = { "sin", "cos", "tan", "asin",
20: "acos", "atan", "atan2", "exp", "log", "sqrt", "round",
21: "pow", "ceil", "floor", "rint", "toRadians", "toDegrees",
22: "IEEEremainder", "max", "min", "abs" };
23:
24: protected String getPrefix() {
25: return "org";
26: }
27:
28: public Object execute(Context context) {
29: context.clearPackages();
30: for (int i = 0; i < javaFunctions.length; i++) {
31: autoloadFunction(javaFunctions[i], context);
32: }
33: return null;
34: }
35: }
|