1 /**
2 * .
3 * Copyright � 1999 Erich P G.
4 *
5 */
6
7 package autohit.vm;
8
9 import java.io.Serializable;
10
11 /**
12 * A Virtual Machine instruction. This impliments the tail of a
13 * while loop. If the expression matches the value, then the ip
14 * will changed to point to the instruction following the
15 * block starting SCOPE. Otherwise, the ip is incremented to point
16 * to the following RSCOPE.
17 * <p>
18 * <pre>
19 * ip (Instruction Pointer) Flow
20 *
21 * expression == value
22 * ------------------
23 * | |
24 * V |
25 * [SCOPE] ..code block.. [WHILE][RSCOPE]
26 * | ^
27 * -------|
28 * expression != value
29 *
30 * </pre>
31 * @see autohit.vm.VMInstruction
32 *
33 * @author Erich P. Gatejen
34 * @version 1.0
35 * <i>Version History</i>
36 * <code>EPG - Initial - 19Jan99</code>
37 *
38 */
39 public class VMIWhile extends VMInstruction {
40
41 // --- FINAL FIELDS ------------------------------------------------------
42
43 // --- FIELDS ------------------------------------------------------------
44
45 /**
46 * Expresion
47 * @serial
48 */
49 public String e;
50
51 /**
52 * Test value.
53 * @serial
54 */
55 public String value;
56
57 /**
58 * Target if expression true.
59 * @serial
60 */
61 public int target;
62
63 // --- PUBLIC METHODS ----------------------------------------------------
64
65 /**
66 * Default constructor.
67 */
68 public VMIWhile() {
69 nToken = VMInstruction.WHILE;
70 }
71
72
73 /**
74 * Dump this Instruction. Mostly for debugging.
75 *
76 * @return a String containing the dump.
77 */
78 public String toString() {
79 StringBuffer d = new StringBuffer();
80 d.append(" VMIWhile -------------------------- \n");
81 d.append(" e = " + e + "\n");
82 d.append(" value = " + value + "\n");
83 d.append(" target = " + target + "\n");
84 return d.toString();
85 }
86 // --- PRIVATE METHODS ---------------------------------------------------
87
88
89 }
|