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