changes: TINF-175 TZPC-4722
[platform/upstream/libgee.git] / gee / abstractsortedmap.vala
1 /* readonlysortedmap.vala
2  *
3  * Copyright (C) 2009-2011  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 public abstract class Gee.AbstractSortedMap<K, V> : AbstractMap<K,V>, SortedMap<K,V> {
24         /**
25          * {@inheritDoc}
26          */
27         public abstract SortedMap<K,V> head_map (K before);
28
29         /**
30          * {@inheritDoc}
31          */
32         public abstract SortedMap<K,V> tail_map (K after);
33
34         /**
35          * {@inheritDoc}
36          */
37         public abstract SortedMap<K,V> sub_map (K before, K after);
38
39         /**
40          * {@inheritDoc}
41          */
42         public abstract SortedSet<K> ascending_keys { owned get; }
43
44         /**
45          * {@inheritDoc}
46          */
47         public abstract SortedSet<Map.Entry<K,V>> ascending_entries { owned get; }
48
49         private weak SortedMap<K,V> _read_only_view;
50         /**
51          * The read-only view this map.
52          */
53         public new SortedMap<K,V> read_only_view {
54                 owned get {
55                         SortedMap<K,V> instance = _read_only_view;
56                         if (_read_only_view == null) {
57                                 instance = new ReadOnlySortedMap<K,V> (this);
58                                 _read_only_view = instance;
59                                 instance.add_weak_pointer ((void**) (&_read_only_view));
60                         }
61                         return instance;
62                 }
63         }
64
65         // Future-proofing
66         internal new virtual void reserved0() {}
67         internal new virtual void reserved1() {}
68         internal new virtual void reserved2() {}
69         internal new virtual void reserved3() {}
70         internal new virtual void reserved4() {}
71         internal new virtual void reserved5() {}
72         internal new virtual void reserved6() {}
73         internal new virtual void reserved7() {}
74         internal new virtual void reserved8() {}
75         internal new virtual void reserved9() {}
76 }
77