Object-oriented finite-state machines