1
2
3
4 package net.sf.bddbddb.ir.dynamic;
5
6 import java.util.Collections;
7 import java.util.Iterator;
8 import java.util.List;
9 import net.sf.bddbddb.IterationList;
10 import net.sf.bddbddb.Relation;
11 import net.sf.bddbddb.ir.Operation;
12 import net.sf.bddbddb.ir.OperationVisitor;
13
14 /***
15 * If
16 *
17 * @author John Whaley
18 * @version $Id: If.java 328 2004-10-16 02:45:30Z joewhaley $
19 */
20 public class If extends Operation {
21 IRBoolean bool;
22 IterationList block;
23
24 public If(IRBoolean bool, IterationList block) {
25 this.bool = bool;
26 this.block = block;
27 }
28
29
30
31
32
33
34 public Object visit(DynamicOperationVisitor i) {
35 return i.visit(this);
36 }
37
38 public Object visit(OperationVisitor i) {
39 return i.visit(this);
40 }
41
42
43
44
45
46
47 public String toString() {
48 StringBuffer sb = new StringBuffer();
49 sb.append("If(" + bool.getName() + ") " + block + ": [ ");
50 for (Iterator it = block.iterator(); it.hasNext();) {
51 Object elem = (Object) it.next();
52 sb.append(elem.toString() + "; ");
53 }
54 sb.append("]");
55 return sb.toString();
56 }
57
58
59
60
61
62
63 public Relation getRelationDest() {
64 return null;
65 }
66
67
68
69
70
71
72 public List getSrcs() {
73 return Collections.EMPTY_LIST;
74 }
75
76 public IRBoolean getBoolSrc() {
77 return bool;
78 }
79
80
81
82
83
84
85 public String getExpressionString() {
86 return toString();
87 }
88
89 /***
90 * @return the target block
91 */
92 public IterationList getBlock() {
93 return block;
94 }
95
96
97
98
99
100
101 public Operation copy() {
102 return new If(bool, block);
103 }
104
105
106
107
108
109
110
111 public void replaceSrc(Relation r_old, Relation r_new) {
112 }
113
114
115
116
117
118
119 public void setRelationDest(Relation r0) {
120 }
121 }