GP-3970 program caching and refactoring of ProgramManager and OpenProgramTask

This commit is contained in:
ghidragon 2023-11-27 11:47:18 -05:00
parent 5d487a6518
commit 7d67188d0b
34 changed files with 2198 additions and 948 deletions

View file

@ -42,6 +42,16 @@ public class Dummy {
};
}
/**
* Creates a dummy consumer
* @return a dummy consumer
*/
public static <T, U> BiConsumer<T, U> biConsumer() {
return (t, u) -> {
// no-op
};
}
/**
* Creates a dummy function
* @param <T> the input type
@ -82,6 +92,17 @@ public class Dummy {
return c == null ? consumer() : c;
}
/**
* Returns the given consumer object if it is not {@code null}. Otherwise, a
* {@link #biConsumer()} is returned. This is useful to avoid using {@code null}.
*
* @param c the consumer function to check for {@code null}
* @return a non-null consumer
*/
public static <T, U> BiConsumer<T, U> ifNull(BiConsumer<T, U> c) {
return c == null ? biConsumer() : c;
}
/**
* Returns the given callback object if it is not {@code null}. Otherwise, a {@link #callback()}
* is returned. This is useful to avoid using {@code null}.