]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.history/src/org/simantics/history/csv/ColumnSeparator.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.history / src / org / simantics / history / csv / ColumnSeparator.java
diff --git a/bundles/org.simantics.history/src/org/simantics/history/csv/ColumnSeparator.java b/bundles/org.simantics.history/src/org/simantics/history/csv/ColumnSeparator.java
new file mode 100644 (file)
index 0000000..0d6348c
--- /dev/null
@@ -0,0 +1,24 @@
+package org.simantics.history.csv;\r
+\r
+\r
+public enum ColumnSeparator {\r
+       COMMA("Comma (,)", ","),TAB("Tabulator (\\t)","\t"),SEMICOLON("Semicolon (;)",";"),COLON("Colon (:)",":"),SPACE("Space ( )", " ");\r
+       public String label;\r
+       public String preference;\r
+       ColumnSeparator(String label, String preference) {\r
+               this.label = label;\r
+               this.preference = preference;\r
+       }\r
+       public static ColumnSeparator fromIndex(int index) {\r
+               return values()[index];\r
+       }\r
+       public String toPreference() {\r
+               return preference;\r
+       }\r
+       public static ColumnSeparator fromPreference(String preference) {\r
+               for(ColumnSeparator s : values()) {\r
+                       if(s.preference.equals(preference)) return s;\r
+               }\r
+               return COMMA;\r
+       }\r
+}
\ No newline at end of file