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 String description;
24 public HeapRegionNode( Integer id,
25 boolean isSingleObject,
28 AllocationSite allocSite,
29 String description ) {
31 this.isSingleObject = isSingleObject;
32 this.isFlagged = isFlagged;
33 this.isNewSummary = isNewSummary;
34 this.allocSite = allocSite;
35 this.description = description;
37 referencers = new HashSet<OwnershipNode>();
38 memberFields = new HashSet<TempDescriptor>();
41 public HeapRegionNode copy() {
42 return new HeapRegionNode( id,
51 public Integer getID() {
55 public boolean equals( HeapRegionNode hrn ) {
58 return id.equals( hrn.getID() ) &&
59 isSingleObject == hrn.isSingleObject() &&
60 isFlagged == hrn.isFlagged() &&
61 isNewSummary == hrn.isNewSummary() &&
62 description.equals( hrn.getDescription() );
67 public boolean isSingleObject() {
68 return isSingleObject;
71 public boolean isFlagged() {
75 public boolean isNewSummary() {
81 public Iterator iteratorToReferencers() {
82 return referencers.iterator();
85 public Iterator iteratorToReferencersClone() {
86 HashSet hs = (HashSet) referencers.clone();
90 public void addReferencer( OwnershipNode on ) {
93 referencers.add( on );
96 public void removeReferencer( OwnershipNode on ) {
98 assert referencers.contains( on );
100 referencers.remove( on );
103 public boolean isReferencedBy( OwnershipNode on ) {
105 return referencers.contains( on );
109 public AllocationSite getAllocationSite() {
113 public String getIDString() {
114 return id.toString();
117 public String toString() {
118 return "HRN"+getIDString();
121 // WHY WHY WHY WHY WHY WHY?!
122 public String getDescription() {
123 return new String( description );
124 //return new String( description+" ID "+getIDString() );