changes: TINF-175 TZPC-4722
[platform/upstream/libgee.git] / gee / abstractbidirsortedset.vala
1 /* abstractbidirsortedset.vala
2  *
3  * Copyright (C) 2012  Maciej Piechotka
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
18  *
19  * Author:
20  *      Maciej Piechotka <uzytkownik2@gmail.com>
21  */
22
23 /**
24  * Skeletal implementation of the {@link BidirSortedSet} interface.
25  *
26  * Contains common code shared by all set implementations.
27  *
28  * @see TreeSet
29  */
30 public abstract class Gee.AbstractBidirSortedSet<G> : Gee.AbstractSortedSet<G>, BidirSortedSet<G> {
31         /**
32          * {@inheritDoc}
33          */
34         public abstract BidirIterator<G> bidir_iterator ();
35
36         private weak BidirSortedSet<G> _read_only_view;
37
38         /**
39          * {@inheritDoc}
40          */
41         public virtual new BidirSortedSet<G> read_only_view {
42                 owned get {
43                         BidirSortedSet<G> instance = _read_only_view;
44                         if (_read_only_view == null) {
45                                 instance = new ReadOnlyBidirSortedSet<G> (this);
46                                 _read_only_view = instance;
47                                 instance.add_weak_pointer ((void**) (&_read_only_view));
48                         }
49                         return instance;
50                 }
51         }
52
53         // Future-proofing
54         internal new virtual void reserved0() {}
55         internal new virtual void reserved1() {}
56         internal new virtual void reserved2() {}
57         internal new virtual void reserved3() {}
58         internal new virtual void reserved4() {}
59         internal new virtual void reserved5() {}
60         internal new virtual void reserved6() {}
61         internal new virtual void reserved7() {}
62         internal new virtual void reserved8() {}
63         internal new virtual void reserved9() {}
64 }
65