View Javadoc

1   package net.sourceforge.basher;
2   
3   /**
4    * @author Johan Lindquist
5    * @version $Revision$
6    */
7   public enum Phase
8   {
9       START, SETUP, WARMUP, RUN, COOLDOWN, TEARDOWN, END;
10      
11      public static Phase getNextPhase(Phase phase)
12      {
13          if (phase == null)
14          {
15              return START;
16          }
17  
18          switch (phase)
19          {
20              case START:
21                  return SETUP;
22              case SETUP:
23                  return RUN;
24              case WARMUP:
25                  return RUN;
26              case RUN:
27                  return COOLDOWN;
28              case COOLDOWN:
29                  return END;
30              case TEARDOWN:
31                  return END;
32              case END:
33                  return null;
34              default:
35                  throw new IllegalStateException("Unhandled enum: " + phase);
36          }
37      }
38      
39  }