Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8ddcdac

Browse filesBrowse files
committed
Comments for memento example.
1 parent 1330602 commit 8ddcdac
Copy full SHA for 8ddcdac

4 files changed

+24Lines changed: 24 additions & 0 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

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

Copy file name to clipboardExpand all lines: memento/src/main/java/com/iluwatar/App.java
+9Lines 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 )
Collapse file

‎memento/src/main/java/com/iluwatar/Star.java‎

Copy file name to clipboardExpand all lines: memento/src/main/java/com/iluwatar/Star.java
+5Lines 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;
Collapse file
+5Lines 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
}
Collapse file

‎memento/src/main/java/com/iluwatar/StarMementoInternal.java‎

Copy file name to clipboardExpand all lines: memento/src/main/java/com/iluwatar/StarMementoInternal.java
+5Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.