View Javadoc

1   package net.sf.tomp.xtcl.command;
2   
3   import net.sf.tomp.xtcl.Command;
4   import net.sf.tomp.xtcl.Context;
5   
6   /***
7    * DOCUMENT ME!
8    * 
9    * @author tomp
10   */
11  public class Function extends AbstractCommand {
12      /*** DOCUMENT ME! */
13      protected String name;
14  
15      /*** DOCUMENT ME! */
16      protected String[] params;
17  
18      /*** DOCUMENT ME! */
19      protected Command command;
20  
21      /***
22       * DOCUMENT ME!
23       * 
24       * @param context DOCUMENT ME!
25       * @return DOCUMENT ME!
26       * @throws Exception DOCUMENT ME!
27       */
28      public int execute(Context context) throws Exception {
29          return command.execute(context);
30      }
31  
32      /***
33       * DOCUMENT ME!
34       * 
35       * @param p DOCUMENT ME!
36       */
37      public void setName(String p) {
38          name = p;
39      }
40  
41      /***
42       * DOCUMENT ME!
43       * 
44       * @param p DOCUMENT ME!
45       */
46      public void setParams(String[] p) {
47          params = p;
48      }
49  
50      /***
51       * DOCUMENT ME!
52       * 
53       * @param c DOCUMENT ME!
54       */
55      public void setCommand(Command c) {
56          command = c;
57      }
58  
59      /***
60       * DOCUMENT ME!
61       * 
62       * @param i DOCUMENT ME!
63       * @return DOCUMENT ME!
64       */
65      public String param(int i) {
66          return params[i];
67      }
68  
69      /***
70       * DOCUMENT ME!
71       * 
72       * @return DOCUMENT ME!
73       */
74      public String toString() {
75          return "FUNCTION " + name + " (" + listArray(params) + ") {" + command
76                  + "}";
77      }
78  }
79  
80  /*
81   * The contents of this file are subject to the Mozilla Public License Version
82   * 1.1 (the "License"); you may not use this file except in compliance with the
83   * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
84   * Software distributed under the License is distributed on an "AS IS" basis,
85   * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
86   * the specific language governing rights and limitations under the License. The
87   * Original Code is: all this file. The Initial Developer of the Original Code
88   * is: Tomas Pitner, Masaryk University in Brno, Czech Republic. Contributor(s):
89   */