]> gerrit.simantics Code Review - simantics/platform.git/blob - 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
1 package org.simantics.history.csv;\r
2 \r
3 \r
4 public enum ColumnSeparator {\r
5         COMMA("Comma (,)", ","),TAB("Tabulator (\\t)","\t"),SEMICOLON("Semicolon (;)",";"),COLON("Colon (:)",":"),SPACE("Space ( )", " ");\r
6         public String label;\r
7         public String preference;\r
8         ColumnSeparator(String label, String preference) {\r
9                 this.label = label;\r
10                 this.preference = preference;\r
11         }\r
12         public static ColumnSeparator fromIndex(int index) {\r
13                 return values()[index];\r
14         }\r
15         public String toPreference() {\r
16                 return preference;\r
17         }\r
18         public static ColumnSeparator fromPreference(String preference) {\r
19                 for(ColumnSeparator s : values()) {\r
20                         if(s.preference.equals(preference)) return s;\r
21                 }\r
22                 return COMMA;\r
23         }\r
24 }