]> gerrit.simantics Code Review - simantics/platform.git/blob
7d88a0276c6448233602b685b5fb78d943edf2e5
[simantics/platform.git] /
1 package org.simantics.graph.compiler.internal.templates;
2
3 import gnu.trove.map.hash.TIntIntHashMap;
4
5 import java.util.ArrayList;
6 import java.util.Collection;
7
8 import org.simantics.graph.store.IStore;
9 import org.simantics.graph.store.IndexMappingUtils;
10
11 public class TemplateInstanceStore implements IStore {
12         ArrayList<int[]> templateInstances;
13
14         public TemplateInstanceStore(ArrayList<int[]> templateInstances) {
15                 this.templateInstances = templateInstances;
16         }
17         
18         public TemplateInstanceStore() {
19                 this(new ArrayList<int[]>());
20         }
21
22         @Override
23         public void map(final TIntIntHashMap map) {
24                 for(int[] templateInstance : templateInstances)
25                         IndexMappingUtils.map(map, templateInstance);
26         }
27         
28         public Collection<int[]> getTemplateInstances() {
29                 return templateInstances;
30         }
31
32         public void add(int[] templateInstance) {
33                 templateInstances.add(templateInstance);                
34         }       
35 }