Update libgee to 0.9.92 (3462b25)
[profile/ivi/libgee.git] / gee / abstractlist.vala
1 /* abstractlist.vala
2  *
3  * Copyright (C) 2007  Jürg Billeter
4  * Copyright (C) 2009  Didier Villevalois
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
19  *
20  * Author:
21  *      Didier 'Ptitjes' Villevalois <ptitjes@free.fr>
22  */
23
24 /**
25  * Skeletal implementation of the {@link List} interface.
26  *
27  * Contains common code shared by all list implementations.
28  *
29  * @see ArrayList
30  * @see LinkedList
31  */
32 public abstract class Gee.AbstractList<G> : Gee.AbstractCollection<G>, List<G> {
33
34         /**
35          * {@inheritDoc}
36          */
37         public abstract ListIterator<G> list_iterator ();
38
39         /**
40          * {@inheritDoc}
41          */
42         public abstract new G? get (int index);
43
44         /**
45          * {@inheritDoc}
46          */
47         public abstract new void set (int index, G item);
48
49         /**
50          * {@inheritDoc}
51          */
52         public abstract int index_of (G item);
53
54         /**
55          * {@inheritDoc}
56          */
57         public abstract void insert (int index, G item);
58
59         /**
60          * {@inheritDoc}
61          */
62         public abstract G remove_at (int index);
63
64         /**
65          * {@inheritDoc}
66          */
67         public abstract List<G>? slice (int start, int stop);
68
69         private weak List<G> _read_only_view;
70
71         /**
72          * {@inheritDoc}
73          */
74         public virtual new List<G> read_only_view {
75                 owned get {
76                         List<G> instance = _read_only_view;
77                         if (_read_only_view == null) {
78                                 instance = new ReadOnlyList<G> (this);
79                                 _read_only_view = instance;
80                                 instance.add_weak_pointer ((void**) (&_read_only_view));
81                         }
82                         return instance;
83                 }
84         }
85
86         // Future-proofing
87         internal new virtual void reserved0() {}
88         internal new virtual void reserved1() {}
89         internal new virtual void reserved2() {}
90         internal new virtual void reserved3() {}
91         internal new virtual void reserved4() {}
92         internal new virtual void reserved5() {}
93         internal new virtual void reserved6() {}
94         internal new virtual void reserved7() {}
95         internal new virtual void reserved8() {}
96         internal new virtual void reserved9() {}
97 }