correct
[repair.git] / Repair / RepairCompiler / MCC / IR / Expr.java
1 package MCC.IR;
2
3 import java.util.*;
4
5 public abstract class Expr {
6
7     TypeDescriptor td = null;
8
9     public Expr() {}
10     /* Remap this's variables using the remap mapping */
11     public abstract boolean equals(Map remap, Expr e);
12
13     public abstract Set getRequiredDescriptors();
14
15     public abstract void generate(CodeWriter writer, VarDescriptor dest);
16
17     public TypeDescriptor getType() {
18         assert td != null : toString();
19         return td;
20     }
21
22     public String toString() {
23         return name();
24     }
25
26     public String name() {
27         System.out.println(this.getClass().getName());
28         return "?";
29     }
30
31     public abstract TypeDescriptor typecheck(SemanticAnalyzer sa);
32
33     public abstract void prettyPrint(PrettyPrinter pp);
34
35     public Set getInversedRelations() {
36         throw new IRException("unsupported");
37     }
38
39     public DNFRule constructDNF() {
40         return new DNFRule(this);
41     }
42
43     public Descriptor getDescriptor() {
44         return null;
45     }
46
47     public boolean isValue(TypeDescriptor td) {
48         return false;
49     }
50
51     public int[] getRepairs(boolean negated, Termination t) {
52         System.out.println(this.getClass().getName());
53         throw new Error("Unrecognized EXPR");
54     }
55
56     public boolean inverted() {
57         return false;
58     }
59
60     public Set useDescriptor(Descriptor d) {
61         return new HashSet();
62     }
63
64     public boolean usesDescriptor(Descriptor rd) {
65         System.out.println(this.getClass().getName());
66         throw new Error("UNIMPLEMENTED");
67     }
68     public boolean isNull() {
69         return false;
70     }
71     public boolean isNonNull() {
72         return false;
73     }
74     public Set freeVars() {
75         return null;
76     }
77
78     public void findmatch(Descriptor d, Set s) {
79     }
80
81     public Set getfunctions() {
82         return null;
83     }
84
85     public SetDescriptor getSet() {
86         return null; /* unknown value */
87     }
88
89     public Expr stripCastExpr() {
90         Expr ptr=this;
91         while (ptr instanceof CastExpr)
92             ptr=((CastExpr)ptr).getExpr();
93         return ptr;
94     }
95
96     public boolean isSafe() {
97         return true;
98     }
99
100     public Expr getLower() {
101         return null;
102     }
103
104     public Expr getUpper() {
105         return null;
106     }
107     public boolean isInvariant(Set vars) {
108         return false;
109     }
110     public Set findInvariants(Set vars) {
111         return new HashSet();
112     }
113 }