1/*
2 * Copyright (C) 2009 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 com.cooliris.media;
18
19public abstract class VirtualFeed<E> {
20    protected int mLoadedBegin = 0;
21    protected int mLoadedEnd = 0;
22    protected int mLoadingBegin = 0;
23    protected int mLoadingEnd = 0;
24    protected int mLoadableBegin = Integer.MIN_VALUE;
25    protected int mLoadableEnd = Integer.MAX_VALUE;
26    protected final Deque<E> mElements = new Deque<E>();
27
28    public VirtualFeed() {
29    }
30
31    public abstract void setLoadingRange(int begin, int end);
32
33    public final E get(int index) {
34
35        return null;
36
37    }
38
39    public final int getLoadedBegin() {
40        return mLoadedBegin;
41    }
42
43    public final int getLoadedEnd() {
44        return mLoadedEnd;
45    }
46
47    public final int getLoadingBegin() {
48        return mLoadingBegin;
49    }
50
51    public final int getLoadingEnd() {
52        return mLoadingEnd;
53    }
54
55    public final int getLoadableBegin() {
56        return mLoadableBegin;
57    }
58
59    public final int getLoadableEnd() {
60        return mLoadableEnd;
61    }
62
63    public interface RangeListener<E> {
64        void onRangeUpdated(VirtualFeed<E> array);
65    }
66}
67