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;
22 protected String description;
26 public HeapRegionNode( Integer id,
27 boolean isSingleObject,
30 AllocationSite allocSite,
31 ReachabilitySet alpha,
32 String description ) {
34 this.isSingleObject = isSingleObject;
35 this.isFlagged = isFlagged;
36 this.isNewSummary = isNewSummary;
37 this.allocSite = allocSite;
39 this.description = description;
41 referencers = new HashSet<OwnershipNode>();
42 memberFields = new HashSet<TempDescriptor>();
45 public HeapRegionNode copy() {
46 return new HeapRegionNode( id,
56 public Integer getID() {
61 public boolean equals( HeapRegionNode hrn ) {
64 return id.equals( hrn.getID() ) &&
65 isSingleObject == hrn.isSingleObject() &&
66 isFlagged == hrn.isFlagged() &&
67 isNewSummary == hrn.isNewSummary() &&
68 alpha.equals( hrn.getAlpha() ) &&
69 description.equals( hrn.getDescription() );
74 public boolean isSingleObject() {
75 return isSingleObject;
78 public boolean isFlagged() {
82 public boolean isNewSummary() {
88 public Iterator iteratorToReferencers() {
89 return referencers.iterator();
92 public Iterator iteratorToReferencersClone() {
93 HashSet hs = (HashSet) referencers.clone();
97 public void addReferencer( OwnershipNode on ) {
100 referencers.add( on );
103 public void removeReferencer( OwnershipNode on ) {
105 assert referencers.contains( on );
107 referencers.remove( on );
110 public boolean isReferencedBy( OwnershipNode on ) {
112 return referencers.contains( on );
116 public AllocationSite getAllocationSite() {
121 public void setAlpha( ReachabilitySet alpha ) {
125 public ReachabilitySet getAlpha() {
130 public String getIDString() {
131 return id.toString();
134 public String getAlphaString() {
135 return alpha.toStringEscapeNewline();
138 public String toString() {
139 return "HRN"+getIDString();
142 // WHY WHY WHY WHY WHY WHY?!
143 public String getDescription() {
144 return new String( description );
145 //return new String( description+" ID "+getIDString() );