1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.universAAL.middleware.owl.supply;
21
22 import org.universAAL.middleware.owl.ComparableIndividual;
23
24
25
26
27
28
29 public final class LevelRating extends ComparableIndividual {
30
31 public static final String MY_URI = uAAL_VOCABULARY_NAMESPACE
32 + "LevelRating";
33
34 public static final int NONE = 0;
35 public static final int LOW = 1;
36 public static final int MIDDLE = 2;
37 public static final int HIGH = 3;
38 public static final int FULL = 4;
39
40 private static final String[] names = { "none", "low", "middle", "high",
41 "full" };
42
43 public static final LevelRating none = new LevelRating(NONE);
44 public static final LevelRating low = new LevelRating(LOW);
45 public static final LevelRating middle = new LevelRating(MIDDLE);
46 public static final LevelRating high = new LevelRating(HIGH);
47 public static final LevelRating full = new LevelRating(FULL);
48
49
50 private int order;
51
52
53 private LevelRating() {
54
55 }
56
57 private LevelRating(int order) {
58 super(uAAL_VOCABULARY_NAMESPACE + names[order]);
59 this.order = order;
60 }
61
62
63 public String getClassURI() {
64 return MY_URI;
65 }
66
67 public static LevelRating getMaxValue() {
68 return full;
69 }
70
71 public static LevelRating getMinValue() {
72 return none;
73 }
74
75 public static LevelRating getLevelByOrder(int order) {
76 switch (order) {
77 case NONE:
78 return none;
79 case LOW:
80 return low;
81 case MIDDLE:
82 return middle;
83 case HIGH:
84 return high;
85 case FULL:
86 return full;
87 default:
88 return null;
89 }
90 }
91
92 public static final LevelRating valueOf(String name) {
93 for (int i = NONE; i <= FULL; i++)
94 if (names[i].equals(name))
95 return getLevelByOrder(i);
96 return null;
97 }
98
99 public int compareTo(Object other) {
100 return (this == other) ? 0 : (order < ((LevelRating) other).order) ? -1
101 : 1;
102 }
103
104 public ComparableIndividual getNext() {
105 return getLevelByOrder(order + 1);
106 }
107
108 public ComparableIndividual getPrevious() {
109 return getLevelByOrder(order - 1);
110 }
111
112 public int getPropSerializationType(String propURI) {
113 return PROP_SERIALIZATION_OPTIONAL;
114 }
115
116
117 public boolean isWellFormed() {
118 return true;
119 }
120
121
122 public String name() {
123 return names[order];
124 }
125
126 public int ord() {
127 return order;
128 }
129
130
131
132
133
134
135 public boolean setProperty(String propURI, Object o) {
136
137 return false;
138 }
139 }