Moving Java drivers; Creating iotruntime socket connections for C++; First version...
[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         //public IoTSet(Set<T> s) {
34
35                 set = s;
36         }
37
38         /**
39          * contains() method inherited from Set interface
40          */
41         public boolean contains(T o) {
42
43                 return set.contains(o);
44
45         }
46
47         /**
48          * isEmpty() method inherited from Set interface
49          */
50         public boolean isEmpty() {
51
52                 return set.isEmpty();
53
54         }
55
56         /**
57          * iterator() method inherited from Set interface
58          */
59         public Iterator<T> iterator() {
60
61                 return new HashSet<T>(set).iterator();
62
63         }
64
65         /**
66          * size() method inherited from Set interface
67          */
68         public int size() {
69
70                 return set.size();
71
72         }
73
74         /**
75          * values() method to return Set object values for easy iteration
76          */
77         public Set<T> values() {
78
79                 return new HashSet<T>(set);
80
81         }
82 }