Design: Memento Pattern Implementation
Design the core components of the Memento pattern including Originator, Memento, and Caretaker. Out of scope are UI undo/redo integration and persistence of states beyond runtime.
Functional Requirements
FR1: Allow an object to save its state at a point in time.
FR2: Enable restoring the object to a previous saved state.
FR3: Keep the saved state separate from the object's main logic.
FR4: Support multiple saved states for undo functionality.
FR5: Ensure the saved states are immutable once created.
Non-Functional Requirements
NFR1: The system should handle up to 1000 saved states per object.
NFR2: Restoring a state should happen within 10 milliseconds.
NFR3: Memory usage should be optimized to avoid storing full copies if possible.
NFR4: The design should keep the originator's internal state encapsulated.
