Testing struct for array and list (Java and C++); fixing bugs
[iot2.git] / iotjava / iotrmi / Java / basics / TestClass.java
index 8844ffbaa12edd8c8e3805bc59a5bebb2b5eb50f..a5c0c1136741b7388af085066173cca6acb61ef7 100644 (file)
@@ -261,12 +261,12 @@ public class TestClass implements TestClassInterface {
        }
 
 
-       /*public Struct[] handleStruct(Struct[] data) {
+       public Struct[] handleStructArray(Struct str[]) {
 
-               for (Struct str : data) {
-                       System.out.println("Name: " + str.name);
-                       System.out.println("Value: " + str.value);
-                       System.out.println("Year: " + str.year);
+               for (Struct st : str) {
+                       System.out.println("Name: " + st.name);
+                       System.out.println("Value: " + st.value);
+                       System.out.println("Year: " + st.year);
                }
 
                Struct test = new Struct();
@@ -274,10 +274,29 @@ public class TestClass implements TestClassInterface {
                test.value = 1.33f;
                test.year = 2016;
 
-               data[0] = test;
+               str[0] = test;
 
-               return data;
-       }*/
+               return str;
+       }
+
+
+       public List<Struct> handleStructList(List<Struct> str) {
+
+               for (Struct st : str) {
+                       System.out.println("Name: " + st.name);
+                       System.out.println("Value: " + st.value);
+                       System.out.println("Year: " + st.year);
+               }
+
+               Struct test = new Struct();
+               test.name = "Tests";
+               test.value = 1.34f;
+               test.year = 2017;
+
+               str.add(test);
+
+               return str;
+       }
 
 
        // Getters