Skip to content

Commit 8ddcdac

Browse files
committed
Comments for memento example.
1 parent 1330602 commit 8ddcdac

File tree

4 files changed

+24
-0
lines changed

4 files changed

+24
-0
lines changed

memento/src/main/java/com/iluwatar/App.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
import java.util.Stack;
44

5+
/**
6+
*
7+
* Memento pattern is for storing and restoring object
8+
* state. The object (Star) gives out a "memento"
9+
* (StarMemento) that contains the state of the object.
10+
* Later on the memento can be set back to the object
11+
* restoring the state.
12+
*
13+
*/
514
public class App
615
{
716
public static void main( String[] args )

memento/src/main/java/com/iluwatar/Star.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+
* Star uses "mementos" to store and restore state.
6+
*
7+
*/
38
public class Star {
49

510
private StarType type;
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+
* External interface to memento.
6+
*
7+
*/
38
public interface StarMemento {
49

510
}

memento/src/main/java/com/iluwatar/StarMementoInternal.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+
* Internal interface to memento.
6+
*
7+
*/
38
public class StarMementoInternal implements StarMemento {
49

510
private StarType type;

0 commit comments

Comments
 (0)