changes.
[IRC.git] / Robust / src / Analysis / SSJava / HNode.java
1 package Analysis.SSJava;
2
3 import IR.Descriptor;
4
5 public class HNode {
6
7   private String name;
8   private Descriptor desc;
9
10   private boolean isSkeleton;
11   private boolean isCombinationNode;
12   private boolean isSharedNode;
13
14   public HNode() {
15     this.isSkeleton = false;
16     this.isCombinationNode = false;
17     this.isSharedNode = false;
18   }
19
20   public HNode(String name) {
21     this();
22     this.name = name;
23   }
24
25   public HNode(Descriptor d) {
26     this();
27     this.desc = d;
28     this.name = d.getSymbol();
29   }
30
31   public boolean isSharedNode() {
32     return isSharedNode;
33   }
34
35   public void setSharedNode(boolean b) {
36     this.isSharedNode = b;
37   }
38
39   public boolean isSkeleton() {
40     return isSkeleton;
41   }
42
43   public void setSkeleton(boolean isSkeleton) {
44     this.isSkeleton = isSkeleton;
45   }
46
47   public boolean isCombinationNode() {
48     return isCombinationNode;
49   }
50
51   public void setCombinationNode(boolean b) {
52     isCombinationNode = b;
53   }
54
55   public String getName() {
56     return name;
57   }
58
59   public boolean equals(Object o) {
60     if (o instanceof HNode) {
61       HNode in = (HNode) o;
62       if (getName().equals(in.getName())) {
63         return true;
64       }
65     }
66     return false;
67   }
68
69   public String toString() {
70
71     String properties = "";
72
73     if (isSharedNode()) {
74       properties += "*";
75     }
76
77     if (isCombinationNode()) {
78       properties += "C";
79     }
80
81     if (isSkeleton()) {
82       properties += "S";
83     }
84
85     if (properties.length() > 0) {
86       properties = "(" + properties + ")";
87     }
88
89     return "[" + name + properties + "]";
90   }
91
92   public Descriptor getDescriptor() {
93     return desc;
94   }
95
96   public int hashCode() {
97     return 7 + name.hashCode();
98   }
99
100 }