X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.db.impl%2Fsrc%2Forg%2Fsimantics%2Fdb%2Fimpl%2Fquery%2FDirectPredicates.java;h=bb2e1530e224f3b00626cfdea188b97b591beb64;hb=de8b6e194da6d56c410101d9c72763078b0e8717;hp=63c54effe47f2e405320abe19e7a431af686bc70;hpb=880a8a4927805afbbf47005a807cef3f39406866;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/DirectPredicates.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/DirectPredicates.java index 63c54effe..bb2e1530e 100644 --- a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/DirectPredicates.java +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/DirectPredicates.java @@ -16,30 +16,26 @@ import org.simantics.db.exception.DatabaseException; import org.simantics.db.impl.graph.ReadGraphImpl; import org.simantics.db.impl.procedure.InternalProcedure; -final public class DirectPredicates extends CollectionUnaryQuery> { +final public class DirectPredicates extends UnaryQueryP { DirectPredicates(final int resource) { super(resource); } - @Override - public void clearResult(QuerySupport support) { - // The cached result is never used - setResult(INVALID_RESULT); - } - @Override final public void removeEntry(QueryProcessor provider) { provider.cache.remove(this); } - //@Override - public Object compute(ReadGraphImpl graph, InternalProcedure procedure) throws DatabaseException { - return computeForEach(graph, id, this, procedure); + @Override + public void compute(ReadGraphImpl graph, InternalProcedure procedure) throws DatabaseException { + computeForEach(graph, id, this, procedure); } - public static Object computeForEach(ReadGraphImpl graph, int id, final DirectPredicates entry, final InternalProcedure procedure) throws DatabaseException { + public static Object computeForEach(ReadGraphImpl graph, int id, final DirectPredicates entry, final InternalProcedure procedure_) throws DatabaseException { + InternalProcedure procedure = entry != null ? entry : procedure_; + graph.processor.querySupport.ensureLoaded(graph, id); final IntSet list = new IntSet(graph.processor.querySupport); @@ -61,13 +57,10 @@ final public class DirectPredicates extends CollectionUnaryQuery procedure) throws DatabaseException { - - assert(isReady()); - - if(handleException(graph, procedure)) return EXCEPTED; - - IntSet result = getResult(); - - procedure.execute(graph, result); - - return result; - - } - - @Override - public void recompute(ReadGraphImpl graph) throws DatabaseException { - - compute(graph, new InternalProcedure() { - - @Override - public void execute(ReadGraphImpl graph, IntSet set) { - } - - @Override - public void exception(ReadGraphImpl graph, Throwable t) { - new Error("Error in recompute.", t).printStackTrace(); - } - - }); - - } - - - @Override - boolean isImmutable(ReadGraphImpl graph) { - return graph.processor.isImmutable(id); - } - }