1 package iotrmi.Java.sample;
5 import java.util.ArrayList;
7 public class TestClass implements TestClassInterface {
14 private String stringC;
15 private CallBackInterface cb;
16 private List<CallBackInterface> cblist;
27 cblist = new ArrayList<CallBackInterface>();
31 public TestClass(int _int, float _float, String _string) {
37 cblist = new ArrayList<CallBackInterface>();
41 public void setA(int _int) {
47 public void setB(float _float) {
53 public void setC(String _string) {
60 public String sumArray(String[] newA) {
69 public int setAndGetA(int newA) {
76 public int setACAndGetA(String newC, int newA) {
84 public void registerCallback(CallBackInterface _cb) {
90 public void registerCallback(CallBackInterface[] _cb) {
92 for (CallBackInterface cb : _cb) {
94 System.out.println("Registering callback object!");
99 //public int callBack() {
100 // return cb.printInt();
104 public int callBack() {
107 for (CallBackInterface cb : cblist) {
108 sum = sum + cb.printInt();
110 //sum = cblist.get(1).printInt();
116 public static void main(String[] args) {
118 TestClass tc = new TestClass();
119 CallBack cb = new CallBack(3);
121 tc.registerCallback(cb);
122 System.out.println("Return value: " + tc.callBack());