1 /* readonlysortedmap.vala
3 * Copyright (C) 2009-2011 Maciej Piechotka
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.
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.
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
20 * Maciej Piechotka <uzytkownik2@gmail.com>
24 * Read-only view for {@link SortedMap} collections.
26 * This class decorates any class which implements the {@link SortedMap} interface
27 * by making it read only. Any method which normally modify data will throw an
32 internal class Gee.ReadOnlySortedMap<K,V> : ReadOnlyMap<K,V>, SortedMap<K,V> {
34 * Constructs a read-only map that mirrors the content of the specified map.
36 * @param map the map to decorate.
38 public ReadOnlySortedMap (Map<K,V> map) {
45 public SortedMap<K,V> head_map (K before) {
46 return (_map as SortedMap<K,V>).head_map (before).read_only_view;
52 public SortedMap<K,V> tail_map (K after) {
53 return (_map as SortedMap<K,V>).tail_map (after).read_only_view;
59 public SortedMap<K,V> sub_map (K from, K to) {
60 return (_map as SortedMap<K,V>).sub_map (from, to).read_only_view;
66 public SortedSet<K> ascending_keys {
68 return (_map as SortedMap<K,V>).ascending_keys.read_only_view;
75 public SortedSet<Map.Entry<K,V>> ascending_entries {
77 return (_map as SortedMap<K,V>).ascending_entries.read_only_view;