One way i could think about is having a class which listens to events and has the different states stored in variables.
Is there a standard pattern for implementing state machines using java?
The article I read before seems to be down right now, but if you Google enough you should be able to find other sources on how to implement finite state machines using Java enum
s.
Found it: http://www.javacodegeeks.com/2011/07/java-secret-using-enum-to-build-state.html
state pattern can be used. See an example implementation in C++ here.
I found this article very useful when I had to implement the state pattern: State Design Pattern using java .. A different approach!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With