-
Notifications
You must be signed in to change notification settings - Fork 0
/
SelectionControlMask.java
53 lines (45 loc) · 1.46 KB
/
SelectionControlMask.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package com.destranix.glslang;
import java.util.EnumSet;
public enum SelectionControlMask {
SelectionControlMaskNone(Main.SELECTION_CONTROL_MASK_NONE),
SelectionControlFlattenMask(Main.SELECTION_CONTROL_FLATTEN_MASK),
SelectionControlDontFlattenMask(Main.SELECTION_CONTROL_DONT_FLATTEN_MASK);
private final int value;
private SelectionControlMask(int value) {
this.value = value;
}
public int getConstant() {
return this.value;
}
public static int setToInt(EnumSet<SelectionControlMask> set) {
int ret = 0;
for (SelectionControlMask val : set) {
ret |= val.getConstant();
}
return ret;
}
public static SelectionControlMask valueByStr(String str) {
switch (str) {
case "SelectionControlMaskNone":
return SelectionControlMaskNone;
case "SelectionControlFlattenMask":
return SelectionControlFlattenMask;
case "SelectionControlDontFlattenMask":
return SelectionControlDontFlattenMask;
default:
throw new IllegalArgumentException("Cannot translate string into enum value!");
}
}
public static SelectionControlMask valueByConstant(int constant) {
switch (constant) {
case Main.SELECTION_CONTROL_MASK_NONE:
return SelectionControlMaskNone;
case Main.SELECTION_CONTROL_FLATTEN_MASK:
return SelectionControlFlattenMask;
case Main.SELECTION_CONTROL_DONT_FLATTEN_MASK:
return SelectionControlDontFlattenMask;
default:
throw new IllegalArgumentException("Cannot translate constant into enum value!");
}
}
}