<s>
The	O
memento	B-Language
pattern	I-Language
is	O
a	O
software	O
design	O
pattern	O
that	O
exposes	O
the	O
private	O
internal	O
state	O
of	O
an	O
object	O
.	O
</s>
<s>
The	O
memento	B-Language
pattern	I-Language
is	O
implemented	O
with	O
three	O
objects	O
:	O
the	O
originator	O
,	O
a	O
caretaker	O
and	O
a	O
memento	O
.	O
</s>
<s>
When	O
using	O
this	O
pattern	O
,	O
care	O
should	O
be	O
taken	O
if	O
the	O
originator	O
may	O
change	O
other	O
objects	O
or	O
resources	O
—	O
the	O
memento	B-Language
pattern	I-Language
operates	O
on	O
a	O
single	O
object	O
.	O
</s>
<s>
Classic	O
examples	O
of	O
the	O
memento	B-Language
pattern	I-Language
include	O
a	O
pseudorandom	O
number	O
generator	O
(	O
each	O
consumer	O
of	O
the	O
PRNG	O
serves	O
as	O
a	O
caretaker	O
who	O
can	O
initialize	O
the	O
PRNG	O
(	O
the	O
originator	O
)	O
with	O
the	O
same	O
seed	O
(	O
the	O
memento	O
)	O
to	O
produce	O
an	O
identical	O
sequence	O
of	O
pseudorandom	O
numbers	O
)	O
and	O
the	O
state	O
in	O
a	O
finite	O
state	O
machine	O
.	O
</s>
<s>
The	O
Memento	B-Language
Pattern	I-Language
was	O
created	O
by	O
Noah	O
Thompson	O
,	O
David	O
Espiritu	O
,	O
and	O
Dr.	O
Drew	O
Clinkenbeard	O
for	O
early	O
HP	O
products	O
.	O
</s>
<s>
See	O
also	O
the	O
UML	B-Language
class	O
and	O
sequence	O
diagram	O
below	O
.	O
</s>
<s>
In	O
the	O
above	O
UML	B-Language
class	O
diagram	O
,	O
</s>
<s>
The	O
following	O
Java	O
program	O
illustrates	O
the	O
"	O
undo	O
"	O
usage	O
of	O
the	O
memento	B-Language
pattern	I-Language
.	O
</s>
<s>
The	O
memento	B-Language
pattern	I-Language
allows	O
one	O
to	O
capture	O
the	O
internal	O
state	O
of	O
an	O
object	O
without	O
violating	O
encapsulation	O
such	O
that	O
later	O
one	O
can	O
undo/revert	O
the	O
changes	O
if	O
required	O
.	O
</s>
