1 package org.simantics.graph.compiler.internal.procedures;
\r
3 import gnu.trove.procedure.TIntObjectProcedure;
\r
4 import gnu.trove.set.hash.TIntHashSet;
\r
6 import org.simantics.graph.compiler.internal.store.IPreValue;
\r
7 import org.simantics.graph.compiler.internal.store.PreValueStore;
\r
8 import org.simantics.graph.query.Path;
\r
9 import org.simantics.graph.query.Paths;
\r
10 import org.simantics.graph.store.GraphStore;
\r
12 public class DefaultValueTyping implements Runnable {
\r
17 public DefaultValueTyping(Paths paths, GraphStore store) {
\r
24 final int instanceOfId = store.identities.createPathToId(paths.InstanceOf);
\r
26 instanceOfDomain = store.statements.getRelationDomain(instanceOfId);
\r
27 PreValueStore preValues = store.getStore(PreValueStore.class);
\r
28 preValues.forEachPreValue(new TIntObjectProcedure<IPreValue>() {
\r
30 public boolean execute(int a, IPreValue b) {
\r
31 if(!instanceOfDomain.contains(a)) {
\r
32 Path defaultType = b.getDefaultType(paths);
\r
33 if(defaultType != null)
\r
34 store.statements.add(a,
\r
36 store.identities.createPathToId(defaultType)
\r