1/*
2 * Copyright (C) 2013 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.content;
18
19/**
20 * Representation of an owner of {@link UndoOperation} objects in an {@link UndoManager}.
21 *
22 * @hide
23 */
24public class UndoOwner {
25    final String mTag;
26
27    UndoManager mManager;
28    Object mData;
29    int mOpCount;
30
31    // For saving/restoring state.
32    int mStateSeq;
33    int mSavedIdx;
34
35    UndoOwner(String tag) {
36        mTag = tag;
37    }
38
39    /**
40     * Return the unique tag name identifying this owner.  This is the tag
41     * supplied to {@link UndoManager#getOwner(String, Object) UndoManager.getOwner}
42     * and is immutable.
43     */
44    public String getTag() {
45        return mTag;
46    }
47
48    /**
49     * Return the actual data object of the owner.  This is the data object
50     * supplied to {@link UndoManager#getOwner(String, Object) UndoManager.getOwner}.  An
51     * owner may have a null data if it was restored from a previously saved state with
52     * no getOwner call to associate it with its data.
53     */
54    public Object getData() {
55        return mData;
56    }
57}
58