1 package Analysis.OwnershipAnalysis;
7 public class HeapRegionNode extends OwnershipNode {
11 protected boolean isSingleObject;
12 protected boolean isFlagged;
13 protected boolean isNewSummary;
15 protected HashSet<TempDescriptor> memberFields;
16 protected HashSet<OwnershipNode> referencers;
18 protected AllocationSite allocSite;
20 protected ReachabilitySet alpha;
21 protected ReachabilitySet alphaNew;
23 protected String description;
27 public HeapRegionNode( Integer id,
28 boolean isSingleObject,
31 AllocationSite allocSite,
32 ReachabilitySet alpha,
33 String description ) {
35 this.isSingleObject = isSingleObject;
36 this.isFlagged = isFlagged;
37 this.isNewSummary = isNewSummary;
38 this.allocSite = allocSite;
40 this.description = description;
42 alphaNew = new ReachabilitySet();
43 alphaNew = alphaNew.makeCanonical();
45 referencers = new HashSet<OwnershipNode>();
46 memberFields = new HashSet<TempDescriptor>();
49 public HeapRegionNode copy() {
50 return new HeapRegionNode( id,
60 public Integer getID() {
65 public boolean equals( HeapRegionNode hrn ) {
68 return id.equals( hrn.getID() ) &&
69 isSingleObject == hrn.isSingleObject() &&
70 isFlagged == hrn.isFlagged() &&
71 isNewSummary == hrn.isNewSummary() &&
72 alpha.equals( hrn.getAlpha() ) &&
73 description.equals( hrn.getDescription() );
78 public boolean isSingleObject() {
79 return isSingleObject;
82 public boolean isFlagged() {
86 public boolean isNewSummary() {
92 public Iterator iteratorToReferencers() {
93 return referencers.iterator();
96 public Iterator iteratorToReferencersClone() {
97 HashSet hs = (HashSet) referencers.clone();
101 public void addReferencer( OwnershipNode on ) {
104 referencers.add( on );
107 public void removeReferencer( OwnershipNode on ) {
109 assert referencers.contains( on );
111 referencers.remove( on );
114 public boolean isReferencedBy( OwnershipNode on ) {
116 return referencers.contains( on );
120 public AllocationSite getAllocationSite() {
125 public void setAlpha( ReachabilitySet alpha ) {
129 public ReachabilitySet getAlpha() {
133 public ReachabilitySet getAlphaNew() {
137 public void setAlphaNew( ReachabilitySet alpha ) {
138 this.alphaNew = alpha;
141 public void applyAlphaNew() {
142 assert alphaNew != null;
146 alphaNew = new ReachabilitySet();
147 alphaNew = alphaNew.makeCanonical();
151 public String getIDString() {
152 return id.toString();
155 public String getAlphaString() {
156 return alpha.toStringEscapeNewline();
159 public String toString() {
160 return "HRN"+getIDString();
163 // WHY WHY WHY WHY WHY WHY?!
164 public String getDescription() {
165 return new String( description );
166 //return new String( description+" ID "+getIDString() );