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