Skip to content

Commit b01e841

Browse files
committed
Added code comments.
1 parent 3bcca71 commit b01e841

File tree

7 files changed

+45
-0
lines changed

7 files changed

+45
-0
lines changed

model-view-controller/src/main/java/com/iluwatar/App.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
package com.iluwatar;
22

3+
/**
4+
*
5+
* Model-View-Controller is a pattern for implementing user interfaces. It divides the application
6+
* into three interconnected parts namely the model, the view and the controller.
7+
*
8+
* The central component of MVC, the model, captures the behavior of the application in terms of its problem
9+
* domain, independent of the user interface. The model directly manages the data, logic and rules of the
10+
* application. A view can be any output representation of information, such as a chart or a diagram
11+
* The third part, the controller, accepts input and converts it to commands for the model or view.
12+
*
13+
* In this example we have a giant (GiantModel) with statuses for health, fatigue and nourishment. GiantView
14+
* can display the giant with its current status. GiantController receives input affecting the model and
15+
* delegates redrawing the giant to the view.
16+
*
17+
*/
318
public class App {
419

520
public static void main( String[] args ) {

model-view-controller/src/main/java/com/iluwatar/Fatigue.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
package com.iluwatar;
22

3+
/**
4+
*
5+
* Fatigue enumeration
6+
*
7+
*/
38
public enum Fatigue {
49

510
ALERT("alert"), TIRED("tired"), SLEEPING("sleeping");

model-view-controller/src/main/java/com/iluwatar/GiantController.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
package com.iluwatar;
22

3+
/**
4+
*
5+
* GiantController can update the giant data and redraw it using the view.
6+
*
7+
*/
38
public class GiantController {
49

510
private GiantModel giant;

model-view-controller/src/main/java/com/iluwatar/GiantModel.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
package com.iluwatar;
22

3+
/**
4+
*
5+
* GiantModel contains the giant data
6+
*
7+
*/
38
public class GiantModel {
49

510
private Health health;

model-view-controller/src/main/java/com/iluwatar/GiantView.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
package com.iluwatar;
22

3+
/**
4+
*
5+
* GiantView displays the giant
6+
*
7+
*/
38
public class GiantView {
49

510
public void displayGiant(GiantModel giant) {

model-view-controller/src/main/java/com/iluwatar/Health.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
package com.iluwatar;
22

3+
/**
4+
*
5+
* Health enumeration
6+
*
7+
*/
38
public enum Health {
49

510
HEALTHY("healthy"), WOUNDED("wounded"), DEAD("dead");

model-view-controller/src/main/java/com/iluwatar/Nourishment.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
package com.iluwatar;
22

3+
/**
4+
*
5+
* Nourishment enumeration
6+
*
7+
*/
38
public enum Nourishment {
49

510
SATURATED("saturated"), HUNGRY("hungry"), STARVING("starving");

0 commit comments

Comments
 (0)