Added code comments.

This commit is contained in:
Ilkka Seppala 2015-05-02 23:49:33 +03:00
parent 3bcca7102c
commit b01e841dff
7 changed files with 45 additions and 0 deletions

View File

@ -1,5 +1,20 @@
package com.iluwatar;
/**
*
* Model-View-Controller is a pattern for implementing user interfaces. It divides the application
* into three interconnected parts namely the model, the view and the controller.
*
* The central component of MVC, the model, captures the behavior of the application in terms of its problem
* domain, independent of the user interface. The model directly manages the data, logic and rules of the
* application. A view can be any output representation of information, such as a chart or a diagram
* The third part, the controller, accepts input and converts it to commands for the model or view.
*
* In this example we have a giant (GiantModel) with statuses for health, fatigue and nourishment. GiantView
* can display the giant with its current status. GiantController receives input affecting the model and
* delegates redrawing the giant to the view.
*
*/
public class App {
public static void main( String[] args ) {

View File

@ -1,5 +1,10 @@
package com.iluwatar;
/**
*
* Fatigue enumeration
*
*/
public enum Fatigue {
ALERT("alert"), TIRED("tired"), SLEEPING("sleeping");

View File

@ -1,5 +1,10 @@
package com.iluwatar;
/**
*
* GiantController can update the giant data and redraw it using the view.
*
*/
public class GiantController {
private GiantModel giant;

View File

@ -1,5 +1,10 @@
package com.iluwatar;
/**
*
* GiantModel contains the giant data
*
*/
public class GiantModel {
private Health health;

View File

@ -1,5 +1,10 @@
package com.iluwatar;
/**
*
* GiantView displays the giant
*
*/
public class GiantView {
public void displayGiant(GiantModel giant) {

View File

@ -1,5 +1,10 @@
package com.iluwatar;
/**
*
* Health enumeration
*
*/
public enum Health {
HEALTHY("healthy"), WOUNDED("wounded"), DEAD("dead");

View File

@ -1,5 +1,10 @@
package com.iluwatar;
/**
*
* Nourishment enumeration
*
*/
public enum Nourishment {
SATURATED("saturated"), HUNGRY("hungry"), STARVING("starving");