-final public class Predicates extends UnaryQuery<IntProcedure> {
-
-// public ArrayList<IntProcedure> procs;
-
- public Predicates(final int r) {
- super(r);
- }
-
- public static Predicates newInstance(final int r) {
- return new Predicates(r);
- }
-
- final static Predicates entry(final QueryProcessor provider, final int r) {
-
- return (Predicates)provider.predicatesMap.get(r);
-
- }
-
- final static void runner(ReadGraphImpl graph, final int r, final QueryProcessor provider, Predicates cached, final CacheEntry parent, final ListenerBase listener, final IntProcedure procedure) {
-
- Predicates entry = cached != null ? cached : (Predicates)provider.predicatesMap.get(r);
- if(entry == null) {
-
- entry = new Predicates(r);
- entry.setPending();
- entry.clearResult(provider.querySupport);
- entry.putEntry(provider);
-
- provider.performForEach(graph, entry, parent, listener, procedure);
-
- } else {
-
- if(entry.isPending()) {
- synchronized(entry) {
- if(entry.isPending()) {
- throw new IllegalStateException();
- }
- }
- }
- provider.performForEach(graph, entry, parent, listener, procedure);
- }
-
- }
-
- final static IntSet runner2(ReadGraphImpl graph, final int r, final QueryProcessor provider, final CacheEntry parent) throws Throwable {
-
- Predicates entry = (Predicates)provider.predicatesMap.get(r);
- if(entry == null) {
-
- entry = new Predicates(r);
- entry.setPending();
- entry.clearResult(provider.querySupport);
- entry.putEntry(provider);
-
- return (IntSet)provider.performForEach2(graph, entry, parent, null, null);
-
- } else {
-
- if(entry.isPending()) {
- synchronized(entry) {
- if(entry.isPending()) {
- throw new IllegalStateException();
- }
- }
- }
- return (IntSet)provider.performForEach(graph, entry, parent, null, null);
-
- }
-
- }
-
- final public static void queryEach(ReadGraphImpl graph, final int r, final QueryProcessor provider, final CacheEntry parent, final ListenerBase listener, final IntProcedure procedure) {
-
- assert(r != 0);
-
- final Predicates entry = (Predicates)provider.predicatesMap.get(r);
-
- if(parent == null && listener == null) {
- if(entry != null && entry.isReady()) {
- entry.performFromCache(graph, provider, procedure);
- return;
- }
- }
-
- runner(graph, r, provider, entry, parent, listener, procedure);
-
- }