]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.graph.compiler/src/org/simantics/graph/compiler/internal/procedures/AddConsistsOf.java
7a2f87a7c35bc5b52e6ca7da53117dfa3e15486a
[simantics/platform.git] / bundles / org.simantics.graph.compiler / src / org / simantics / graph / compiler / internal / procedures / AddConsistsOf.java
1 package org.simantics.graph.compiler.internal.procedures;\r
2 \r
3 import gnu.trove.procedure.TObjectProcedure;\r
4 \r
5 import org.simantics.graph.query.Paths;\r
6 import org.simantics.graph.store.GraphStore;\r
7 import org.simantics.graph.store.IdentityStore;\r
8 import org.simantics.graph.store.IdentityStore.ConsistsOf;\r
9 import org.simantics.graph.store.StatementStore;\r
10 \r
11 public class AddConsistsOf implements Runnable {\r
12 \r
13         GraphStore store;\r
14         Paths paths;\r
15                 \r
16         public AddConsistsOf(Paths paths, GraphStore store) {\r
17             this.paths = paths;\r
18                 this.store = store;\r
19         }\r
20 \r
21         @Override\r
22         public void run() {\r
23                 final IdentityStore identities = store.identities;\r
24                 final int consistsOf = identities.createPathToId(paths.ConsistsOf);\r
25                 final StatementStore statements = store.statements;\r
26                 identities.forEachChild(new TObjectProcedure<IdentityStore.ConsistsOf>() {\r
27             \r
28             @Override\r
29             public boolean execute(ConsistsOf co) {\r
30                 if(identities.isNewResource(co.child))\r
31                     statements.add(co.parent, consistsOf, co.child);\r
32                 return true;\r
33             }\r
34         });\r
35         }       \r
36 \r
37 }\r