1 package Analysis.SSJava;
4 import IR.TypeExtension;
6 public class Location implements TypeExtension {
8 public static final int TOP = 1;
9 public static final int NORMAL = 2;
10 public static final int BOTTOM = 3;
16 public Location(Descriptor d, String loc) {
22 public Location(Descriptor d, int type) {
26 loc = SSJavaAnalysis.TOP;
27 } else if (type == BOTTOM) {
28 loc = SSJavaAnalysis.BOTTOM;
32 public void setType(int type) {
36 public Descriptor getDescriptor() {
40 public String getLocIdentifier() {
44 public int getType() {
48 public boolean equals(Object o) {
49 if (!(o instanceof Location)) {
53 Location loc = (Location) o;
55 if (loc.getDescriptor().equals(getDescriptor())) {
56 if (loc.getLocIdentifier() == null || getLocIdentifier() == null) {
57 if (loc.getType() == getType()) {
61 if (loc.getLocIdentifier().equals(getLocIdentifier())) {
70 public int hashCode() {
72 int hash = d.hashCode();
74 hash += loc.hashCode();
80 public String toString() {
81 return "Loc[" + d.getSymbol() + "." + loc + "]";
84 public String getSymbol() {
85 return d.getSymbol() + "." + loc;
88 public static Location createTopLocation(Descriptor d) {
89 Location topLoc = new Location(d, TOP);
93 public static Location createBottomLocation(Descriptor d) {
94 Location bottomLoc = new Location(d, BOTTOM);
98 public boolean isTop() {