Update Changelog
[profile/ivi/libgee.git] / gee / sortedmap.vala
1 /* sortedset.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 interface Gee.SortedMap<K,V> : Gee.Map<K,V> {
24         /**
25          * Returns map containing pairs with key strictly lower the the argument.
26          */
27         public abstract SortedMap<K,V> head_map (K before);
28
29         /**
30          * Returns map containing pairs with key equal or larger then the argument.
31          */
32         public abstract SortedMap<K,V> tail_map (K after);
33
34         /**
35          * Returns right-open map (i.e. containing all pair which key is strictly
36          * lower then the second argument and equal or bigger then the first one).
37          *
38          * Null as one parameter means that it should include all from this side.
39          */
40         public abstract SortedMap<K,V> sub_map (K before, K after);
41
42         /**
43          * Returns the keys in ascending order.
44          */
45         public abstract SortedSet<K> ascending_keys { owned get; }
46
47         /**
48          * Returns the entries in ascending order.
49          */
50         public abstract SortedSet<Map.Entry<K,V>> ascending_entries { owned get; }
51
52         /**
53          * The read-only view this map.
54          */
55         public new abstract SortedMap<K,V> read_only_view { owned get; }
56
57         /**
58          * Returns an immutable empty map.
59          *
60          * @return an immutable empty map
61          */
62         public static Map<K,V> empty<K,V> () {
63                 return new TreeMap<K,V> ().read_only_view;
64         }
65 }
66