]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/QueryDebugImpl.java
Merge changes I8dcfd805,Ide5d53a1 into release/1.35.1
[simantics/platform.git] / bundles / org.simantics.db.procore / src / fi / vtt / simantics / procore / internal / QueryDebugImpl.java
1 package fi.vtt.simantics.procore.internal;
2
3 import java.util.HashSet;
4 import java.util.Set;
5
6 import org.simantics.db.impl.query.CacheEntry;
7 import org.simantics.db.impl.query.CacheEntryBase;
8 import org.simantics.db.impl.service.QueryDebug;
9 import org.simantics.db.request.AsyncMultiRead;
10 import org.simantics.db.request.AsyncRead;
11 import org.simantics.db.request.MultiRead;
12 import org.simantics.db.request.Read;
13
14 public class QueryDebugImpl implements QueryDebug {
15         
16         final private SessionImplSocket session;
17         
18         QueryDebugImpl(SessionImplSocket session) {
19                 this.session = session;
20         }
21
22     @Override
23     public Set<CacheEntry> getParents(AsyncRead<?> request) {
24         HashSet<CacheEntry> result = new HashSet<CacheEntry>();
25         CacheEntryBase entry = session.queryProvider2.asyncReadMap.get(request);
26         if(entry != null) {
27             for(CacheEntry parent : entry.getParents(session.queryProvider2)) result.add(parent);
28         }
29         return result;
30     }
31
32     @Override
33     public Set<CacheEntry> getParents(AsyncMultiRead<?> request) {
34         HashSet<CacheEntry> result = new HashSet<CacheEntry>();
35         CacheEntryBase entry = session.queryProvider2.asyncMultiReadMap.get(request);
36         if(entry != null) {
37             for(CacheEntry parent : entry.getParents(session.queryProvider2)) result.add(parent);
38         }
39         return result;
40     }
41
42     @Override
43     public Set<CacheEntry> getParents(Read<?> request) {
44         HashSet<CacheEntry> result = new HashSet<CacheEntry>();
45         CacheEntryBase entry = session.queryProvider2.readMap.get(request);
46         if(entry != null) {
47             for(CacheEntry parent : entry.getParents(session.queryProvider2)) result.add(parent);
48         }
49         return result;
50     }
51
52     @Override
53     public Set<CacheEntry> getParents(MultiRead<?> request) {
54         HashSet<CacheEntry> result = new HashSet<CacheEntry>();
55         CacheEntryBase entry = session.queryProvider2.multiReadMap.get(request);
56         if(entry != null) {
57             for(CacheEntry parent : entry.getParents(session.queryProvider2)) result.add(parent);
58         }
59         return result;
60     }
61
62 }