Just formatting App classes to be like the other class files on the project

This commit is contained in:
Matthew
2014-10-07 16:23:37 +01:00
parent 52f0923df9
commit bde5b343d0
24 changed files with 466 additions and 508 deletions

View File

@ -3,37 +3,34 @@ 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.
*
* 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 )
{
Stack<StarMemento> states = new Stack<>();
Star star = new Star(StarType.SUN, 10000000, 500000);
System.out.println(star);
states.add(star.getMemento());
star.timePasses();
System.out.println(star);
states.add(star.getMemento());
star.timePasses();
System.out.println(star);
states.add(star.getMemento());
star.timePasses();
System.out.println(star);
states.add(star.getMemento());
star.timePasses();
System.out.println(star);
while (states.size() > 0) {
star.setMemento(states.pop());
System.out.println(star);
}
public class App {
public static void main(String[] args) {
Stack<StarMemento> states = new Stack<>();
Star star = new Star(StarType.SUN, 10000000, 500000);
System.out.println(star);
states.add(star.getMemento());
star.timePasses();
System.out.println(star);
states.add(star.getMemento());
star.timePasses();
System.out.println(star);
states.add(star.getMemento());
star.timePasses();
System.out.println(star);
states.add(star.getMemento());
star.timePasses();
System.out.println(star);
while (states.size() > 0) {
star.setMemento(states.pop());
System.out.println(star);
}
}
}