Adding lock/synchronization to make sure that RMI calls are thread safe
[iot2.git] / iotjava / iotpolicy / tree / RequiresDecl.java
index 5a921550178f7e65495ae1d99ef23e90d8121e6b..b058716af1a781f93f4bd19761fe67c6adcd56fb 100644 (file)
@@ -15,12 +15,7 @@ import java.util.Set;
  * @version     1.0
  * @since       2016-09-20
  */
-public class RequiresDecl {
-
-       /**
-        * Class properties
-        */
-       private String origInt;
+public class RequiresDecl extends Declaration {
 
        /**
         * A "requires" statement:
@@ -29,6 +24,10 @@ public class RequiresDecl {
         * In this data structure we will record its new interface name, i.e. CameraWithCaptureAndData
         *              and its required capabilities, i.e. VideoRecording and ImageCapture.
         */
+
+       /**
+        * Class properties
+        */
        private Map<String,List<String>> mapRequires;
 
        /**
@@ -36,14 +35,14 @@ public class RequiresDecl {
         */
        public RequiresDecl() {
 
-               origInt = null;
+               super();
                mapRequires = new HashMap<String,List<String>>();
        }
 
 
        public RequiresDecl(String _origInt) {
 
-               origInt = _origInt;
+               super(_origInt);
                mapRequires = new HashMap<String,List<String>>();
        }
 
@@ -83,24 +82,4 @@ public class RequiresDecl {
 
                return mapRequires.get(intFace);
        }
-
-
-       public static void main(String[] args) {
-
-               RequiresDecl rd = new RequiresDecl("Camera");
-               rd.addNewIntface("CameraWithCaptureAndData");
-               rd.addNewCapability("CameraWithCaptureAndData", "ImageCapture");
-               rd.addNewCapability("CameraWithCaptureAndData", "VideoRecording");
-
-               System.out.println("Set of interfaces: " + rd.getInterfaces().toString());
-               System.out.println("Set of capabilities: " + rd.getCapabList("CameraWithCaptureAndData").toString());
-
-               rd.addNewIntface("CameraWithCaptureAndRecording");
-               rd.addNewCapability("CameraWithCaptureAndRecording", "ImageCapture");
-               rd.addNewCapability("CameraWithCaptureAndRecording", "BackupData");
-
-               System.out.println("Set of interfaces: " + rd.getInterfaces().toString());
-               System.out.println("Set of capabilities: " + rd.getCapabList("CameraWithCaptureAndData").toString());
-               System.out.println("Set of capabilities: " + rd.getCapabList("CameraWithCaptureAndData").toString());
-       }
 }