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   private boolean isMergeNode;
14
15   public HNode() {
16     this.isSkeleton = false;
17     this.isCombinationNode = false;
18     this.isSharedNode = false;
19     this.isMergeNode = false;
20   }
21
22   public boolean isMergeNode() {
23     return isMergeNode;
24   }
25
26   public void setMergeNode(boolean isMergeNode) {
27     this.isMergeNode = isMergeNode;
28   }
29
30   public HNode(String name) {
31     this();
32     this.name = name;
33   }
34
35   public HNode(Descriptor d) {
36     this();
37     this.desc = d;
38     this.name = d.getSymbol();
39   }
40
41   public boolean isSharedNode() {
42     return isSharedNode;
43   }
44
45   public void setSharedNode(boolean b) {
46     this.isSharedNode = b;
47   }
48
49   public boolean isSkeleton() {
50     return isSkeleton;
51   }
52
53   public void setSkeleton(boolean isSkeleton) {
54     this.isSkeleton = isSkeleton;
55   }
56
57   public boolean isCombinationNode() {
58     return isCombinationNode;
59   }
60
61   public void setCombinationNode(boolean b) {
62     isCombinationNode = b;
63   }
64
65   public String getName() {
66     return name;
67   }
68
69   public boolean equals(Object o) {
70     if (o instanceof HNode) {
71       HNode in = (HNode) o;
72       if (getName().equals(in.getName())) {
73         return true;
74       }
75     }
76     return false;
77   }
78
79   public String getNamePropertyString() {
80     return toString().substring(1, toString().length() - 1);
81   }
82
83   public String toString() {
84
85     String properties = "";
86
87     if (isSharedNode()) {
88       properties += "*";
89     }
90
91     if (isCombinationNode()) {
92       properties += "C";
93     }
94
95     if (isSkeleton()) {
96       properties += "S";
97     }
98
99     if (properties.length() > 0) {
100       properties = "(" + properties + ")";
101     }
102
103     return "[" + name + properties + "]";
104   }
105
106   public Descriptor getDescriptor() {
107     return desc;
108   }
109
110   public int hashCode() {
111     return 7 + name.hashCode();
112   }
113
114 }