]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.history/src/org/simantics/history/csv/DecimalSeparator.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.history / src / org / simantics / history / csv / DecimalSeparator.java
diff --git a/bundles/org.simantics.history/src/org/simantics/history/csv/DecimalSeparator.java b/bundles/org.simantics.history/src/org/simantics/history/csv/DecimalSeparator.java
new file mode 100644 (file)
index 0000000..caba6e4
--- /dev/null
@@ -0,0 +1,31 @@
+package org.simantics.history.csv;\r
+\r
+\r
+public enum DecimalSeparator {\r
+       DOT("Dot (.)","."),COMMA("Comma (,)",",");\r
+       public String label;\r
+       public String preference;\r
+       DecimalSeparator(String label, String preference) {\r
+               this.label = label;\r
+               this.preference = preference;\r
+       }\r
+       public static DecimalSeparator fromIndex(int index) {\r
+               return values()[index];\r
+       }\r
+       public String toPreference() {\r
+               return preference;\r
+       }\r
+       public static DecimalSeparator fromPreference(String preference) {\r
+               for(DecimalSeparator s : values()) {\r
+                       if(s.preference.equals(preference)) return s;\r
+               }\r
+               return DOT;\r
+       }\r
+       public static DecimalSeparator fromChar(char c) {\r
+               String preference = "" + c;\r
+               for(DecimalSeparator s : values()) {\r
+                       if(s.preference.equals(preference)) return s;\r
+               }\r
+               return DOT;\r
+       }\r
+}
\ No newline at end of file