Testing more complex struct and enum declarations; fixing subtle bugs
[iot2.git] / iotjava / iotrmi / Java / basics / TestClass.java
index 7031dc295681b66e4e3ee9b37f517b0a70692799..42e53c2cdefdde17047629f3e3eb9a98514f6ca1 100644 (file)
@@ -1,6 +1,7 @@
 import java.util.Set;
 import java.util.List;
 import java.util.ArrayList;
+import java.util.Arrays;
 
 public class TestClass implements TestClassInterface {
 
@@ -253,6 +254,28 @@ public class TestClass implements TestClassInterface {
        }
 
 
+       public Enum handleEnumComplex(Enum en, int i, char c) {
+
+               System.out.println("Enum: " + en);
+               System.out.println("Integer: " + i);
+               System.out.println("Char: " + c);
+               
+               return en;
+       }
+
+
+       public Enum[] handleEnumComplex2(Enum[] en, int in, char c) {
+
+               for (Enum e : en) {
+                       System.out.println("Enum: " + e);
+               }
+               System.out.println("Integer: " + in);
+               System.out.println("Char: " + c);
+               
+               return en;
+       }
+
+
        // Struct
        public Struct handleStruct(Struct str) {
 
@@ -310,6 +333,41 @@ public class TestClass implements TestClassInterface {
        }
 
 
+       public Struct handleStructComplex(int in, char c, Struct str) {
+
+               System.out.println("Name: " + str.name);
+               System.out.println("Value: " + str.value);
+               System.out.println("Year: " + str.year);
+
+               System.out.println("Integer: " + in);
+               System.out.println("Char: " + c);
+
+               Struct test = new Struct();
+               test.name = "Anonymous";
+               test.value = 1.33f;
+               test.year = 2016;
+
+               str = test;
+
+               return str;
+       }
+
+
+       public List<Struct> handleStructComplex2(int in, char c, Struct str[]) {
+
+               for (Struct st : str) {
+                       System.out.println("Name: " + st.name);
+                       System.out.println("Value: " + st.value);
+                       System.out.println("Year: " + st.year);
+               }
+
+               System.out.println("Integer: " + in);
+               System.out.println("Char: " + c);
+
+               return new ArrayList<Struct>(Arrays.asList(str));
+       }
+
+
        // Getters
        public String sumArray(String[] newA) {