Completed MVC example code.

This commit is contained in:
Ilkka Seppala
2015-05-02 23:37:26 +03:00
parent c9bf6819e1
commit 3bcca7102c
7 changed files with 154 additions and 1 deletions
@@ -3,6 +3,17 @@ package com.iluwatar;
public class App {
public static void main( String[] args ) {
System.out.println( "Hello World!" );
// 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();
}
}