package heap;
class Aliasing{
int n;
public static int m(Aliasing i,Aliasing p){
i.n = i.n + 1;
if (i.n > 10) p = i;
p.n = p.n + 5;
if (i.n < 16) return -1;
else return 1;
}
public static int m2(Aliasing o1, Aliasing o2){
if (o1 == o2) return 1;
else return 0;
}
public static int m3(Aliasing a, Aliasing b){
if (b.n > 0){
a.n = a.n - 1;
if (b.n <= 0) return 1; // Only here if a and b alias and a.n = 1
else return 0;
}
else return -1;
}
public static void m4(A a,A b){
if (a.f < 0) b.f = 0;
if (a.f == 0) b.f = -1;
}
public boolean equals(Object obj){
if (obj instanceof Aliasing){
Aliasing al= (Aliasing) obj;
return this.n==al.n;
}
return false;
}
}
class A {
int f;
public boolean equals(Object obj){
if (obj instanceof A){
A al= (A) obj;
return this.f==al.f;
}
return false;
}
}
class B extends A {
}
|