44
55public class StoryBoard
66{
7- enum Types {None , Description , Frame }
8- private StringBuffer stringBuffer = new StringBuffer ();
9- int index = 0 ;
10- private Types last = Types .None ;
7+ enum Types {
8+ None , Description , Frame
9+ }
10+ private StringBuffer stringBuffer = new StringBuffer ();
11+ int index = 0 ;
12+ private Types last = Types .None ;
1113 public static <T > StoryBoard createSequence (T initial , int additionalFrames , Function0 <T > getNextFrame )
1214 {
1315 return new StoryBoard ().add (initial ).addFrames (additionalFrames , getNextFrame );
@@ -20,28 +22,29 @@ public <T> StoryBoard add(T object)
2022 public <T > StoryBoard addFrame (String title , T frame )
2123 {
2224 addNewLines (Types .Frame );
23- String frameTitle = title ;
25+ String frameTitle = title ;
2426 stringBuffer .append (String .format ("%s:\n %s" , frameTitle , frame ));
2527 index ++;
2628 return this ;
2729 }
28-
29- private void addNewLines (Types type ) {
30- switch (last ){
31- case None :
30+ private void addNewLines (Types type )
31+ {
32+ switch (last )
33+ {
34+ case None :
3235 break ;
33- case Description :
34- if (type == Types .Frame ){
36+ case Description :
37+ if (type == Types .Frame )
38+ {
3539 stringBuffer .append ("\n \n " );
3640 }
3741 break ;
38- case Frame :
42+ case Frame :
3943 stringBuffer .append ("\n \n " );
4044 break ;
4145 }
4246 last = type ;
4347 }
44-
4548 public <T > StoryBoard addFrames (int howMany , Function0 <T > getNextFrame )
4649 {
4750 for (int i = 0 ; i < howMany ; i ++)
@@ -58,7 +61,7 @@ public String toString()
5861 public StoryBoard addDescription (String game_of_life )
5962 {
6063 addNewLines (Types .Description );
61- stringBuffer .append (game_of_life + "\n " );
64+ stringBuffer .append (game_of_life + "\n " );
6265 return this ;
6366 }
6467 public <T > StoryBoard addFrame (T frame )
0 commit comments