Dodatkowe przykłady dopasowywane są do haseł w zautomatyzowany sposób - nie gwarantujemy ich poprawności.
The Memento pattern is useful for capturing the state of the program before user actions.
The memento pattern is implemented with two objects: the originator and a caretaker.
Memento pattern: Provides the ability to restore an object to its previous state (rollback)
The following Java program illustrates the "undo" usage of the Memento Pattern.
The memento pattern is a software design pattern that provides the ability to restore an object to its previous state (undo via rollback).
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.
Classic examples of the memento pattern include the seed of a pseudorandom number generator (it will always produce the same sequence thereafter when initialized with the seed state) and the state in a finite state machine.
The reader was essentially a state history stack-a good example of a memento pattern - where each cell pointed to the header of the list being read, the current position within the list being read, and the level or depth of the history stack.
Behavioral patterns (11): Chain-of-responsibility pattern, Command pattern, Interpreter pattern, Iterator pattern, Mediator pattern, Memento pattern, Observer pattern, State pattern, Strategy pattern, Template method pattern, Visitor pattern...