01: // Copyright (c) 2002 Cunningham & Cunningham, Inc.
02: // Released under the terms of the GNU General Public License version 2 or later.
03:
04: package eg.music;
05:
06: import fit.*;
07: import java.util.Date;
08:
09: public class Realtime extends TimedActionFixture {
10:
11: Simulator system = Simulator.system;
12:
13: public Date time() {
14: return new Date(Simulator.time);
15: }
16:
17: public void pause() {
18: double seconds = Double.parseDouble(cells.more.text());
19: system.delay(seconds);
20: }
21:
22: public void await() throws Exception {
23: system("wait", cells.more);
24: }
25:
26: public void fail() throws Exception {
27: system("fail", cells.more);
28: }
29:
30: public void enter() throws Exception {
31: system.delay(0.8);
32: super .enter();
33: }
34:
35: public void press() throws Exception {
36: system.delay(1.2);
37: super .press();
38: }
39:
40: private void system(String prefix, Parse cell) throws Exception {
41: String method = camel(prefix + " " + cell.text());
42: Class[] empty = {};
43: try {
44: system.getClass().getMethod(method, empty).invoke(system,
45: empty);
46: } catch (Exception e) {
47: exception(cell, e);
48: }
49: }
50: }
|