Package Behavioral.Memento
Class Caretaker
java.lang.Object
Behavioral.Memento.Caretaker
The Caretaker class manages Memento objects.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMemento(Memento memento) Adds a Memento to the list.getMemento(int index) Retrieves a Memento by index.
-
Constructor Details
-
Caretaker
public Caretaker()Default constructor for Caretaker.
-
-
Method Details
-
addMemento
Adds a Memento to the list.- Parameters:
memento- The Memento to add.
-
getMemento
Retrieves a Memento by index.- Parameters:
index- The index of the desired Memento.- Returns:
- The Memento at the specified index.
- Throws:
IndexOutOfBoundsException- if the index is invalid.
-