]> gerrit.simantics Code Review - simantics/platform.git/blob
e7346e94570c92edd76c0e46e4df56b2b87935d0
[simantics/platform.git] /
1 package org.simantics.graph.compiler.internal.validation;\r
2 \r
3 import java.util.Collection;\r
4 \r
5 import org.simantics.graph.compiler.internal.store.LocationStore;\r
6 import org.simantics.graph.compiler.internal.templates.TemplateDefinitionStore;\r
7 import org.simantics.graph.store.GraphStore;\r
8 import org.simantics.ltk.Problem;\r
9 \r
10 public class ReportCollisions implements Runnable {\r
11         Collection<Problem> problems;\r
12         GraphStore store;\r
13 \r
14         public ReportCollisions(\r
15                         Collection<Problem> problems,\r
16                         GraphStore store) {\r
17                 this.problems = problems;\r
18                 this.store = store;\r
19         }\r
20         \r
21         @Override\r
22         public void run() {\r
23                 LocationStore locations = store.getStore(LocationStore.class);\r
24                 for(int c : store.values.getCollisions().toArray())\r
25                         problems.add(new Problem(\r
26                                         locations.getLocation(c), \r
27                                         "Two literal values are given for the same resource."));\r
28                 for(int c : store.identities.getCollisions().toArray())\r
29                         problems.add(new Problem(\r
30                                         locations.getLocation(c), \r
31                                         "Two different identities are given for the same resource."));\r
32                 for(int c : store.getStore(TemplateDefinitionStore.class).getCollisions().toArray())\r
33                         problems.add(new Problem(\r
34                                         locations.getLocation(c), \r
35                                         "Two tempalate definitions are given for the same resource."));\r
36         }\r
37         \r
38 }\r