net.quasardb.qdb.jni.Reference Maven / Gradle / Ivy
package net.quasardb.qdb.jni;
public final class Reference {
public T value;
public void clear() {
this.value = null;
}
public T get() {
assert(this.isEmpty() == false);
return this.value;
}
public static Reference of(T value) {
Reference tmp = new Reference();
tmp.value = value;
return tmp;
}
/**
* Clears reference and returns last known value.
*/
public T pop() {
T tmp = this.get();
this.clear();
assert(this.isEmpty() == true);
return tmp;
}
public void set(T value) {
this.value = value;
}
public boolean isEmpty() {
return this.value == null;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy