0f316cd75c139bbde9bdff20440c2f7e86b44232
[iot2.git] / benchmarks / other / ZigbeeTest / IoTSet.java
1
2 import java.lang.UnsupportedOperationException;
3
4 import java.util.Collection;
5 import java.util.HashSet;
6 import java.util.Iterator;
7 import java.util.Set;
8 import java.util.Spliterator;
9
10
11 /** Class IoTSet is the actual implementation of @config IoTSet<...>.
12  *  Upon extracting DB information, SetInstrumenter class will use
13  *  this class to actually instantiate the Set as IoTSet that uses
14  *  Java Set<T> to implement; we don't provide interfaces to modify
15  *  the contents, but we do provide means to read them out
16  *
17  * @author      Rahmadi Trimananda <rahmadi.trimananda @ uci.edu>
18  * @version     1.0
19  * @since       2015-12-01
20  */
21 public final class IoTSet<T> {
22
23         /**
24          * Reference to an object Set<T>
25          */
26         private Set<T> set;
27
28         /**
29          * Class constructor (pass the reference to this immutable wrapper)
30          */
31         public IoTSet(Set<T> s) {
32
33                 set = s;
34         }
35
36         /**
37          * contains() method inherited from Set interface
38          */
39         public boolean contains(T o) {
40
41                 return set.contains(o);
42
43         }
44
45         /**
46          * isEmpty() method inherited from Set interface
47          */
48         public boolean isEmpty() {
49
50                 return set.isEmpty();
51
52         }
53
54         /**
55          * iterator() method inherited from Set interface
56          */
57         public Iterator<T> iterator() {
58
59                 return new HashSet<T>(set).iterator();
60
61         }
62
63         /**
64          * size() method inherited from Set interface
65          */
66         public int size() {
67
68                 return set.size();
69
70         }
71
72         /**
73          * values() method to return Set object values for easy iteration
74          */
75         public Set<T> values() {
76
77                 return new HashSet<T>(set);
78
79         }
80 }