1 package Analysis.OwnershipAnalysis;
9 // a token touple is a pair that indicates a
10 // heap region node and an arity
12 // THIS CLASS IS IMMUTABLE!
14 public class TokenTuple
16 private Integer token;
17 private boolean isNewSummary;
19 // only summary tokens should have ARITY_MANY?
20 public static final int ARITY_ONE = 1;
21 public static final int ARITY_MANY = 2;
24 public TokenTuple( HeapRegionNode hrn ) {
26 isNewSummary = hrn.isNewSummary();
30 public TokenTuple( Integer token,
34 this.isNewSummary = isNewSummary;
38 public Integer getToken() { return token; }
39 public int getArity() { return arity; }
41 public TokenTuple increaseArity() {
43 return new TokenTuple( token, isNewSummary, ARITY_MANY );
48 public boolean equals( Object o ) {
49 if( !(o instanceof TokenTuple) ) {
53 TokenTuple tt = (TokenTuple) o;
55 return token.equals( tt.getToken() ) &&
56 arity == tt.getArity();
59 public int hashCode() {
60 return token.intValue();
63 public String toString() {
70 if( arity == ARITY_MANY ) {
74 return new String( "<"+token+s+", "+t+">" );