]> gerrit.simantics Code Review - simantics/sysdyn.git/blob
e315e3216b4563896309dd5c87174e6783be326f
[simantics/sysdyn.git] /
1 package org.simantics.sysdyn.modelImport.model.expression;\r
2 \r
3 import java.util.ArrayList;\r
4 import java.util.HashMap;\r
5 import java.util.List;\r
6 \r
7 import org.simantics.db.Resource;\r
8 import org.simantics.db.WriteGraph;\r
9 import org.simantics.db.exception.DatabaseException;\r
10 import org.simantics.sysdyn.modelImport.model.WriteContext;\r
11 \r
12 public class SubscriptExpression implements IExpression {\r
13         \r
14         private ArrayList<SubscriptExpressionElement> elements;\r
15         \r
16         public SubscriptExpression(String[] indices, IExpression expression) {\r
17                 elements = new ArrayList<SubscriptExpressionElement>();\r
18                 elements.add(new SubscriptExpressionElement(indices, expression));\r
19         }\r
20         \r
21         public List<SubscriptExpressionElement> getElements() {\r
22                 return elements;\r
23         }\r
24         \r
25         public void merge(SubscriptExpression other) {\r
26                 elements.addAll(other.getElements());\r
27         }\r
28         \r
29         @Override\r
30         public void write(WriteGraph graph, Resource parent, WriteContext context)\r
31                         throws DatabaseException {\r
32                 System.err.println("write subscript expression");\r
33         }\r
34         \r
35         private class SubscriptExpressionElement {\r
36                 \r
37                 String[] indices;\r
38                 IExpression expression;\r
39                 \r
40                 public SubscriptExpressionElement(String[] indices, IExpression expression) {\r
41                         this.indices = indices;\r
42                         this.expression = expression;\r
43                 }\r
44         }\r
45 \r
46 }\r