1 package org.bouncycastle.util;
2 
3 public interface Memoable
4 {
5     /**
6      * Produce a copy of this object with its configuration and in its current state.
7      * <p>
8      * The returned object may be used simply to store the state, or may be used as a similar object
9      * starting from the copied state.
10      */
copy()11     public Memoable copy();
12 
13     /**
14      * Restore a copied object state into this object.
15      * <p>
16      * Implementations of this method <em>should</em> try to avoid or minimise memory allocation to perform the reset.
17      *
18      * @param other an object originally {@link #copy() copied} from an object of the same type as this instance.
19      * @throws ClassCastException if the provided object is not of the correct type.
20      * @throws MemoableResetException if the <b>other</b> parameter is in some other way invalid.
21      */
reset(Memoable other)22     public void reset(Memoable other);
23 }
24