So I am thinking trough a little project. And a problem I seem to encounter is :
I have Class A which contains an instance of class C and a list of instances of class B.
Each class contains a timer. I need to execute a class C method when that timer fires an event.
public class A
{
C C1 = new C(this);
public ArrayList<B> B1= new ArrayList<>();
}
so when timer expires I need to fire something like:
C1.method()
Very basic / easy approach: Implemenbt a simple subscribe / publish framework.
For eaxmple:
Caveat: zero testing performed on the obove java code (including, but not limited to, I did not compile it).