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;
17 public Location(Descriptor d, String loc) {
23 public Location(Descriptor d, int type) {
27 loc = SSJavaAnalysis.TOP;
28 } else if (type == BOTTOM) {
29 loc = SSJavaAnalysis.BOTTOM;
33 public void setLocDescriptor(Descriptor d) {
37 public Descriptor getLocDescriptor() {
41 public void setType(int type) {
45 public Descriptor getDescriptor() {
49 public String getLocIdentifier() {
53 public int getType() {
57 public boolean equals(Object o) {
58 if (!(o instanceof Location)) {
62 Location loc = (Location) o;
64 if (loc.getDescriptor().equals(getDescriptor())) {
65 if (loc.getLocIdentifier() == null || getLocIdentifier() == null) {
66 if (loc.getType() == getType()) {
70 if (loc.getLocIdentifier().equals(getLocIdentifier())) {
79 public int hashCode() {
81 int hash = d.hashCode();
83 hash += loc.hashCode();
89 public String toString() {
90 return "Loc[" + d.getSymbol() + "." + loc + "]";
93 public String getSymbol() {
94 return d.getSymbol() + "." + loc;
97 public static Location createTopLocation(Descriptor d) {
98 Location topLoc = new Location(d, TOP);
102 public static Location createBottomLocation(Descriptor d) {
103 Location bottomLoc = new Location(d, BOTTOM);
107 public boolean isTop() {