-
- final static URIToResource entry(final QueryProcessor provider, final String id) {
- return (URIToResource)provider.uriToResourceMap.get(id);
- }
-
- final static void runner(ReadGraphImpl graph, final String id, CacheEntry parent, final ListenerBase listener, final InternalProcedure<Integer> procedure) {
-
- QueryProcessor processor = graph.processor;
-
- URIToResource entry = (URIToResource)processor.uriToResourceMap.get(id);
- if(entry == null) {
-
- entry = new URIToResource(id);
- entry.setPending();
- entry.clearResult(processor.querySupport);
- entry.putEntry(processor);
-
- processor.performForEach(graph, entry, parent, listener, procedure);
-
- } else {
-
- if(entry.isPending()) {
- synchronized(entry) {
- if(entry.isPending()) {
- throw new IllegalStateException();
-// if(entry.procs == null) entry.procs = new ArrayList<InternalProcedure<Integer>>();
-// entry.procs.add(procedure);
-// processor.registerDependencies(graph, entry, parent, listener, procedure, false);
-// return;
- }
- }
- }
-
- processor.performForEach(graph, entry, parent, listener, procedure);
-
- }
-
- }
-
- final public static void queryEach(ReadGraphImpl graph, final String id, final CacheEntry parent, final ListenerBase listener, final InternalProcedure<Integer> procedure) {
-
- assert(id != null);
-
- if(graph.parent == null && listener == null) {
- URIToResource.computeForEach(graph, id, null, procedure);
- } else {
- runner(graph, id, parent, listener, procedure);
- }
-
- }
-
- @Override
- public URIToResource getEntry(QueryProcessor provider) {
- return provider.uriToResourceMap.get(id);
- }
-
- @Override
- public void putEntry(QueryProcessor provider) {
- provider.uriToResourceMap.put(id, this);
- }