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