Imagine that you want to write a program to control a music player via wireless earbuds. The user can control the music player by tapping the earbuds according to a certain input pattern:
When the user taps an earbud once, the earbud enters command mode and awaits further input. If no input is registered within a certain amount of time, the earbud returns to standby mode.
In command mode, if the user taps the earbud once and waits a moment, the music player receives a command to change the current playing mode. If the player is playing at the moment, it will pause, and if paused, it will resume playing music.
In command mode, if the user taps the earbud twice and waits a moment, the player receives a command to fast forward the current track. After the execution of any command, the earbud returns to standby mode.
If the user switches an earbud to command mode and taps it three times, such input is considered invalid and discarded, and the earbud returns to standby mode.
The code template already has the Earbud class and an interface to represent its states, as well as a few classes implementing the State interface. Your task is to complete the implementations of the OneTap and TwoTaps classes so that the Earbud class would work as intended. When any of the commands (pause, resume and fast forward) is successfully passed, it must be printed to the console: Pausing, Resuming and Fast forwarding respectively.
See the examples for details.