Comments for memento example.
This commit is contained in:
parent
13306023f0
commit
8ddcdac33e
@ -2,6 +2,15 @@ package com.iluwatar;
|
|||||||
|
|
||||||
import java.util.Stack;
|
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 class App
|
||||||
{
|
{
|
||||||
public static void main( String[] args )
|
public static void main( String[] args )
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
package com.iluwatar;
|
package com.iluwatar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Star uses "mementos" to store and restore state.
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class Star {
|
public class Star {
|
||||||
|
|
||||||
private StarType type;
|
private StarType type;
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
package com.iluwatar;
|
package com.iluwatar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* External interface to memento.
|
||||||
|
*
|
||||||
|
*/
|
||||||
public interface StarMemento {
|
public interface StarMemento {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
package com.iluwatar;
|
package com.iluwatar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Internal interface to memento.
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class StarMementoInternal implements StarMemento {
|
public class StarMementoInternal implements StarMemento {
|
||||||
|
|
||||||
private StarType type;
|
private StarType type;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user