X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.db.impl%2Fsrc%2Forg%2Fsimantics%2Fdb%2Fimpl%2Fquery%2FCacheEntry.java;fp=bundles%2Forg.simantics.db.impl%2Fsrc%2Forg%2Fsimantics%2Fdb%2Fimpl%2Fquery%2FCacheEntry.java;h=cb80a6e641cecd3b5e3e1bc14e8c2fe793c36d12;hp=0000000000000000000000000000000000000000;hb=969bd23cab98a79ca9101af33334000879fb60c5;hpb=866dba5cd5a3929bbeae85991796acb212338a08 diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/CacheEntry.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/CacheEntry.java new file mode 100644 index 000000000..cb80a6e64 --- /dev/null +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/CacheEntry.java @@ -0,0 +1,66 @@ +/******************************************************************************* + * Copyright (c) 2007, 2010 Association for Decentralized Information Management + * in Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.db.impl.query; + +import org.simantics.db.exception.DatabaseException; +import org.simantics.db.impl.graph.ReadGraphImpl; + + + +public abstract class CacheEntry { + + final public static int HAS_BEEN_BOUND = 1; + + abstract boolean isFresh(); + abstract boolean isReady(); + abstract boolean isRefuted(); + abstract boolean isPending(); + abstract boolean isDiscarded(); + abstract boolean isExcepted(); + + abstract void setReady(); + abstract void refute(); + abstract void setPending(); + abstract void discard(); + abstract void except(Throwable t); + abstract void setResult(Object result); + abstract void clearResult(QuerySupport support); + + abstract void prepareRecompute(QuerySupport querySupport); + + abstract public Object getOriginalRequest(); + abstract Query getQuery(); + abstract T getResult(); + + abstract CacheEntry pruneFirstParents(); + abstract void removeParent(CacheEntry entry); + abstract void addParent(CacheEntry entry); + abstract boolean hasParents(); + abstract Iterable getParents(QueryProcessor processor); + abstract CacheEntry getFirstParent(QueryProcessor processor); + abstract boolean moreThanOneParent(QueryProcessor processor); + abstract int parentCount(QueryProcessor processor); + + abstract void performFromCache(ReadGraphImpl graph, Object provider, Object procedure); + + abstract boolean isImmutable(ReadGraphImpl graph) throws DatabaseException; + + abstract boolean shouldBeCollected(); + + abstract short getLevel(); + abstract short setLevel(short level); + + abstract int getGCStatus(); + abstract int setGCStatus(int status); + abstract void setGCStatusFlag(int flag, boolean value); + +}