March 2002
Intermediate to advanced
496 pages
8h 51m
English
| SOLUTION 19.1 | Storing a memento as an object assumes that the application will still be running when the user wants to restore the original object. Reasons that will force you to save a memento to persistent storage follow.
|
| SOLUTION 19.2 | Here is an implementation of createMemento() for FactorySimulator:
public List createMemento()
{
List list = new ArrayList();
Iterator i = machines.iterator();
while (i.hasNext())
{
MachineImage mi = (MachineImage) i.next();
list.add(mi.clone());
}
return list;
}
When you write a |
Read now
Unlock full access