blob: cdeef8e8f18fffc5c176c0b94112d2f93d4b82b8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
package st;
import java.util.ArrayList;
public abstract class AbstractInstance {
protected String name; // the literal name of the declaration
protected TypeEnum type; // the type of the declaration
protected ClassInstance cls; // the surrounding class
public AbstractInstance(String name, TypeEnum type) {
this.type = type;
this.name = name;
}
@Override public String toString() {
return this.name;
}
public boolean equals(AbstractInstance other) {
return this.name == other.getName() &&
this.type == this.type;
}
@Override public int hashCode() {
return this.name.hashCode();
}
public void addClassInstance(ClassInstance cls) {
this.cls = cls;
}
public String getName() {
return this.name;
}
public TypeEnum getType() {
return this.type;
}
public ClassInstance getClassInstance() {
return this.cls;
}
}
|