mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-15 06:58:41 +00:00
20 lines
650 B
Java
20 lines
650 B
Java
package com.iluwatar;
|
|
|
|
public class App {
|
|
|
|
public static void main( String[] args ) {
|
|
// create model, view and controller
|
|
GiantModel giant = new GiantModel(Health.HEALTHY, Fatigue.ALERT, Nourishment.SATURATED);
|
|
GiantView view = new GiantView();
|
|
GiantController controller = new GiantController(giant, view);
|
|
// initial display
|
|
controller.updateView();
|
|
// controller receives some interactions that affect the giant
|
|
controller.setHealth(Health.WOUNDED);
|
|
controller.setNourishment(Nourishment.HUNGRY);
|
|
controller.setFatigue(Fatigue.TIRED);
|
|
// redisplay
|
|
controller.updateView();
|
|
}
|
|
}
|