]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.structural.synchronization/src/org/simantics/structural/synchronization/protocol/SerializedVariable.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.structural.synchronization / src / org / simantics / structural / synchronization / protocol / SerializedVariable.java
index f1888e1012fac8a314fa0329f59b70e3551a05b3..73c839b8682f890c83b667b6933aaf6ba5691397 100644 (file)
@@ -1,68 +1,68 @@
-package org.simantics.structural.synchronization.protocol;\r
-\r
-import java.util.Collection;\r
-import java.util.Collections;\r
-import java.util.HashMap;\r
-import java.util.Map;\r
-\r
-import org.simantics.databoard.binding.mutable.Variant;\r
-\r
-public class SerializedVariable {\r
-\r
-       private Map<String,SerializedVariable> children;\r
-       private Map<String,SerializedVariable> properties;\r
-       final public Variant value;\r
-       final public String name;\r
-       \r
-       public SerializedVariable(String name, Variant value) {\r
-               this.name = name;\r
-               this.value = value;\r
-       }\r
-       \r
-       @SuppressWarnings("unchecked")\r
-       public <T> T getPossiblePropertyValue(String name) {\r
-               if(properties == null) return null;\r
-               SerializedVariable p = properties.get(name);\r
-               if(p == null) return null;\r
-               else return (T)p.value.getValue();\r
-       }\r
-\r
-       @SuppressWarnings("unchecked")\r
-       public <T> T getPropertyValue(String name) {\r
-               if(properties == null) throw new AssertionError("Property '" + name + "' does not exist.");\r
-               SerializedVariable p = properties.get(name);\r
-               if(p == null) throw new AssertionError("Property '" + name + "' does not exist.");\r
-               else return (T)p.value.getValue();\r
-       }\r
-       \r
-       public Collection<SerializedVariable> getProperties(){\r
-               if(properties == null) return Collections.emptyList();\r
-               return properties.values();\r
-       }\r
-       \r
-       public static String print(SerializedVariable var, int indent) {\r
-               StringBuilder b = new StringBuilder();\r
-               b.append(var.name + " " + var.value.getValue());\r
-               if(var.children != null) {\r
-                       for(Map.Entry<String, SerializedVariable> child : var.children.entrySet()) {\r
-                               b.append("\n");\r
-                               for(int i=0;i<indent;i++) b.append(" ");\r
-                               b.append("/" + print(child.getValue(), indent+2));\r
-                       }\r
-               }\r
-               if(var.properties != null) {\r
-                       for(Map.Entry<String, SerializedVariable> property : var.properties.entrySet()) {\r
-                               b.append("\n");\r
-                               for(int i=0;i<indent;i++) b.append(" ");\r
-                               b.append("#" + print(property.getValue(), indent+2));\r
-                       }\r
-               }\r
-               return b.toString();\r
-       }\r
-       \r
-       public void addProperty(String name, SerializedVariable property) {\r
-               if(properties == null) properties = new HashMap<String,SerializedVariable>();\r
-               properties.put(name, property);\r
-       }\r
-       \r
-}\r
+package org.simantics.structural.synchronization.protocol;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.simantics.databoard.binding.mutable.Variant;
+
+public class SerializedVariable {
+
+       private Map<String,SerializedVariable> children;
+       private Map<String,SerializedVariable> properties;
+       final public Variant value;
+       final public String name;
+       
+       public SerializedVariable(String name, Variant value) {
+               this.name = name;
+               this.value = value;
+       }
+       
+       @SuppressWarnings("unchecked")
+       public <T> T getPossiblePropertyValue(String name) {
+               if(properties == null) return null;
+               SerializedVariable p = properties.get(name);
+               if(p == null) return null;
+               else return (T)p.value.getValue();
+       }
+
+       @SuppressWarnings("unchecked")
+       public <T> T getPropertyValue(String name) {
+               if(properties == null) throw new AssertionError("Property '" + name + "' does not exist.");
+               SerializedVariable p = properties.get(name);
+               if(p == null) throw new AssertionError("Property '" + name + "' does not exist.");
+               else return (T)p.value.getValue();
+       }
+       
+       public Collection<SerializedVariable> getProperties(){
+               if(properties == null) return Collections.emptyList();
+               return properties.values();
+       }
+       
+       public static String print(SerializedVariable var, int indent) {
+               StringBuilder b = new StringBuilder();
+               b.append(var.name + " " + var.value.getValue());
+               if(var.children != null) {
+                       for(Map.Entry<String, SerializedVariable> child : var.children.entrySet()) {
+                               b.append("\n");
+                               for(int i=0;i<indent;i++) b.append(" ");
+                               b.append("/" + print(child.getValue(), indent+2));
+                       }
+               }
+               if(var.properties != null) {
+                       for(Map.Entry<String, SerializedVariable> property : var.properties.entrySet()) {
+                               b.append("\n");
+                               for(int i=0;i<indent;i++) b.append(" ");
+                               b.append("#" + print(property.getValue(), indent+2));
+                       }
+               }
+               return b.toString();
+       }
+       
+       public void addProperty(String name, SerializedVariable property) {
+               if(properties == null) properties = new HashMap<String,SerializedVariable>();
+               properties.put(name, property);
+       }
+       
+}