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;
41 this.description = description;
43 referencers = new HashSet<OwnershipNode>();
44 memberFields = new HashSet<TempDescriptor>();
47 public HeapRegionNode copy() {
48 return new HeapRegionNode( id,
58 public Integer getID() {
63 public boolean equals( HeapRegionNode hrn ) {
66 return id.equals( hrn.getID() ) &&
67 isSingleObject == hrn.isSingleObject() &&
68 isFlagged == hrn.isFlagged() &&
69 isNewSummary == hrn.isNewSummary() &&
70 alpha.equals( hrn.getAlpha() ) &&
71 description.equals( hrn.getDescription() );
76 public boolean isSingleObject() {
77 return isSingleObject;
80 public boolean isFlagged() {
84 public boolean isNewSummary() {
90 public Iterator iteratorToReferencers() {
91 return referencers.iterator();
94 public Iterator iteratorToReferencersClone() {
95 HashSet hs = (HashSet) referencers.clone();
99 public void addReferencer( OwnershipNode on ) {
102 referencers.add( on );
105 public void removeReferencer( OwnershipNode on ) {
107 assert referencers.contains( on );
109 referencers.remove( on );
112 public boolean isReferencedBy( OwnershipNode on ) {
114 return referencers.contains( on );
118 public AllocationSite getAllocationSite() {
123 public void setAlpha( ReachabilitySet alpha ) {
127 public ReachabilitySet getAlpha() {
131 public ReachabilitySet getAlphaNew() {
135 public void setAlphaNew( ReachabilitySet alpha ) {
136 this.alphaNew = alpha;
139 public void applyAlphaNew() {
140 assert alphaNew != null;
146 public String getIDString() {
147 return id.toString();
150 public String getAlphaString() {
151 return alpha.toStringEscapeNewline();
154 public String toString() {
155 return "HRN"+getIDString();
158 // WHY WHY WHY WHY WHY WHY?!
159 public String getDescription() {
160 return new String( description );
161 //return new String( description+" ID "+getIDString() );