net.fornwall.jelf.MemoizedObject Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of unidbg Show documentation
Show all versions of unidbg Show documentation
Allows you to emulate an Android ARM32 and/or ARM64 native library
package net.fornwall.jelf;
import java.io.IOException;
/**
* A memoized object. Override {@link #computeValue} in subclasses; call {@link #getValue} in using code.
*/
public abstract class MemoizedObject {
private boolean computed;
private T value;
/**
* Should compute the value of this memoized object. This will only be called once, upon the first call to
* {@link #getValue}.
*/
protected abstract T computeValue() throws ElfException, IOException;
/** Public accessor for the memoized value. */
public final T getValue() throws ElfException, IOException {
if (!computed) {
value = computeValue();
computed = true;
}
return value;
}
@SuppressWarnings("unchecked")
public static MemoizedObject[] uncheckedArray(int size) {
return new MemoizedObject[size];
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy