1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 package org.universAAL.ontology.device;
23
24 import org.universAAL.middleware.owl.ManagedIndividual;
25
26 public class ValueType extends ManagedIndividual {
27 public static final String MY_URI = DeviceOntology.NAMESPACE + "ValueType";
28
29 public static final int EVENT = 0;
30 public static final int STATE = 1;
31
32 private static final String[] names = { "event", "state" };
33
34 public static final ValueType event = new ValueType(EVENT);
35 public static final ValueType state = new ValueType(STATE);
36
37 private int order;
38
39 private ValueType(int order) {
40 super(DeviceOntology.NAMESPACE + names[order]);
41 this.order = order;
42 }
43
44 public int getPropSerializationType(String propURI) {
45 return PROP_SERIALIZATION_OPTIONAL;
46 }
47
48 public boolean isWellFormed() {
49 return true;
50 }
51
52 public String name() {
53 return names[order];
54 }
55
56 public int ord() {
57 return order;
58 }
59
60 public String getClassURI() {
61 return MY_URI;
62 }
63
64 public static ValueType getValueTypeByOrder(int order) {
65 switch (order) {
66 case EVENT:
67 return event;
68 case STATE:
69 return state;
70 default:
71 return null;
72 }
73 }
74
75 public static final ValueType valueOf(String name) {
76 if (name == null)
77 return null;
78
79 if (name.startsWith(DeviceOntology.NAMESPACE))
80 name = name.substring(DeviceOntology.NAMESPACE.length());
81
82 for (int i = EVENT; i <= STATE; i++)
83 if (names[i].equals(name))
84 return getValueTypeByOrder(i);
85
86 return null;
87 }
88 }