1 package org.simantics.graph.compiler.internal.procedures;
3 import org.simantics.graph.store.GraphStore;
4 import org.simantics.graph.store.IdentityStore;
6 public class PropagateNewMarks implements Runnable {
7 IdentityStore identities;
9 public PropagateNewMarks(GraphStore store) {
10 this.identities = store.identities;
13 private void propagateNewMarks(int resource) {
14 for(int child : identities.getChildren(resource))
15 if(identities.markNew(child))
16 propagateNewMarks(child);
20 * Mark all parents of resources marked new as optional provisionally. This mark is removed
21 * in ValidateGraph.run, if the resource can be found in dependencies.
23 private void propagateOptionalMarks(int child) {
24 int parent = identities.getParent(child);
25 if(parent >= 0 && !identities.isRoot(parent) && !identities.isNewResource(parent) && identities.markOptional(parent))
26 propagateOptionalMarks(parent);
31 int[] originalNewResources = identities.getNewResources();
32 for(int resource : originalNewResources)
33 propagateNewMarks(resource);
34 for(int resource : originalNewResources)
35 propagateOptionalMarks(resource);