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.Relation;
9 import net.sf.bddbddb.ir.Operation;
10
11 /***
12 * Invert
13 *
14 * @author John Whaley
15 * @version $Id: Invert.java 328 2004-10-16 02:45:30Z joewhaley $
16 */
17 public class Invert extends HighLevelOperation {
18 Relation r0, r1;
19
20 /***
21 * @param r0
22 * @param r1
23 */
24 public Invert(Relation r0, Relation r1) {
25 super();
26 this.r0 = r0;
27 this.r1 = r1;
28 }
29
30
31
32
33
34
35 public Object visit(HighLevelOperationVisitor i) {
36 return i.visit(this);
37 }
38
39
40
41
42
43
44 public String toString() {
45 return r0.toString() + " = " + getExpressionString();
46 }
47
48
49
50
51
52
53 public String getExpressionString() {
54 return "invert(" + r1.toString() + ")";
55 }
56
57
58
59
60
61
62 public Relation getRelationDest() {
63 return r0;
64 }
65
66
67
68
69
70
71 public List getSrcs() {
72 return Collections.singletonList(r1);
73 }
74
75 /***
76 * @return Returns the source relation.
77 */
78 public Relation getSrc() {
79 return r1;
80 }
81
82 public Operation copy() {
83 return new Invert(r0, r1);
84 }
85
86
87
88
89
90
91
92 public void replaceSrc(Relation r_old, Relation r_new) {
93 if (r1 == r_old) r1 = r_new;
94 }
95
96
97
98
99
100
101 public void setRelationDest(Relation r0) {
102 this.r0 = r0;
103 }
104 }