File tree Expand file tree Collapse file tree 4 files changed +24
-0
lines changed
memento/src/main/java/com/iluwatar Expand file tree Collapse file tree 4 files changed +24
-0
lines changed Original file line number Diff line number Diff line change 22
33import 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+ */
514public class App
615{
716 public static void main ( String [] args )
Original file line number Diff line number Diff line change 11package com .iluwatar ;
22
3+ /**
4+ *
5+ * Star uses "mementos" to store and restore state.
6+ *
7+ */
38public class Star {
49
510 private StarType type ;
Original file line number Diff line number Diff line change 11package com .iluwatar ;
22
3+ /**
4+ *
5+ * External interface to memento.
6+ *
7+ */
38public interface StarMemento {
49
510}
Original file line number Diff line number Diff line change 11package com .iluwatar ;
22
3+ /**
4+ *
5+ * Internal interface to memento.
6+ *
7+ */
38public class StarMementoInternal implements StarMemento {
49
510 private StarType type ;
You can’t perform that action at this time.
0 commit comments