changes to build script to increase java heap memory
[IRC.git] / Robust / src / Analysis / OwnershipAnalysis / AllocationSite.java
index 469fc425059ff8ff70bc19ab11a2048ddb4b7d9d..c915bbd0d9ac84a276291d30f87fa84166736911 100644 (file)
@@ -29,9 +29,13 @@ public class AllocationSite {
     protected Integer         summary;
     protected TypeDescriptor  type;
 
+    public static final int AGE_notInThisSite = -1;
+    public static final int AGE_oldest        = -2;
+    public static final int AGE_summary       = -3;
+
 
     public AllocationSite( int allocationDepth, TypeDescriptor type ) {
-       assert allocationDepth >= 3;
+       assert allocationDepth >= 1;
 
        this.allocationDepth = allocationDepth; 
        this.type            = type;
@@ -46,6 +50,10 @@ public class AllocationSite {
     }    
 
     
+    public int getAllocationDepth() {
+       return allocationDepth;
+    }
+
     public void setIthOldest( int i, Integer id ) {
        assert i  >= 0;
        assert i  <  allocationDepth;
@@ -78,7 +86,25 @@ public class AllocationSite {
        return type;
     }
 
+    public int getAge( Integer id ) {
+       if( id.equals( summary ) ) {
+           return AGE_summary;
+       }
+       
+       if( id.equals( getOldest() ) ) {
+           return AGE_oldest;
+       }
+
+       for( int i = 0; i < allocationDepth - 1; ++i ) {
+           if( id.equals( ithOldest.get( i ) ) ) {
+               return i;
+           }
+       }
+
+       return AGE_notInThisSite;   
+    }
+
     public String toString() {
-       return "allocSite" + id + "\\n" + type;
+       return "allocSite" + id;
     }
 }