1 /**
2 * AUTOHIT 2003
3 * Copyright Erich P Gatejen (c) 1989,1997,2003,2004
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or (at
8 * your option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Additional license information can be found in the documentation.
19 * @author Erich P Gatejen
20 */
21 package autohit.server.command;
22
23 import autohit.common.channels.Atom;
24 import autohit.common.channels.Injector;
25
26 /**
27 * A command Atom. It carries a command. It is based on a channel Atom
28 * so it should be transmittable.<p>
29 * The object must be a String if it carries a single, required parameter,
30 * or a Vector if it carries multiple, required or optional parameters.
31 * See the specific target command for usage.
32 * @author Erich P. Gatejen
33 * @version 1.0
34 * <i>Version History</i>
35 * <code>EPG - Initial - 24Jul03</code>
36 *
37 */
38 public class CommandAtom extends Atom {
39
40 final static long serialVersionUID = 1;
41
42 /**
43 * Numeric values
44 */
45 public final static int UNKNOWN_COMMAND = 0;
46
47 /**
48 * Default constructor. Default priority of ROUTINE. Null object.
49 * Generic type. Timestamped. You may need to set ri to a
50 * response injector, though the handler may use a default.
51 */
52 public CommandAtom() {
53 super();
54 numeric = UNKNOWN_COMMAND;
55 type = Atom.TYPE_CONTROL;
56 }
57
58 /**
59 * Set response injector constructor.
60 * Default priority of ROUTINE. Null object.
61 * Generic type. Timestamped.
62 */
63 public CommandAtom(Injector response) {
64 super();
65 numeric = UNKNOWN_COMMAND;
66 type = Atom.TYPE_CONTROL;
67 }
68
69 /**
70 * Constructor Sets command numeric and param object.
71 * @param n the command numeric
72 * @param o the object
73 */
74 public CommandAtom(int n, Object o) {
75 super(Atom.TYPE_CONTROL, Atom.ROUTINE, n, o);
76 }
77
78 /**
79 * Use this constructor, as it is the most convenient
80 * @param n the command numeric
81 * @param o the object
82 * @param p the priority
83 */
84 public CommandAtom(int n, Object o, int p) {
85 super(Atom.TYPE_CONTROL,p,n,o);
86 }
87
88 }
|