1 package Analysis.OwnershipAnalysis;
7 public class HeapRegionNode extends OwnershipNode {
9 public HeapRegionNode( Integer id,
10 boolean isSingleObject,
12 boolean isNewSummary ) {
14 this.isSingleObject = isSingleObject;
15 this.isFlagged = isFlagged;
16 this.isNewSummary = isNewSummary;
18 referencers = new HashSet<OwnershipNode>();
19 //analysisRegionAliases = new HashSet<TempDescriptor>();
20 memberFields = new HashSet<TempDescriptor>();
23 public HeapRegionNode copy() {
24 return new HeapRegionNode( id,
36 public Integer getID() {
40 public boolean equals( HeapRegionNode hrn ) {
43 return id.equals( hrn.getID() ) &&
44 isSingleObject == hrn.isSingleObject() &&
45 isFlagged == hrn.isFlagged() &&
46 isNewSummary == hrn.isNewSummary();
57 boolean isSingleObject;
58 public boolean isSingleObject() {
59 return isSingleObject;
63 public boolean isFlagged() {
68 public boolean isNewSummary() {
77 ///////////////////////////////////////////
78 // interface with larger graph
79 ///////////////////////////////////////////
80 protected HashSet<TempDescriptor> memberFields;
81 protected HashSet<OwnershipNode> referencers;
83 public Iterator iteratorToReferencers() {
84 return referencers.iterator();
87 public Iterator iteratorToReferencersClone() {
88 HashSet hs = (HashSet) referencers.clone();
92 public void addReferencer( OwnershipNode on ) {
95 referencers.add( on );
98 public void removeReferencer( OwnershipNode on ) {
100 assert referencers.contains( on );
102 referencers.remove( on );
105 public boolean isReferencedBy( OwnershipNode on ) {
107 return referencers.contains( on );
109 ///////////////////////////////////////////////
110 // end interface with larger graph
111 ///////////////////////////////////////////////
116 ///////////////////////////////////////////////
117 // analysis interface
118 ///////////////////////////////////////////////
120 protected HashSet<TempDescriptor> analysisRegionAliases;
122 public void addAnalysisRegionAlias( TempDescriptor td ) {
124 assert !analysisRegionAliases.contains( td );
126 analysisRegionAliases.add( td );
129 public Iterator iteratorToAnalysisRegionAliases() {
130 return analysisRegionAliases.iterator();
133 ///////////////////////////////////////////////
134 // end analysis interface
135 ///////////////////////////////////////////////
139 public String getIDString() {
140 return id.toString();
143 public String toString() {
144 return "HRN"+getIDString();