View Javadoc

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