Resolves checkstyle errors for remaining m (#1090)
* Reduces checkstyle errors in marker * Reduces checkstyle errors in master-worker-pattern * Reduces checkstyle errors in mediator * Reduces checkstyle errors in memento * Reduces checkstyle errors in model-view-controller * Reduces checkstyle errors in model-view-presenter * Reduces checkstyle errors in module * Reduces checkstyle errors in monad * Reduces checkstyle errors in monostate * Reduces checkstyle errors in multiton * Reduces checkstyle errors in mute-idiom * Reduces checkstyle errors in mutex
This commit is contained in:
committed by
Ilkka Seppälä
parent
3ccc9baa1a
commit
1fdc650545
@ -23,36 +23,33 @@
|
||||
|
||||
package com.iluwatar.memento;
|
||||
|
||||
import java.util.Stack;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.Stack;
|
||||
|
||||
/**
|
||||
*
|
||||
* The Memento pattern is a software design pattern that provides the ability to restore an object
|
||||
* to its previous state (undo via rollback).
|
||||
* <p>
|
||||
* The Memento pattern is implemented with three objects: the originator, a caretaker and a memento.
|
||||
* The originator is some object that has an internal state. The caretaker is going to do something
|
||||
* to the originator, but wants to be able to undo the change. The caretaker first asks the
|
||||
* originator for a memento object. Then it does whatever operation (or sequence of operations) it
|
||||
* was going to do. To roll back to the state before the operations, it returns the memento object
|
||||
* to the originator. The memento object itself is an opaque object (one which the caretaker cannot,
|
||||
* or should not, change). When using this pattern, care should be taken if the originator may
|
||||
* change other objects or resources - the memento pattern operates on a single object.
|
||||
* <p>
|
||||
* In this example the object ({@link Star}) gives out a "memento" ({@link StarMemento}) that
|
||||
*
|
||||
* <p>The Memento pattern is implemented with three objects: the originator, a caretaker and a
|
||||
* memento. The originator is some object that has an internal state. The caretaker is going to do
|
||||
* something to the originator, but wants to be able to undo the change. The caretaker first asks
|
||||
* the originator for a memento object. Then it does whatever operation (or sequence of operations)
|
||||
* it was going to do. To roll back to the state before the operations, it returns the memento
|
||||
* object to the originator. The memento object itself is an opaque object (one which the caretaker
|
||||
* cannot, or should not, change). When using this pattern, care should be taken if the originator
|
||||
* may change other objects or resources - the memento pattern operates on a single object.
|
||||
*
|
||||
* <p>In this example the object ({@link Star}) gives out a "memento" ({@link 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 {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(App.class);
|
||||
|
||||
/**
|
||||
* Program entry point
|
||||
* Program entry point.
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
Stack<StarMemento> states = new Stack<>();
|
||||
|
@ -24,9 +24,7 @@
|
||||
package com.iluwatar.memento;
|
||||
|
||||
/**
|
||||
*
|
||||
* Star uses "mementos" to store and restore state.
|
||||
*
|
||||
*/
|
||||
public class Star {
|
||||
|
||||
@ -35,7 +33,7 @@ public class Star {
|
||||
private int massTons;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* Constructor.
|
||||
*/
|
||||
public Star(StarType startType, int startAge, int startMass) {
|
||||
this.type = startType;
|
||||
@ -44,7 +42,7 @@ public class Star {
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes time pass for the star
|
||||
* Makes time pass for the star.
|
||||
*/
|
||||
public void timePasses() {
|
||||
ageYears *= 2;
|
||||
@ -96,9 +94,7 @@ public class Star {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* StarMemento implementation
|
||||
*
|
||||
* StarMemento implementation.
|
||||
*/
|
||||
private static class StarMementoInternal implements StarMemento {
|
||||
|
||||
|
@ -24,9 +24,7 @@
|
||||
package com.iluwatar.memento;
|
||||
|
||||
/**
|
||||
*
|
||||
* External interface to memento.
|
||||
*
|
||||
*/
|
||||
public interface StarMemento {
|
||||
|
||||
|
@ -24,9 +24,7 @@
|
||||
package com.iluwatar.memento;
|
||||
|
||||
/**
|
||||
*
|
||||
* StarType enumeration
|
||||
*
|
||||
* StarType enumeration.
|
||||
*/
|
||||
public enum StarType {
|
||||
|
||||
|
Reference in New Issue
Block a user