A state machine framework for java