Comments for memento example.

This commit is contained in:
Ilkka Seppala 2014-08-31 11:13:50 +03:00
parent 13306023f0
commit 8ddcdac33e
4 changed files with 24 additions and 0 deletions

View File

@ -2,6 +2,15 @@ package com.iluwatar;
import java.util.Stack;
/**
*
* Memento pattern is for storing and restoring object
* state. The object (Star) gives out a "memento"
* (StarMemento) that contains the state of the object.
* Later on the memento can be set back to the object
* restoring the state.
*
*/
public class App
{
public static void main( String[] args )

View File

@ -1,5 +1,10 @@
package com.iluwatar;
/**
*
* Star uses "mementos" to store and restore state.
*
*/
public class Star {
private StarType type;

View File

@ -1,5 +1,10 @@
package com.iluwatar;
/**
*
* External interface to memento.
*
*/
public interface StarMemento {
}

View File

@ -1,5 +1,10 @@
package com.iluwatar;
/**
*
* Internal interface to memento.
*
*/
public class StarMementoInternal implements StarMemento {
private StarType type;