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
30
31
32
33
34
35
36
37
38
39
40
41 public final class Rating extends ComparableIndividual {
42
43 public static final String MY_URI = uAAL_VOCABULARY_NAMESPACE + "Rating";
44
45 public static final int POOR = 0;
46 public static final int ALMOST_POOR = 1;
47 public static final int ALMOST_SUFFICIENT = 2;
48 public static final int SUFFICIENT = 3;
49 public static final int RICH_SUFFICIENT = 4;
50 public static final int ALMOST_SATISFYING = 5;
51 public static final int SATISFYING = 6;
52 public static final int RICH_SATISFYING = 7;
53 public static final int ALMOST_GOOD = 8;
54 public static final int GOOD = 9;
55 public static final int RICH_GOOD = 10;
56 public static final int ALMOST_EXCELLENT = 11;
57 public static final int EXCELLENT = 12;
58
59 private static final String[] names = { "poor", "almost_poor",
60 "almost_sufficient", "sufficient", "rich_sufficient",
61 "almost_satisfying", "satisfying", "rich_satisfying",
62 "almost_good", "good", "rich_good", "almost_excellent", "excellent" };
63
64 public static final Rating poor = new Rating(POOR);
65 public static final Rating almostPoor = new Rating(ALMOST_POOR);
66 public static final Rating almostSufficient = new Rating(ALMOST_SUFFICIENT);
67 public static final Rating sufficient = new Rating(SUFFICIENT);
68 public static final Rating richSufficient = new Rating(RICH_SUFFICIENT);
69 public static final Rating almostSatisfying = new Rating(ALMOST_SATISFYING);
70 public static final Rating satisfying = new Rating(SATISFYING);
71 public static final Rating richSatisfying = new Rating(RICH_SATISFYING);
72 public static final Rating almostGood = new Rating(ALMOST_GOOD);
73 public static final Rating good = new Rating(GOOD);
74 public static final Rating richGood = new Rating(RICH_GOOD);
75 public static final Rating almostExcellent = new Rating(ALMOST_EXCELLENT);
76 public static final Rating excellent = new Rating(EXCELLENT);
77
78
79 private int order;
80
81
82 private Rating() {
83 }
84
85 private Rating(int order) {
86 super(uAAL_VOCABULARY_NAMESPACE + names[order]);
87 this.order = order;
88 }
89
90
91 public String getClassURI() {
92 return MY_URI;
93 }
94
95 public static Rating getMaxValue() {
96 return excellent;
97 }
98
99 public static Rating getMinValue() {
100 return poor;
101 }
102
103 public static Rating getRatingByOrder(int order) {
104 switch (order) {
105 case POOR:
106 return poor;
107 case ALMOST_POOR:
108 return almostPoor;
109 case ALMOST_SUFFICIENT:
110 return almostSufficient;
111 case SUFFICIENT:
112 return sufficient;
113 case RICH_SUFFICIENT:
114 return richSufficient;
115 case ALMOST_SATISFYING:
116 return almostSatisfying;
117 case SATISFYING:
118 return satisfying;
119 case RICH_SATISFYING:
120 return richSatisfying;
121 case ALMOST_GOOD:
122 return almostGood;
123 case GOOD:
124 return good;
125 case RICH_GOOD:
126 return richGood;
127 case ALMOST_EXCELLENT:
128 return almostExcellent;
129 case EXCELLENT:
130 return excellent;
131 default:
132 return null;
133 }
134 }
135
136 public static final Rating valueOf(String name) {
137 for (int i = POOR; i <= EXCELLENT; i++)
138 if (names[i].equals(name))
139 return getRatingByOrder(i);
140 return null;
141 }
142
143 public int compareTo(Object other) {
144 return (this == other) ? 0 : (order < ((Rating) other).order) ? -1 : 1;
145 }
146
147 public ComparableIndividual getNext() {
148 return getRatingByOrder(order + 1);
149 }
150
151 public ComparableIndividual getPrevious() {
152 return getRatingByOrder(order - 1);
153 }
154
155 public int getPropSerializationType(String propURI) {
156 return PROP_SERIALIZATION_OPTIONAL;
157 }
158
159
160 public boolean isWellFormed() {
161 return true;
162 }
163
164
165 public String name() {
166 return names[order];
167 }
168
169 public int ord() {
170 return order;
171 }
172
173
174
175
176
177
178 public boolean setProperty(String propURI, Object o) {
179
180 return false;
181 }
182 }