________________________________________________________________________

This file is part of Logtalk <https://logtalk.org/>  
Copyright 1998-2020 Paulo Moura <pmoura@logtalk.org>

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
________________________________________________________________________


% start by loading the design pattern sample implementations:

| ?- logtalk_load(design_patterns('behavioral/memento/loader')).
...


% sample sequence of operations from "user", which plays
% the role of the caretaker in this design pattern:

| ?- originator::(
		set(s1),
		set(s2),
		save_to_memento(Momento1),
		set(s3),
		save_to_memento(Momento2),
		set(s4),
		restore_from_memento(Momento1),
		set(s5),
		restore_from_memento(Momento2)
	).

Originator: Setting state to s1
Originator: Setting state to s2
Originator: Saving to Memento.
Originator: Setting state to s3
Originator: Saving to Memento.
Originator: Setting state to s4
Originator: State after restoring from Memento: s2
Originator: Setting state to s5
Originator: State after restoring from Memento: s3
Momento1 = o1,
Momento2 = o2
yes
