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.call;
22
23 import java.util.Date;
24
25 import autohit.universe.Universe;
26
27 /**
28 * DATE call. Returns a formatted date string.
29 * <pre>
30 * REQURIES: logger
31 * IGNORES: uni, core
32 * </pre>
33 *
34 * @author Erich P. Gatejen
35 * @version 1.0
36 * <i>Version History</i>
37 * <code>EPG - Initial - 25Apr03</code>
38 *
39 */
40 public class Call_DATE extends Call {
41
42 /**
43 * Implement this to handle load time initialization. The
44 * four main fields will already be set--vmc, sc, log, and u.
45 * You must implement this, but you don't have to do anything.
46 * Remember that calls are cached per VM and reused as often
47 * as possible. There will be no thread-safety issues with the
48 * VMCore or log, but the SystemContecxt and Universe may be shared.
49 * @throws CallException
50 */
51 public void load_chain() throws CallException {
52 // Nothing to do.
53 }
54
55 /**
56 * Implement this to return the name of the CALL
57 * @return name of the CALL
58 */
59 public String name() {
60 return "DATE";
61 }
62
63 /**
64 * Execute it.
65 * @return the result or null if there is no result
66 */
67 public String call() throws CallException {
68 Date d = new Date();
69 this.debug("returned=" + d.toString());
70 return d.toString();
71 }
72
73 /**
74 * Execute using the passed universe, rather than the loaded.
75 * @param uni a universe
76 * @return the result or null if there is no result
77 * @see autohit.universe.Universe
78 */
79 public String call(Universe uni) throws CallException {
80 return this.call();
81 }
82 }
|