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 setLocIdentifier(String s) {
37 public void setLocDescriptor(Descriptor d) {
41 public Descriptor getLocDescriptor() {
45 public void setType(int type) {
49 public Descriptor getDescriptor() {
53 public String getLocIdentifier() {
57 public int getType() {
61 public boolean equals(Object o) {
62 if (!(o instanceof Location)) {
66 Location loc = (Location) o;
68 if (loc.getDescriptor().equals(getDescriptor())) {
69 if (loc.getLocIdentifier() == null || getLocIdentifier() == null) {
70 if (loc.getType() == getType()) {
74 if (loc.getLocIdentifier().equals(getLocIdentifier())) {
83 public int hashCode() {
85 int hash = d.hashCode();
87 hash += loc.hashCode();
93 public String toString() {
94 return "Loc[" + d.getSymbol() + "." + loc + "]";
97 public String getSymbol() {
98 return d.getSymbol() + "." + loc;
101 public static Location createTopLocation(Descriptor d) {
102 Location topLoc = new Location(d, TOP);
106 public static Location createBottomLocation(Descriptor d) {
107 Location bottomLoc = new Location(d, BOTTOM);
111 public boolean isTop() {