File tree Expand file tree Collapse file tree 2 files changed +43
-38
lines changed
main/java/com/iluwatar/state
test/java/com/iluwatar/state Expand file tree Collapse file tree 2 files changed +43
-38
lines changed Original file line number Diff line number Diff line change 1- package com .iluwatar .state ;
2-
3- /**
4- *
5- * In State pattern the container object (Mammoth) has an internal state object (State) that
6- * defines the current behavior. The state object can be changed to alter the
7- * behavior.
8- *
9- * In this example the mammoth changes its behavior as time passes by.
10- *
11- */
12- public class App {
13-
14- public static void main (String [] args ) {
15-
16- Mammoth mammoth = new Mammoth ();
17- mammoth .observe ();
18- mammoth .timePasses ();
19- mammoth .observe ();
20- mammoth .timePasses ();
21- mammoth .observe ();
22-
23- }
24- }
1+ package com .iluwatar .state ;
2+
3+ /**
4+ *
5+ * In State pattern the container object ({@link Mammoth} ) has an internal state object ({@link State} ) that
6+ * defines the current behavior. The state object can be changed to alter the
7+ * behavior.
8+ * <p>
9+ * In this example the {@link Mammoth} changes its behavior as time passes by.
10+ *
11+ */
12+ public class App {
13+
14+ public static void main (String [] args ) {
15+
16+ Mammoth mammoth = new Mammoth ();
17+ mammoth .observe ();
18+ mammoth .timePasses ();
19+ mammoth .observe ();
20+ mammoth .timePasses ();
21+ mammoth .observe ();
22+
23+ }
24+ }
Original file line number Diff line number Diff line change 1- package com .iluwatar .state ;
2-
3- import org .junit .Test ;
4-
5- import com .iluwatar .state .App ;
6-
7- public class AppTest {
8-
9- @ Test
10- public void test () {
11- String [] args = {};
12- App .main (args );
13- }
14- }
1+ package com .iluwatar .state ;
2+
3+ import org .junit .Test ;
4+
5+ import com .iluwatar .state .App ;
6+
7+ /**
8+ *
9+ * Application test
10+ *
11+ */
12+ public class AppTest {
13+
14+ @ Test
15+ public void test () {
16+ String [] args = {};
17+ App .main (args );
18+ }
19+ }
You can’t perform that action at this time.
0 commit comments