~ubuntu-branches/ubuntu/maverick/vala/maverick

« back to all changes in this revision

Viewing changes to gee/readonlyset.vala

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2010-04-02 10:10:55 UTC
  • mfrom: (1.4.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20100402101055-qbx3okzv0tnp3wpp
Tags: 0.8.0-0ubuntu1
* New upstream release:
  - Infer type arguments when calling generic methods.
  - Support `in' operator for arrays.
  - Add experimental support for regular expression literals.
  - Add experimental support for chained relational expressions.
  - Add va_list support.
  - Add clutter-gtk-0.10 bindings (Gordon Allott).
  - Add gdl-1.0 bindings (Nicolas Joseph).
  - Add gstreamer-app-0.10 bindings (Sebastian Dröge).
  - Add gstreamer-cdda-0.10 bindings (Sebastian Dröge).
  - Add gudev-1.0 bindings (Jim Nelson).
  - Add libgda-report-4.0 bindings (Shawn Ferris).
  - Add libgvc (graphviz) bindings (Martin Olsson).
  - Add purple bindings (Adrien Bustany).
  - Many bug fixes and binding updates.
* debian/patches/99_ltmain_as-needed.patch: refreshed

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* readonlyset.vala
2
 
 *
3
 
 * Copyright (C) 2007-2008  Jürg Billeter
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
 
 *      Jürg Billeter <j@bitron.ch>
21
 
 */
22
 
 
23
 
using GLib;
24
 
 
25
 
/**
26
 
 * Represents a read-only collection of items without duplicates.
27
 
 */
28
 
public class Vala.ReadOnlySet<G> : CollectionObject, Iterable<G>, Collection<G>, Set<G> {
29
 
        public int size {
30
 
                get { return _set.size; }
31
 
        }
32
 
 
33
 
        public Set<G> set {
34
 
                set { _set = value; }
35
 
        }
36
 
 
37
 
        private Set<G> _set;
38
 
 
39
 
        public ReadOnlySet (Set<G>? set = null) {
40
 
                this.set = set;
41
 
        }
42
 
 
43
 
        public Type get_element_type () {
44
 
                return typeof (G);
45
 
        }
46
 
 
47
 
        public Vala.Iterator<G> iterator () {
48
 
                if (_set == null) {
49
 
                        return new Iterator<G> ();
50
 
                }
51
 
 
52
 
                return _set.iterator ();
53
 
        }
54
 
 
55
 
        public bool contains (G item) {
56
 
                if (_set == null) {
57
 
                        return false;
58
 
                }
59
 
 
60
 
                return _set.contains (item);
61
 
        }
62
 
 
63
 
        public bool add (G item) {
64
 
                assert_not_reached ();
65
 
        }
66
 
 
67
 
        public bool remove (G item) {
68
 
                assert_not_reached ();
69
 
        }
70
 
 
71
 
        public void clear () {
72
 
                assert_not_reached ();
73
 
        }
74
 
 
75
 
        private class Iterator<G> : CollectionObject, Vala.Iterator<G> {
76
 
                public bool next () {
77
 
                        return false;
78
 
                }
79
 
 
80
 
                public G? get () {
81
 
                        return null;
82
 
                }
83
 
        }
84
 
}
85