1 | class Operation extends EnumeratedAttribute {↵ | | 1 | class Type extends EnumeratedAttribute {↵
|
|
2 | // Property type operations↵ | | 2 | // Property types↵
|
3 | /** + */↵ | | 3 | /** int */↵
|
4 | public static final int INCREMENT_OPER = 0;↵ | | 4 | public static final int INTEGER_TYPE = 0;↵
|
5 | /** - */↵ | | 5 | /** date */↵
|
6 | public static final int DECREMENT_OPER = 1;↵ | | 6 | public static final int DATE_TYPE = 1;↵
|
7 | /** = */↵ | | 7 | /** string */↵
|
8 | public static final int EQUALS_OPER = 2;↵ | | 8 | public static final int STRING_TYPE = 2;↵
|
|
9 | /** {@inheritDoc}. */↵ | | 9 | /** {@inheritDoc} */↵
|
10 | public String[] getValues() {↵ | | 10 | public String[] getValues() {↵
|
11 | return new String[] {"+", "-", "="};↵ | | 11 | return new String[] {"int", "date", "string"};↵
|
12 | }↵ | | 12 | }↵
|
|
13 | /**↵ | | 13 | /**↵
|
14 | * Convert string to index.↵ | | 14 | * Convert string to index.↵
|
15 | * @param oper the string to convert.↵ | | 15 | * @param type the string to convert.↵
|
16 | * @return the index.↵ | | 16 | * @return the index.↵
|
17 | */↵ | | 17 | */↵
|
18 | public static int toOperation(String oper) {↵ | | 18 | public static int toType(String type) {↵
|
19 | if ("+".equals(oper)) {↵ | | 19 | if ("int".equals(type)) {↵
|
20 | return INCREMENT_OPER;↵ | | 20 | return INTEGER_TYPE;↵
|
21 | } else if ("-".equals(oper)) {↵ | | 21 | } else if ("date".equals(type)) {↵
|
22 | return DECREMENT_OPER;↵ | | 22 | return DATE_TYPE;↵
|
23 | }↵ | | 23 | }↵
|
24 | return EQUALS_OPER;↵ | | 24 | return STRING_TYPE;↵
|
25 | }↵ | | 25 | }↵
|
26 | | | 26 |
|