A v; // you can access this directly if you use one thread
public synchronized void set(A a) {
if (v != a) {
v = a;
notifyAll();
}
}
public synchronized A get() { ret v; }
public synchronized bool has() { ret v != null; }
public void clear() { set(null); }
public synchronized A getAndSet(A a) {
var value = v;
set(a);
ret value;
}
public IF0 getter() { ret l0 get; }
public IVF1 setter() { ret l1 set; }