1/*
2 * Copyright (C) 2006 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.webkit;
18
19import java.io.Serializable;
20
21/**
22 * This class contains the back/forward list for a WebView.
23 * WebView.copyBackForwardList() will return a copy of this class used to
24 * inspect the entries in the list.
25 */
26public abstract class WebBackForwardList implements Cloneable, Serializable {
27    /**
28     * Return the current history item. This method returns null if the list is
29     * empty.
30     * @return The current history item.
31     */
32    public abstract WebHistoryItem getCurrentItem();
33
34    /**
35     * Get the index of the current history item. This index can be used to
36     * directly index into the array list.
37     * @return The current index from 0...n or -1 if the list is empty.
38     */
39    public abstract int getCurrentIndex();
40
41    /**
42     * Get the history item at the given index. The index range is from 0...n
43     * where 0 is the first item and n is the last item.
44     * @param index The index to retrieve.
45     */
46    public abstract WebHistoryItem getItemAtIndex(int index);
47
48    /**
49     * Get the total size of the back/forward list.
50     * @return The size of the list.
51     */
52    public abstract int getSize();
53
54    /**
55     * Clone the entire object to be used in the UI thread by clients of
56     * WebView. This creates a copy that should never be modified by any of the
57     * webkit package classes.
58     */
59    protected abstract WebBackForwardList clone();
60}
61