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