This project is intended to simulate a ceiling fan using the state design pattern. The fan has two chains that are used to change its speed and direction. The fan has four speed states, which are off, low, medium, and high. Pulling the speed chain will change the fan's speed to the next state in the order given. If it is in the high state, then the fan will return to the off state. The fan has two direction states, clockwise and counterclockwise. Pulling the direction chain will alternate the fan's direction between clockwise and counterclockwise.
This project can be built from the command line by entering the commands listed below:
- sudo dnf install maven
- mvn clean compile assembly:single
- java -jar target/ceiling-fan-state-design-pattern-1.0-SNAPSHOT-jar-with-dependencies.jar
jUnit4 was used to unit test this project. Tests can be found here.
This project has a main method used only for demonstration. It cycles through each of the speed and direction states. It can be found here.