A simple state machine pattern for Processing