Switch Pattern

A switch is an object that can typically be in one of two states and can change between them. An alternative example of a switch is a door that that can be either open or closed. The switch is controlled by two actions a turnOn action and a turnOff action. A switch is a form of linear machine where the machine forms a sequence of states that can be traversed in either direction.