Testing and fixing bugs on enum data types
[iot2.git] / iotjava / iotrmi / Java / basics / TestClass.java
index 19b99de69fb5d8f599252dd13ae02322593dc564..a7453a499a2d1fb8d4adc64d1d38fa31e34a824b 100644 (file)
@@ -10,6 +10,7 @@ public class TestClass implements TestClassInterface {
        private int intA;
        private float floatB;
        private String stringC;
+       private List<CallBackInterfaceWithCallBack> cblist;
 
        /**
         * Constructors
@@ -30,6 +31,35 @@ public class TestClass implements TestClassInterface {
        }
 
 
+       // Callback
+       //public void registerCallback(CallBackInterface _cb) {
+       public void registerCallback(CallBackInterfaceWithCallBack _cb) {
+
+               cblist.add(_cb);
+               System.out.println("Registering callback object!");
+       }
+
+
+       /*public void registerCallback(CallBackInterfaceWithCallBack[] _cb) {
+
+               for (CallBackInterfaceWithCallBack cb : _cb) {
+                       cblist.add(cb);
+                       System.out.println("Registering callback object!");
+               }
+       }*/
+
+
+       public int callBack() {
+
+               int sum = 0;
+               for (CallBackInterfaceWithCallBack cb : cblist) {
+                       sum = sum + cb.printInt();
+               }
+               return sum;
+       }
+
+
+       // Single variables
        public byte getByte(byte in) {
 
                return in;
@@ -72,6 +102,93 @@ public class TestClass implements TestClassInterface {
        }
 
 
+       // Arrays
+       public byte[] getByteArray(byte[] in) {
+
+               return in;
+       }
+
+
+       public short[] getShortArray(short[] in) {
+
+               return in;
+       }
+
+
+       public long[] getLongArray(long[] in) {
+
+               return in;
+       }
+
+
+       public float[] getFloatArray(float[] in) {
+
+               return in;
+       }
+
+
+       public double[] getDoubleArray(double[] in) {
+
+               return in;
+       }
+
+
+       public boolean[] getBooleanArray(boolean[] in) {
+
+               return in;
+       }
+
+
+       public char[] getCharArray(char[] in) {
+
+               return in;
+       }
+
+
+       // Lists
+       public List<Byte> getByteList(List<Byte> in) {
+
+               return in;
+       }
+
+
+       public List<Short> getShortList(List<Short> in) {
+
+               return in;
+       }
+
+
+       public List<Long> getLongList(List<Long> in) {
+
+               return in;
+       }
+
+
+       public List<Float> getFloatList(List<Float> in) {
+
+               return in;
+       }
+
+
+       public List<Double> getDoubleList(List<Double> in) {
+
+               return in;
+       }
+
+
+       public List<Boolean> getBooleanList(List<Boolean> in) {
+
+               return in;
+       }
+
+
+       public List<Character> getCharList(List<Character> in) {
+
+               return in;
+       }
+
+
+       // Other functions
        public int getA() {
 
                return intA;
@@ -96,6 +213,35 @@ public class TestClass implements TestClassInterface {
        }
 
 
+       // Enum
+       public Enum handleEnum(Enum en) {
+
+               System.out.println("Enum: " + en);
+                               
+               return en;
+       }
+
+
+       public Enum[] handleEnumArray(Enum[] en) {
+
+               for (Enum e : en) {
+                       System.out.println("Enum: " + e);
+               }
+               
+               return en;
+       }
+
+
+       public List<Enum> handleEnumList(List<Enum> en) {
+
+               for (Enum e : en) {
+                       System.out.println("Enum: " + e);
+               }
+               
+               return en;
+       }
+
+
        // Getters
        public String sumArray(String[] newA) {