15
15
16
16
package de .symeda .sormas .ui .caze .notifier ;
17
17
18
+ import java .util .Arrays ;
18
19
import java .util .Collections ;
19
20
import java .util .Set ;
20
21
import java .util .TreeSet ;
@@ -35,15 +36,17 @@ public class TreatmentOption implements Comparable<TreatmentOption> {
35
36
public static final TreatmentOption UNKNOWN =
36
37
new TreatmentOption (YesNoUnknown .UNKNOWN .toString (), I18nProperties .getEnumCaption (YesNoUnknown .UNKNOWN ));
37
38
38
- public static final Set <TreatmentOption > ALL_OPTIONS = Collections .unmodifiableSet (new TreeSet <>(Set .of (YES , NO , NOT_APPLICABLE , UNKNOWN )));
39
+ public static final Set <TreatmentOption > ALL_OPTIONS =
40
+ Collections .unmodifiableSet (new TreeSet <>(Arrays .asList (YES , NO , NOT_APPLICABLE , UNKNOWN )));
39
41
40
42
private String value ;
41
43
private String caption ;
42
44
43
45
/**
44
46
* Creates a TreatmentOption from a YesNoUnknown enum value.
45
47
*
46
- * @param yesNoUnknown the enum value to convert, null returns NOT_APPLICABLE
48
+ * @param yesNoUnknown
49
+ * the enum value to convert, null returns NOT_APPLICABLE
47
50
* @return corresponding TreatmentOption
48
51
*/
49
52
public static final TreatmentOption forValue (YesNoUnknown yesNoUnknown ) {
@@ -65,8 +68,10 @@ public static final TreatmentOption forValue(YesNoUnknown yesNoUnknown) {
65
68
/**
66
69
* Creates a new TreatmentOption.
67
70
*
68
- * @param value the internal value
69
- * @param caption the display caption
71
+ * @param value
72
+ * the internal value
73
+ * @param caption
74
+ * the display caption
70
75
*/
71
76
public TreatmentOption (String value , String caption ) {
72
77
this .value = value ;
@@ -111,14 +116,14 @@ public int compareTo(TreatmentOption other) {
111
116
if (other == null ) {
112
117
return 1 ;
113
118
}
114
-
119
+
115
120
// Define the desired order: YES, NO, UNKNOWN, NOT_APPLICABLE
116
121
int thisOrder = getOrder (this );
117
122
int otherOrder = getOrder (other );
118
-
123
+
119
124
return Integer .compare (thisOrder , otherOrder );
120
125
}
121
-
126
+
122
127
private int getOrder (TreatmentOption option ) {
123
128
if (option .equals (YES )) {
124
129
return 1 ;
0 commit comments