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) {
21 if (loc.equals(SSJavaAnalysis.TOP)) {
23 } else if (loc.equals(SSJavaAnalysis.BOTTOM)) {
31 public Location(Descriptor d, int type) {
35 loc = SSJavaAnalysis.TOP;
36 } else if (type == BOTTOM) {
37 loc = SSJavaAnalysis.BOTTOM;
41 public void setLocIdentifier(String s) {
45 public void setLocDescriptor(Descriptor d) {
49 public Descriptor getLocDescriptor() {
53 public void setType(int type) {
57 public Descriptor getDescriptor() {
61 public String getLocIdentifier() {
65 public int getType() {
69 public boolean equals(Object o) {
70 if (!(o instanceof Location)) {
74 Location loc = (Location) o;
76 if (loc.getDescriptor().equals(getDescriptor())) {
77 if (loc.getLocIdentifier() == null || getLocIdentifier() == null) {
78 if (loc.getType() == getType()) {
82 if (loc.getLocIdentifier().equals(getLocIdentifier())) {
91 public int hashCode() {
93 int hash = d.hashCode();
95 hash += loc.hashCode();
101 public String toString() {
102 return "Loc[" + d.getSymbol() + "." + loc + "]";
105 public String getSymbol() {
106 return d.getSymbol() + "." + loc;
109 public static Location createTopLocation(Descriptor d) {
110 Location topLoc = new Location(d, TOP);
114 public static Location createBottomLocation(Descriptor d) {
115 Location bottomLoc = new Location(d, BOTTOM);
119 public boolean isTop() {