View Javadoc

1   package net.sf.tomp.xml.include.xtcl;
2   
3   import net.sf.tomp.xml.include.AdaptiveFilterImpl;
4   import net.sf.tomp.xml.type.TypeDatabase;
5   import net.sf.tomp.xml.type.xtcl.TypeDetectorFilterCommand;
6   import net.sf.tomp.xtcl.Context;
7   
8   import java.io.PrintStream;
9   
10  /***
11   * DOCUMENT ME!
12   * 
13   * @author tomp
14   */
15  public class AdaptiveFilterCommand extends TypeDetectorFilterCommand {
16      /***
17       * DOCUMENT ME!
18       * 
19       * @param context DOCUMENT ME!
20       * @return DOCUMENT ME!
21       * @throws Exception DOCUMENT ME!
22       */
23      public int execute(Context context) throws Exception {
24          PrintStream out = context.getOut();
25  
26          if (out == null) {
27              return 0;
28          }
29  
30          AdaptiveFilterImpl af = new AdaptiveFilterImpl();
31          TypeDatabase tdb = (TypeDatabase) context.get(tdVar);
32  
33          if (tdb == null) {
34              out.print("ERR " + this);
35  
36              return 1;
37          } else {
38              af.setTypeDatabase(tdb);
39              initFilter(af, context);
40              context.put(var, af);
41              out.print("OK " + this);
42  
43              return 0;
44          }
45      }
46  
47      /***
48       * DOCUMENT ME!
49       * 
50       * @return DOCUMENT ME!
51       */
52      public String toString() {
53          return "ADAPTIVEFILTER " + var + " type-database=" + tdVar + " ("
54                  + listMap(params) + ")";
55      }
56  }
57  
58  /*
59   * The contents of this file are subject to the Mozilla Public License Version
60   * 1.1 (the "License"); you may not use this file except in compliance with the
61   * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
62   * Software distributed under the License is distributed on an "AS IS" basis,
63   * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
64   * the specific language governing rights and limitations under the License. The
65   * Original Code is: all this file. The Initial Developer of the Original Code
66   * is: Tomas Pitner, Masaryk University in Brno, Czech Republic. Contributor(s):
67   */