View Javadoc
1   package org.woehlke.computer.kurzweil.mandelbrot.julia.view.state;
2   
3   import static org.woehlke.computer.kurzweil.mandelbrot.julia.view.state.ApplicationState.*;
4   
5   /**
6    * Mandelbrot Set drawn by a Turing Machine.
7    * (C) 2006 - 2022 Thomas Woehlke.
8    * @author Thomas Woehlke
9    *
10   * @see <a href="https://thomas-woehlke.blogspot.com/2016/01/mandelbrot-set-drawn-by-turing-machine.html">Blog Article</a>
11   * @see <a href="https://github.com/Computer-Kurzweil/mandelbrot-julia">Github Repository</a>
12   * @see <a href="https://java.woehlke.org/mandelbrot-julia/">Maven Project Repository</a>
13   *
14   * Created by tw on 16.12.2019.
15   */
16  public class ApplicationStateMachine {
17  
18      private volatile ApplicationState applicationState;
19  
20      public ApplicationStateMachine() {
21          this.applicationState = ApplicationState.MANDELBROT;
22      }
23  
24      public void click(){
25          ApplicationState nextApplicationState = null;
26          switch (applicationState){
27              case MANDELBROT:
28                  nextApplicationState = JULIA_SET;
29                  break;
30              case JULIA_SET:
31                  nextApplicationState = MANDELBROT;
32                  break;
33          }
34          this.setApplicationState(nextApplicationState);
35      }
36  
37      public ApplicationState getApplicationState() {
38          return applicationState;
39      }
40  
41      public void setApplicationState(ApplicationState applicationState) {
42          this.applicationState = applicationState;
43      }
44  
45  }