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
60
61
62
63
64
65
66
67