cblist = new ArrayList<CallBackInterfaceWithCallBack>();
}
+
+ public int callBack() {
+
+ int sum = 0;
+ System.out.println("Callback called! cblist: " + cblist.size());
+ for (CallBackInterfaceWithCallBack cb : cblist) {
+ sum = sum + cb.printInt();
+ //cb.needCallback(this);
+ TestClass tci = new TestClass();
+ cb.needCallback(this);
+ cb.needCallback(tci);
+ System.out.println("\n\nInside the loop! Sum is now: " + sum + "\n\n");
+ }
+ System.out.println("Executed callback of callback! Returning value: " + sum + "\n\n");
+ return sum;
+ }
// Callback
//public void registerCallback(CallBackInterface _cb) {
public void registerCallback(CallBackInterfaceWithCallBack _cb) {
cblist.add(_cb);
- System.out.println("Registering callback object!");
+ System.out.println("Registering callback object! Items: " + cblist.size());
}
}
- public int callBack() {
-
- int sum = 0;
- for (CallBackInterfaceWithCallBack cb : cblist) {
- sum = sum + cb.printInt();
- }
- return sum;
- }
-
-
// Single variables
public byte getByte(byte in) {
// Struct
public Struct handleStruct(Struct str) {
- System.out.println("Name: " + str.name);
- System.out.println("Value: " + str.value);
- System.out.println("Year: " + str.year);
+ //System.out.println("Name: " + str.name);
+ //System.out.println("Value: " + str.value);
+ //System.out.println("Year: " + str.year);
- Struct test = new Struct();
- test.name = "Anonymous";
- test.value = 1.33f;
- test.year = 2016;
+ //Struct test = new Struct();
+ //test.name = "Anonymous";
+ //test.value = 1.33f;
+ //test.year = 2016;
- str = test;
+ //str = test;
return str;
}
intA = newA;
return intA;
}
+
+ public static void main(String[] args) {
+
+ TestClass tc = new TestClass();
+ System.out.println("Get short: " + tc.getShort((short) 1234));
+ }
}