From: Marko Luukkainen Date: Mon, 7 Jan 2019 07:40:42 +0000 (+0000) Subject: Merge "Remove unnecessary getComparableKey from HashMapBinding" X-Git-Tag: v1.43.0~136^2~210 X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=commitdiff_plain;h=1dfc44ff89362fb4500ee9427432541b92d1953f;hp=e5a79f44f9d6ce5f38fb61c5db0d9af0a1db35a9 Merge "Remove unnecessary getComparableKey from HashMapBinding" --- diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/CodeGen.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/CodeGen.java index 2f14b98a5..8661428cb 100644 --- a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/CodeGen.java +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/CodeGen.java @@ -47,6 +47,13 @@ public class CodeGen { line(content, " QueryCache cache = graph.processor.cache;"); if(shortcut) { line(content, " if(parent == null && listener == null && !cache.shouldCache(graph.processor, " + signature[1] + ")) {"); + line(content, " if (SINGLE) {"); + line(content, " " + clazz + " e = cache.peek" + clazz + "(" + signature[1] + ");"); + line(content, " if (e != null && e.isReady()) {"); + line(content, " " + (genReturn ? "return " : "") + "e.performFromCache(graph, procedure);"); + if(!genReturn) line(content, " return;"); + line(content, " }"); + line(content, " }"); line(content, " " + (genReturn ? "return " : "") + clazz + ".computeForEach(graph, " + signature[1] + ", null, procedure);"); if(!genReturn) line(content, " return;"); line(content, " }"); @@ -65,6 +72,14 @@ public class CodeGen { line(content, "}"); line(content, ""); + String lower = Character.toLowerCase(clazz.charAt(0)) + clazz.substring(1); + + line(content, "private " + clazz + " peek" + clazz + "(" + signature[0] + ") {"); + line(content, " synchronized(" + lower +"Map) {"); + line(content, " return (" + clazz + ") " + lower + "Map.get(" + signature[1] + ");"); + line(content, " }"); + line(content, "}"); + line(content, ""); } public void generateRemove(StringBuilder content, String clazz, String[] signature) { @@ -144,6 +159,10 @@ public class CodeGen { content.append("public class QueryCache extends QueryCacheBase {\n"); content.append("\n"); + + line(content, "private static final boolean SINGLE = true;"); + content.append("\n"); + line(content,"public QueryCache(QuerySupport querySupport, int threads) {"); line(content," super(querySupport, threads);"); line(content,"}"); diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/QueryCache.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/QueryCache.java index ee65998d3..48d5646c2 100644 --- a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/QueryCache.java +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/QueryCache.java @@ -19,6 +19,9 @@ import org.simantics.db.request.Read; public class QueryCache extends QueryCacheBase { + // Using QueryChaching breaks Diagram Editor (and probably something else). + private static final boolean SINGLE = false; + public QueryCache(QuerySupport querySupport, int threads) { super(querySupport, threads); } @@ -53,6 +56,13 @@ public class QueryCache extends QueryCacheBase { public static void runnerObjects(ReadGraphImpl graph, int r1, int r2, CacheEntry parent, ListenerBase listener, final IntProcedure procedure) throws DatabaseException { QueryCache cache = graph.processor.cache; if(parent == null && listener == null && !cache.shouldCache(graph.processor, r1,r2)) { + if (SINGLE) { + Objects e = cache.peekObjects(r1,r2); + if (e != null && e.isReady()) { + e.performFromCache(graph, procedure); + return; + } + } Objects.computeForEach(graph, r1,r2, null, procedure); return; } @@ -67,6 +77,12 @@ public class QueryCache extends QueryCacheBase { } } + private Objects peekObjects(int r1, int r2) { + synchronized(objectsMap) { + return (Objects) objectsMap.get(r1,r2); + } + } + Statements getOrCreateStatements(ReadGraphImpl graph, int r1, int r2) throws DatabaseException { Statements existing = null; synchronized(statementsMap) { @@ -97,6 +113,13 @@ public class QueryCache extends QueryCacheBase { public static void runnerStatements(ReadGraphImpl graph, int r1, int r2, CacheEntry parent, ListenerBase listener, final TripleIntProcedure procedure) throws DatabaseException { QueryCache cache = graph.processor.cache; if(parent == null && listener == null && !cache.shouldCache(graph.processor, r1,r2)) { + if (SINGLE) { + Statements e = cache.peekStatements(r1,r2); + if (e != null && e.isReady()) { + e.performFromCache(graph, procedure); + return; + } + } Statements.computeForEach(graph, r1,r2, null, procedure); return; } @@ -111,6 +134,12 @@ public class QueryCache extends QueryCacheBase { } } + private Statements peekStatements(int r1, int r2) { + synchronized(statementsMap) { + return (Statements) statementsMap.get(r1,r2); + } + } + DirectObjects getOrCreateDirectObjects(ReadGraphImpl graph, int r1, int r2) throws DatabaseException { DirectObjects existing = null; synchronized(directObjectsMap) { @@ -141,6 +170,13 @@ public class QueryCache extends QueryCacheBase { public static void runnerDirectObjects(ReadGraphImpl graph, int r1, int r2, CacheEntry parent, ListenerBase listener, final IntProcedure procedure) throws DatabaseException { QueryCache cache = graph.processor.cache; if(parent == null && listener == null && !cache.shouldCache(graph.processor, r1,r2)) { + if (SINGLE) { + DirectObjects e = cache.peekDirectObjects(r1,r2); + if (e != null && e.isReady()) { + e.performFromCache(graph, procedure); + return; + } + } DirectObjects.computeForEach(graph, r1,r2, null, procedure); return; } @@ -155,6 +191,12 @@ public class QueryCache extends QueryCacheBase { } } + private DirectObjects peekDirectObjects(int r1, int r2) { + synchronized(directObjectsMap) { + return (DirectObjects) directObjectsMap.get(r1,r2); + } + } + RelationInfoQuery getOrCreateRelationInfoQuery(ReadGraphImpl graph, int r) throws DatabaseException { RelationInfoQuery existing = null; synchronized(relationInfoQueryMap) { @@ -185,6 +227,13 @@ public class QueryCache extends QueryCacheBase { public static void runnerRelationInfoQuery(ReadGraphImpl graph, int r, CacheEntry parent, ListenerBase listener, final InternalProcedure procedure) throws DatabaseException { QueryCache cache = graph.processor.cache; if(parent == null && listener == null && !cache.shouldCache(graph.processor, r)) { + if (SINGLE) { + RelationInfoQuery e = cache.peekRelationInfoQuery(r); + if (e != null && e.isReady()) { + e.performFromCache(graph, procedure); + return; + } + } RelationInfoQuery.computeForEach(graph, r, null, procedure); return; } @@ -199,6 +248,12 @@ public class QueryCache extends QueryCacheBase { } } + private RelationInfoQuery peekRelationInfoQuery(int r) { + synchronized(relationInfoQueryMap) { + return (RelationInfoQuery) relationInfoQueryMap.get(r); + } + } + URIToResource getOrCreateURIToResource(ReadGraphImpl graph, String id) throws DatabaseException { URIToResource existing = null; synchronized(uRIToResourceMap) { @@ -229,6 +284,13 @@ public class QueryCache extends QueryCacheBase { public static void runnerURIToResource(ReadGraphImpl graph, String id, CacheEntry parent, ListenerBase listener, final InternalProcedure procedure) throws DatabaseException { QueryCache cache = graph.processor.cache; if(parent == null && listener == null && !cache.shouldCache(graph.processor, id)) { + if (SINGLE) { + URIToResource e = cache.peekURIToResource(id); + if (e != null && e.isReady()) { + e.performFromCache(graph, procedure); + return; + } + } URIToResource.computeForEach(graph, id, null, procedure); return; } @@ -243,6 +305,12 @@ public class QueryCache extends QueryCacheBase { } } + private URIToResource peekURIToResource(String id) { + synchronized(uRIToResourceMap) { + return (URIToResource) uRIToResourceMap.get(id); + } + } + ValueQuery getOrCreateValueQuery(ReadGraphImpl graph, int r) throws DatabaseException { ValueQuery existing = null; synchronized(valueQueryMap) { @@ -273,6 +341,13 @@ public class QueryCache extends QueryCacheBase { public static void runnerValueQuery(ReadGraphImpl graph, int r, CacheEntry parent, ListenerBase listener, final InternalProcedure procedure) throws DatabaseException { QueryCache cache = graph.processor.cache; if(parent == null && listener == null && !cache.shouldCache(graph.processor, r)) { + if (SINGLE) { + ValueQuery e = cache.peekValueQuery(r); + if (e != null && e.isReady()) { + e.performFromCache(graph, procedure); + return; + } + } ValueQuery.computeForEach(graph, r, null, procedure); return; } @@ -287,6 +362,12 @@ public class QueryCache extends QueryCacheBase { } } + private ValueQuery peekValueQuery(int r) { + synchronized(valueQueryMap) { + return (ValueQuery) valueQueryMap.get(r); + } + } + OrderedSet getOrCreateOrderedSet(ReadGraphImpl graph, int r) throws DatabaseException { OrderedSet existing = null; synchronized(orderedSetMap) { @@ -317,6 +398,13 @@ public class QueryCache extends QueryCacheBase { public static void runnerOrderedSet(ReadGraphImpl graph, int r, CacheEntry parent, ListenerBase listener, final IntProcedure procedure) throws DatabaseException { QueryCache cache = graph.processor.cache; if(parent == null && listener == null && !cache.shouldCache(graph.processor, r)) { + if (SINGLE) { + OrderedSet e = cache.peekOrderedSet(r); + if (e != null && e.isReady()) { + e.performFromCache(graph, procedure); + return; + } + } OrderedSet.computeForEach(graph, r, null, procedure); return; } @@ -331,6 +419,12 @@ public class QueryCache extends QueryCacheBase { } } + private OrderedSet peekOrderedSet(int r) { + synchronized(orderedSetMap) { + return (OrderedSet) orderedSetMap.get(r); + } + } + PrincipalTypes getOrCreatePrincipalTypes(ReadGraphImpl graph, int r) throws DatabaseException { PrincipalTypes existing = null; synchronized(principalTypesMap) { @@ -361,6 +455,13 @@ public class QueryCache extends QueryCacheBase { public static void runnerPrincipalTypes(ReadGraphImpl graph, int r, CacheEntry parent, ListenerBase listener, final IntProcedure procedure) throws DatabaseException { QueryCache cache = graph.processor.cache; if(parent == null && listener == null && !cache.shouldCache(graph.processor, r)) { + if (SINGLE) { + PrincipalTypes e = cache.peekPrincipalTypes(r); + if (e != null && e.isReady()) { + e.performFromCache(graph, procedure); + return; + } + } PrincipalTypes.computeForEach(graph, r, null, procedure); return; } @@ -375,6 +476,12 @@ public class QueryCache extends QueryCacheBase { } } + private PrincipalTypes peekPrincipalTypes(int r) { + synchronized(principalTypesMap) { + return (PrincipalTypes) principalTypesMap.get(r); + } + } + DirectPredicates getOrCreateDirectPredicates(ReadGraphImpl graph, int r) throws DatabaseException { DirectPredicates existing = null; synchronized(directPredicatesMap) { @@ -405,6 +512,13 @@ public class QueryCache extends QueryCacheBase { public static void runnerDirectPredicates(ReadGraphImpl graph, int r, CacheEntry parent, ListenerBase listener, final InternalProcedure procedure) throws DatabaseException { QueryCache cache = graph.processor.cache; if(parent == null && listener == null && !cache.shouldCache(graph.processor, r)) { + if (SINGLE) { + DirectPredicates e = cache.peekDirectPredicates(r); + if (e != null && e.isReady()) { + e.performFromCache(graph, procedure); + return; + } + } DirectPredicates.computeForEach(graph, r, null, procedure); return; } @@ -419,6 +533,12 @@ public class QueryCache extends QueryCacheBase { } } + private DirectPredicates peekDirectPredicates(int r) { + synchronized(directPredicatesMap) { + return (DirectPredicates) directPredicatesMap.get(r); + } + } + Predicates getOrCreatePredicates(ReadGraphImpl graph, int r) throws DatabaseException { Predicates existing = null; synchronized(predicatesMap) { @@ -449,6 +569,13 @@ public class QueryCache extends QueryCacheBase { public static void runnerPredicates(ReadGraphImpl graph, int r, CacheEntry parent, ListenerBase listener, final InternalProcedure procedure) throws DatabaseException { QueryCache cache = graph.processor.cache; if(parent == null && listener == null && !cache.shouldCache(graph.processor, r)) { + if (SINGLE) { + Predicates e = cache.peekPredicates(r); + if (e != null && e.isReady()) { + e.performFromCache(graph, procedure); + return; + } + } Predicates.computeForEach(graph, r, null, procedure); return; } @@ -463,6 +590,12 @@ public class QueryCache extends QueryCacheBase { } } + private Predicates peekPredicates(int r) { + synchronized(predicatesMap) { + return (Predicates) predicatesMap.get(r); + } + } + ReadEntry getOrCreateReadEntry(ReadGraphImpl graph, Read r, boolean needsToBlock) throws DatabaseException { ReadEntry existing = null; synchronized(readEntryMap) { @@ -486,6 +619,7 @@ public class QueryCache extends QueryCacheBase { } return existing; } + void remove(ReadEntry entry) { synchronized(readEntryMap) { @@ -496,6 +630,12 @@ public class QueryCache extends QueryCacheBase { public static Object runnerReadEntry(ReadGraphImpl graph, Read r, CacheEntry parent, ListenerBase listener, final AsyncProcedure procedure, final boolean needsToBlock) throws DatabaseException { QueryCache cache = graph.processor.cache; if(parent == null && listener == null && !cache.shouldCache(graph.processor, r)) { + if (SINGLE) { + ReadEntry e = cache.peekReadEntry(r); + if (e != null && e.isReady()) { + return e.performFromCache(graph, procedure); + } + } return ReadEntry.computeForEach(graph, r, null, procedure); } ReadEntry entry = (ReadEntry)cache.getOrCreateReadEntry(graph, r, needsToBlock); @@ -522,6 +662,13 @@ public class QueryCache extends QueryCacheBase { return result; } } + + + private ReadEntry peekReadEntry(Read r) { + synchronized(readEntryMap) { + return (ReadEntry) readEntryMap.get(r); + } + } AsyncReadEntry getOrCreateAsyncReadEntry(ReadGraphImpl graph, AsyncRead r, boolean needsToBlock) throws DatabaseException { AsyncReadEntry existing = null; @@ -546,6 +693,7 @@ public class QueryCache extends QueryCacheBase { } return existing; } + void remove(AsyncReadEntry entry) { synchronized(asyncReadEntryMap) { @@ -556,6 +704,12 @@ public class QueryCache extends QueryCacheBase { public static Object runnerAsyncReadEntry(ReadGraphImpl graph, AsyncRead r, CacheEntry parent, ListenerBase listener, final AsyncProcedure procedure, final boolean needsToBlock) throws DatabaseException { QueryCache cache = graph.processor.cache; if(parent == null && listener == null && !cache.shouldCache(graph.processor, r)) { + if (SINGLE) { + AsyncReadEntry e = cache.peekAsyncReadEntry(r); + if (e != null && e.isReady()) { + return e.performFromCache(graph, procedure); + } + } return AsyncReadEntry.computeForEach(graph, r, null, procedure, needsToBlock); } AsyncReadEntry entry = (AsyncReadEntry)cache.getOrCreateAsyncReadEntry(graph, r, needsToBlock); @@ -582,6 +736,13 @@ public class QueryCache extends QueryCacheBase { return result; } } + + + private AsyncReadEntry peekAsyncReadEntry(AsyncRead r) { + synchronized(asyncReadEntryMap) { + return (AsyncReadEntry) asyncReadEntryMap.get(r); + } + } Types getOrCreateTypes(ReadGraphImpl graph, int r) throws DatabaseException { Types existing = null; @@ -613,6 +774,13 @@ public class QueryCache extends QueryCacheBase { public static void runnerTypes(ReadGraphImpl graph, int r, CacheEntry parent, ListenerBase listener, final InternalProcedure procedure) throws DatabaseException { QueryCache cache = graph.processor.cache; if(parent == null && listener == null && !cache.shouldCache(graph.processor, r)) { + if (SINGLE) { + Types e = cache.peekTypes(r); + if (e != null && e.isReady()) { + e.performFromCache(graph, procedure); + return; + } + } Types.computeForEach(graph, r, null, procedure); return; } @@ -627,6 +795,12 @@ public class QueryCache extends QueryCacheBase { } } + private Types peekTypes(int r) { + synchronized(typesMap) { + return (Types) typesMap.get(r); + } + } + ChildMap getOrCreateChildMap(ReadGraphImpl graph, int r) throws DatabaseException { ChildMap existing = null; synchronized(childMapMap) { @@ -657,6 +831,13 @@ public class QueryCache extends QueryCacheBase { public static void runnerChildMap(ReadGraphImpl graph, int r, CacheEntry parent, ListenerBase listener, final InternalProcedure> procedure) throws DatabaseException { QueryCache cache = graph.processor.cache; if(parent == null && listener == null && !cache.shouldCache(graph.processor, r)) { + if (SINGLE) { + ChildMap e = cache.peekChildMap(r); + if (e != null && e.isReady()) { + e.performFromCache(graph, procedure); + return; + } + } ChildMap.computeForEach(graph, r, null, procedure); return; } @@ -671,6 +852,12 @@ public class QueryCache extends QueryCacheBase { } } + private ChildMap peekChildMap(int r) { + synchronized(childMapMap) { + return (ChildMap) childMapMap.get(r); + } + } + TypeHierarchy getOrCreateTypeHierarchy(ReadGraphImpl graph, int r) throws DatabaseException { TypeHierarchy existing = null; synchronized(typeHierarchyMap) { @@ -701,6 +888,13 @@ public class QueryCache extends QueryCacheBase { public static void runnerTypeHierarchy(ReadGraphImpl graph, int r, CacheEntry parent, ListenerBase listener, final InternalProcedure procedure) throws DatabaseException { QueryCache cache = graph.processor.cache; if(parent == null && listener == null && !cache.shouldCache(graph.processor, r)) { + if (SINGLE) { + TypeHierarchy e = cache.peekTypeHierarchy(r); + if (e != null && e.isReady()) { + e.performFromCache(graph, procedure); + return; + } + } TypeHierarchy.computeForEach(graph, r, null, procedure); return; } @@ -715,6 +909,12 @@ public class QueryCache extends QueryCacheBase { } } + private TypeHierarchy peekTypeHierarchy(int r) { + synchronized(typeHierarchyMap) { + return (TypeHierarchy) typeHierarchyMap.get(r); + } + } + SuperTypes getOrCreateSuperTypes(ReadGraphImpl graph, int r) throws DatabaseException { SuperTypes existing = null; synchronized(superTypesMap) { @@ -745,6 +945,13 @@ public class QueryCache extends QueryCacheBase { public static void runnerSuperTypes(ReadGraphImpl graph, int r, CacheEntry parent, ListenerBase listener, final InternalProcedure procedure) throws DatabaseException { QueryCache cache = graph.processor.cache; if(parent == null && listener == null && !cache.shouldCache(graph.processor, r)) { + if (SINGLE) { + SuperTypes e = cache.peekSuperTypes(r); + if (e != null && e.isReady()) { + e.performFromCache(graph, procedure); + return; + } + } SuperTypes.computeForEach(graph, r, null, procedure); return; } @@ -759,6 +966,12 @@ public class QueryCache extends QueryCacheBase { } } + private SuperTypes peekSuperTypes(int r) { + synchronized(superTypesMap) { + return (SuperTypes) superTypesMap.get(r); + } + } + SuperRelations getOrCreateSuperRelations(ReadGraphImpl graph, int r) throws DatabaseException { SuperRelations existing = null; synchronized(superRelationsMap) { @@ -789,6 +1002,13 @@ public class QueryCache extends QueryCacheBase { public static void runnerSuperRelations(ReadGraphImpl graph, int r, CacheEntry parent, ListenerBase listener, final InternalProcedure procedure) throws DatabaseException { QueryCache cache = graph.processor.cache; if(parent == null && listener == null && !cache.shouldCache(graph.processor, r)) { + if (SINGLE) { + SuperRelations e = cache.peekSuperRelations(r); + if (e != null && e.isReady()) { + e.performFromCache(graph, procedure); + return; + } + } SuperRelations.computeForEach(graph, r, null, procedure); return; } @@ -803,6 +1023,12 @@ public class QueryCache extends QueryCacheBase { } } + private SuperRelations peekSuperRelations(int r) { + synchronized(superRelationsMap) { + return (SuperRelations) superRelationsMap.get(r); + } + } + AssertedPredicates getOrCreateAssertedPredicates(ReadGraphImpl graph, int r) throws DatabaseException { AssertedPredicates existing = null; synchronized(assertedPredicatesMap) { @@ -843,6 +1069,12 @@ public class QueryCache extends QueryCacheBase { } } + private AssertedPredicates peekAssertedPredicates(int r) { + synchronized(assertedPredicatesMap) { + return (AssertedPredicates) assertedPredicatesMap.get(r); + } + } + AssertedStatements getOrCreateAssertedStatements(ReadGraphImpl graph, int r1, int r2) throws DatabaseException { AssertedStatements existing = null; synchronized(assertedStatementsMap) { @@ -883,6 +1115,12 @@ public class QueryCache extends QueryCacheBase { } } + private AssertedStatements peekAssertedStatements(int r1, int r2) { + synchronized(assertedStatementsMap) { + return (AssertedStatements) assertedStatementsMap.get(r1,r2); + } + } + DirectSuperRelations getOrCreateDirectSuperRelations(ReadGraphImpl graph, int r) throws DatabaseException { DirectSuperRelations existing = null; synchronized(directSuperRelationsMap) { @@ -923,6 +1161,12 @@ public class QueryCache extends QueryCacheBase { } } + private DirectSuperRelations peekDirectSuperRelations(int r) { + synchronized(directSuperRelationsMap) { + return (DirectSuperRelations) directSuperRelationsMap.get(r); + } + } + MultiReadEntry getOrCreateMultiReadEntry(ReadGraphImpl graph, MultiRead r) throws DatabaseException { MultiReadEntry existing = null; synchronized(multiReadEntryMap) { @@ -963,6 +1207,12 @@ public class QueryCache extends QueryCacheBase { } } + private MultiReadEntry peekMultiReadEntry(MultiRead r) { + synchronized(multiReadEntryMap) { + return (MultiReadEntry) multiReadEntryMap.get(r); + } + } + AsyncMultiReadEntry getOrCreateAsyncMultiReadEntry(ReadGraphImpl graph, AsyncMultiRead r) throws DatabaseException { AsyncMultiReadEntry existing = null; synchronized(asyncMultiReadEntryMap) { @@ -1003,6 +1253,12 @@ public class QueryCache extends QueryCacheBase { } } + private AsyncMultiReadEntry peekAsyncMultiReadEntry(AsyncMultiRead r) { + synchronized(asyncMultiReadEntryMap) { + return (AsyncMultiReadEntry) asyncMultiReadEntryMap.get(r); + } + } + ExternalReadEntry getOrCreateExternalReadEntry(ReadGraphImpl graph, ExternalRead r) throws DatabaseException { ExternalReadEntry existing = null; synchronized(externalReadEntryMap) { @@ -1023,6 +1279,7 @@ public class QueryCache extends QueryCacheBase { if(existing.isPending()) waitPending(graph, existing); return existing; } + void remove(ExternalReadEntry entry) { synchronized(externalReadEntryMap) { @@ -1043,4 +1300,10 @@ public class QueryCache extends QueryCacheBase { } } + private ExternalReadEntry peekExternalReadEntry(ExternalRead r) { + synchronized(externalReadEntryMap) { + return (ExternalReadEntry) externalReadEntryMap.get(r); + } + } + } diff --git a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/function/All.java b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/function/All.java index f93023b77..4e775e08a 100644 --- a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/function/All.java +++ b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/function/All.java @@ -570,9 +570,9 @@ public class All { // Process graph properties for(Resource predicate : predicates) { - PropertyInfo info = graph.isImmutable(predicate) ? - graph.syncRequest(new PropertyInfoRequest(predicate), TransientCacheAsyncListener.instance()) : - graph.syncRequest(new PropertyInfoRequest(predicate)); + PropertyInfo info = //graph.isImmutable(predicate) ? + graph.syncRequest(new PropertyInfoRequest(predicate), TransientCacheAsyncListener.instance());// : + //graph.syncRequest(new PropertyInfoRequest(predicate)); if(!info.isHasProperty) continue; @@ -992,7 +992,7 @@ public class All { public static PropertyInfo getPossiblePropertyInfoFromContext(ReadGraph graph, Variable variable, Resource context, String name) throws DatabaseException { if(context == null) return null; - Map predicates = graph.syncRequest(new UnescapedPropertyMapOfResource(context)); + Map predicates = graph.syncRequest(new UnescapedPropertyMapOfResource(context), TransientCacheListener.instance()); return predicates.get(name); } diff --git a/bundles/org.simantics.export.core/src/org/simantics/export/core/pdf/ImportPdfReader.java b/bundles/org.simantics.export.core/src/org/simantics/export/core/pdf/ImportPdfReader.java index 21c0c8e4d..51bec046b 100644 --- a/bundles/org.simantics.export.core/src/org/simantics/export/core/pdf/ImportPdfReader.java +++ b/bundles/org.simantics.export.core/src/org/simantics/export/core/pdf/ImportPdfReader.java @@ -1,5 +1,6 @@ package org.simantics.export.core.pdf; +import java.io.Closeable; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; @@ -13,7 +14,7 @@ import com.lowagie.text.pdf.PdfName; import com.lowagie.text.pdf.PdfReader; import com.lowagie.text.pdf.PdfString; -public class ImportPdfReader { +public class ImportPdfReader implements Closeable { /** File if opened from file */ public File file; @@ -68,7 +69,7 @@ public class ImportPdfReader { return result; } - public void close() { + public synchronized void close() { if ( reader!=null ) { reader.close(); reader = null; diff --git a/bundles/org.simantics.scl.db/scl/Simantics/DB.md b/bundles/org.simantics.scl.db/scl/Simantics/DB.md index e9aadef96..81ee3b6d8 100644 --- a/bundles/org.simantics.scl.db/scl/Simantics/DB.md +++ b/bundles/org.simantics.scl.db/scl/Simantics/DB.md @@ -64,7 +64,8 @@ ## Ordered sets -::value[addToOrderedSet] +::value[addToOrderedSet,addFirstToOrderedSet,addAfterToOrderedSet,addBeforeToOrderedSet] +::value[removeFromOrderedSet] ::value[setOrderedSet] ::value[elementsOfOrderedSet] ::value[parentOrderedSet] diff --git a/bundles/org.simantics.scl.db/scl/Simantics/DB.scl b/bundles/org.simantics.scl.db/scl/Simantics/DB.scl index 2ff2f51ac..adc72bb94 100644 --- a/bundles/org.simantics.scl.db/scl/Simantics/DB.scl +++ b/bundles/org.simantics.scl.db/scl/Simantics/DB.scl @@ -275,9 +275,26 @@ resourceChildrenOf :: Resource -> [Resource] resourceChildrenOf r = r # L0.ConsistsOf importJava "org.simantics.db.common.utils.OrderedSetUtils" where + "`addToOrderedSet s e` adds element `e` to ordered set `s`" @JavaName add addToOrderedSet :: Resource -> Resource -> Boolean + "`addFirstToOrderedSet s e` adds element `e` to ordered set `s` as the first element" + @JavaName addFirst + addFirstToOrderedSet :: Resource -> Resource -> Boolean + + "`addAfterToOrderedSet s p e` adds element `e` to ordered set `s` after element `p`" + @JavaName addAfter + addAfterToOrderedSet :: Resource -> Resource -> Resource -> Boolean + + "`addBeforeToOrderedSet s p e` adds element `e` to ordered set `s` before element `p`" + @JavaName addBefore + addBeforeToOrderedSet :: Resource -> Resource -> Resource -> Boolean + + "`removeFromOrderedSet s e` removes element `e` from ordered set `s`" + @JavaName remove + removeFromOrderedSet :: Resource -> Resource -> Boolean + @JavaName set setOrderedSet :: Resource -> [Resource] -> Boolean diff --git a/bundles/org.simantics.structural2/src/org/simantics/structural2/scl/CompileProceduralExpressionValueRequest.java b/bundles/org.simantics.structural2/src/org/simantics/structural2/scl/CompileProceduralExpressionValueRequest.java index b402520d7..27e4a6f3b 100644 --- a/bundles/org.simantics.structural2/src/org/simantics/structural2/scl/CompileProceduralExpressionValueRequest.java +++ b/bundles/org.simantics.structural2/src/org/simantics/structural2/scl/CompileProceduralExpressionValueRequest.java @@ -63,6 +63,7 @@ public class CompileProceduralExpressionValueRequest extends AbstractCompileStru public int hashCode() { final int prime = 31; int result = 1; + result = prime * result + ((relation == null) ? 0 : relation.hashCode()); result = prime * result + ((componentType == null) ? 0 : componentType.hashCode()); result = prime * result + ((expression == null) ? 0 : expression.hashCode()); result = prime * result + ((indexRoot == null) ? 0 : indexRoot.hashCode()); @@ -78,6 +79,11 @@ public class CompileProceduralExpressionValueRequest extends AbstractCompileStru if (getClass() != obj.getClass()) return false; CompileProceduralExpressionValueRequest other = (CompileProceduralExpressionValueRequest) obj; + if (relation == null) { + if (other.relation != null) + return false; + } else if (!relation.equals(other.relation)) + return false; if (componentType == null) { if (other.componentType != null) return false; diff --git a/bundles/org.simantics.structural2/src/org/simantics/structural2/scl/CompileStructuralValueRequest.java b/bundles/org.simantics.structural2/src/org/simantics/structural2/scl/CompileStructuralValueRequest.java index 7a8eb715f..6e9975b68 100644 --- a/bundles/org.simantics.structural2/src/org/simantics/structural2/scl/CompileStructuralValueRequest.java +++ b/bundles/org.simantics.structural2/src/org/simantics/structural2/scl/CompileStructuralValueRequest.java @@ -77,6 +77,7 @@ public class CompileStructuralValueRequest extends AbstractCompileStructuralValu public int hashCode() { final int prime = 31; int result = 1; + result = prime * result + ((relation == null) ? 0 : relation.hashCode()); result = prime * result + ((component == null) ? 0 : component.hashCode()); result = prime * result + ((literal == null) ? 0 : literal.hashCode()); return result; @@ -91,6 +92,11 @@ public class CompileStructuralValueRequest extends AbstractCompileStructuralValu if (getClass() != obj.getClass()) return false; CompileStructuralValueRequest other = (CompileStructuralValueRequest) obj; + if (relation == null) { + if (other.relation != null) + return false; + } else if (!relation.equals(other.relation)) + return false; if (component == null) { if (other.component != null) return false; diff --git a/releng/doc/release-helper.sh b/releng/doc/release-helper.sh index 6e56cb55e..7875b863c 100755 --- a/releng/doc/release-helper.sh +++ b/releng/doc/release-helper.sh @@ -385,7 +385,9 @@ case "$action" in branch-release) fromBranch=$1 popd > /dev/null - bash $selfpath $version $fromBranch $user checkout + if [ -ne $fromBranch ]; then + bash $selfpath $version $fromBranch $user checkout + fi bash $selfpath $version $branch $user branch bash $selfpath $version $branch $user checkout bash $selfpath $version $branch $user prepare-release-branch $fromBranch