Adding the old tracker variable for debugging/testing purposes.
[jpf-core.git] / src / main / gov / nasa / jpf / vm / Memento.java
1 /*
2  * Copyright (C) 2014, United States Government, as represented by the
3  * Administrator of the National Aeronautics and Space Administration.
4  * All rights reserved.
5  *
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
9  * 
10  *        http://www.apache.org/licenses/LICENSE-2.0. 
11  *
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.
17  */
18
19
20 package gov.nasa.jpf.vm;
21
22 /**
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
29  */
30 public interface Memento<T> {
31
32   /**
33    * note that there is no guarantee the restored object will be the same that
34    * is (optionally) passed in.
35    * 
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
39    * 
40    * The caller does not guarantee the provided in-situ object was the one the
41    * Memento was created from
42    */
43   T restore(T inSitu);
44 }