2 * Copyright (C) 2014, United States Government, as represented by the
3 * Administrator of the National Aeronautics and Space Administration.
6 * The Java Pathfinder core (jpf-core) platform is licensed under the
7 * Apache License, Version 2.0 (the "License"); you may not use this file except
8 * in compliance with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0.
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
20 package gov.nasa.jpf.vm;
23 * generic interface for objects that are used to restore previous states from
24 * within a context that holds the references to the objects to restore (e.g. a
25 * container), i.e. the caller knows where to restore the objects in question.
26 * The caller can provide a cached object the memento can update. However, its
27 * up to the memento if it uses this (optional) argument object to restore
28 * in-situ, the only guarantee it makes is that it returns a restored object
30 public interface Memento<T> {
33 * note that there is no guarantee the restored object will be the same that
34 * is (optionally) passed in.
36 * Implementations are free to restore in-situ or create a new object if a
37 * non-null reference is provided. Callers are responsible for identity
38 * integrity if they do provide in-situ objects
40 * The caller does not guarantee the provided in-situ object was the one the
41 * Memento was created from