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
7
8
9
10
11
12
13
14
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 }