-package org.simantics.db.layer0.variable;\r
-\r
-import java.util.HashMap;\r
-import java.util.Map;\r
-import java.util.Set;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.exception.DatabaseException;\r
-\r
-abstract public class VariableMapImpl implements VariableMap {\r
-\r
- @Override\r
- public Variable getVariable(ReadGraph graph, Variable context, String name) throws DatabaseException {\r
- return getVariables(graph, context, null).get(name);\r
- }\r
-\r
- @Override\r
- public Map<String, Variable> getVariables(ReadGraph graph, Variable context, String classification, Map<String, Variable> map) throws DatabaseException {\r
- \r
- Map<String,Variable> all = getVariables(graph, context, null);\r
- if(all.isEmpty()) return all;\r
- \r
- for(Map.Entry<String, Variable> entry : all.entrySet()) {\r
- Set<String> classifications = entry.getValue().getClassifications(graph);\r
- if(classifications.contains(classification)) {\r
- if(map == null) map = new HashMap<String,Variable>();\r
- map.put(entry.getKey(), entry.getValue());\r
- }\r
- }\r
- \r
- return map;\r
- \r
- }\r
-\r
-}\r
+package org.simantics.db.layer0.variable;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.simantics.db.ReadGraph;
+import org.simantics.db.exception.DatabaseException;
+
+abstract public class VariableMapImpl implements VariableMap {
+
+ @Override
+ public Variable getVariable(ReadGraph graph, Variable context, String name) throws DatabaseException {
+ return getVariables(graph, context, null).get(name);
+ }
+
+ @Override
+ public Map<String, Variable> getVariables(ReadGraph graph, Variable context, String classification, Map<String, Variable> map) throws DatabaseException {
+
+ Map<String,Variable> all = getVariables(graph, context, null);
+ if(all.isEmpty()) return all;
+
+ for(Map.Entry<String, Variable> entry : all.entrySet()) {
+ Set<String> classifications = entry.getValue().getClassifications(graph);
+ if(classifications.contains(classification)) {
+ if(map == null) map = new HashMap<String,Variable>();
+ map.put(entry.getKey(), entry.getValue());
+ }
+ }
+
+ return map;
+
+ }
+
+}