]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.history/src/org/simantics/history/csv/DecimalSeparator.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.history / src / org / simantics / history / csv / DecimalSeparator.java
1 package org.simantics.history.csv;
2
3
4 public enum DecimalSeparator {
5         DOT("Dot (.)","."),COMMA("Comma (,)",",");
6         public String label;
7         public String preference;
8         DecimalSeparator(String label, String preference) {
9                 this.label = label;
10                 this.preference = preference;
11         }
12         public static DecimalSeparator fromIndex(int index) {
13                 return values()[index];
14         }
15         public String toPreference() {
16                 return preference;
17         }
18         public static DecimalSeparator fromPreference(String preference) {
19                 for(DecimalSeparator s : values()) {
20                         if(s.preference.equals(preference)) return s;
21                 }
22                 return DOT;
23         }
24         public static DecimalSeparator fromChar(char c) {
25                 String preference = "" + c;
26                 for(DecimalSeparator s : values()) {
27                         if(s.preference.equals(preference)) return s;
28                 }
29                 return DOT;
30         }
31 }