import java.util.ArrayList;
import java.util.Iterator;
+import org.simantics.databoard.Bindings;
+import org.simantics.db.DevelopmentKeys;
import org.simantics.db.exception.DatabaseException;
-import org.simantics.db.impl.DebugPolicy;
import org.simantics.db.impl.graph.ReadGraphImpl;
import org.simantics.db.impl.procedure.InternalProcedure;
+import org.simantics.utils.Development;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
final public static CacheEntryBase[] NONE = new CacheEntryBase[0];
- static Object NO_RESULT = new Object();
- static protected Object INVALID_RESULT = new Object();
+ static Object NO_RESULT = new Object() { public String toString() { return "NO_RESULT"; }};
+ static protected Object INVALID_RESULT = new Object() { public String toString() { return "INVALID_RESULT"; }};
// // Just created
// static protected Object FRESH = new Object() { public String toString() { return "CREATED"; }};
}
public void setReady() {
+ assert(result != NO_RESULT);
statusOrException = READY;
}
@Override
public void discard() {
- if(DebugPolicy.QUERY_STATE) System.out.println("[QUERY STATE]: discarded " + this);
+ if (Development.DEVELOPMENT) {
+ if(Development.<Boolean>getProperty(DevelopmentKeys.CACHE_ENTRY_STATE, Bindings.BOOLEAN)) {
+ System.err.println("[QUERY STATE]: discarded " + this);
+ }
+ }
statusOrException = DISCARDED;
}
@Override
final public void refute() {
- if(DebugPolicy.QUERY_STATE) System.out.println("[QUERY STATE]: refuted " + this);
+ if (Development.DEVELOPMENT) {
+ if(Development.<Boolean>getProperty(DevelopmentKeys.CACHE_ENTRY_STATE, Bindings.BOOLEAN)) {
+ System.err.println("[QUERY STATE]: refuted " + this);
+ }
+ }
statusOrException = REQUIRES_COMPUTATION;
}
@Override
public void except(Throwable throwable) {
- if(DebugPolicy.QUERY_STATE) System.out.println("[QUERY STATE]: excepted " + this);
+ if (Development.DEVELOPMENT) {
+ if(Development.<Boolean>getProperty(DevelopmentKeys.CACHE_ENTRY_STATE, Bindings.BOOLEAN)) {
+ System.err.println("[QUERY STATE]: excepted " + this);
+ }
+ }
if(statusOrException != DISCARDED) {
statusOrException = EXCEPTED;
result = throwable;