[libgee] Change ReadOnlySet to inherit from ReadOnlyCollection.
- From: Didier 'Ptitjes' Villevalois <dvillevalois src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [libgee] Change ReadOnlySet to inherit from ReadOnlyCollection.
- Date: Sun, 6 Sep 2009 23:09:03 +0000 (UTC)
commit 4ecdd2005db7c072dc0c7edf79167de40f43f7cb
Author: Tomaž Vajngerl <quikee gmail com>
Date: Mon Aug 3 22:09:24 2009 +0200
Change ReadOnlySet to inherit from ReadOnlyCollection.
Fixes part of bug 590677.
gee/readonlyset.vala | 127 +-------------------------------------------------
1 files changed, 2 insertions(+), 125 deletions(-)
---
diff --git a/gee/readonlyset.vala b/gee/readonlyset.vala
index ffe7f60..6bd5f72 100644
--- a/gee/readonlyset.vala
+++ b/gee/readonlyset.vala
@@ -31,30 +31,7 @@ using GLib;
*
* @see Gee.Set
*/
-public class Gee.ReadOnlySet<G> : Object, Iterable<G>, Collection<G>, Set<G> {
-
- /**
- * @inheritDoc
- */
- public int size {
- get { return _set.size; }
- }
-
- /**
- * @inheritDoc
- */
- public bool is_empty {
- get { return _set.is_empty; }
- }
-
- /**
- * The decorated set.
- */
- public new Set<G> set {
- construct { _set = value; }
- }
-
- private Set<G> _set;
+public class Gee.ReadOnlySet<G> : Gee.ReadOnlyCollection<G>, Set<G> {
/**
* Constructs a read-only set that mirrors the content of the specified set.
@@ -62,107 +39,7 @@ public class Gee.ReadOnlySet<G> : Object, Iterable<G>, Collection<G>, Set<G> {
* @param set the set to decorate.
*/
public ReadOnlySet (Set<G>? set = null) {
- this.set = set;
- }
-
- /**
- * @inheritDoc
- */
- public Type element_type {
- get { return typeof (G); }
- }
-
- /**
- * @inheritDoc
- */
- public Gee.Iterator<G> iterator () {
- if (_set == null) {
- return new Iterator<G> ();
- }
-
- return _set.iterator ();
- }
-
- /**
- * @inheritDoc
- */
- public bool contains (G item) {
- if (_set == null) {
- return false;
- }
-
- return _set.contains (item);
- }
-
- /**
- * Unimplemented method (read only set).
- */
- public bool add (G item) {
- assert_not_reached ();
- }
-
- /**
- * Unimplemented method (read only set).
- */
- public bool remove (G item) {
- assert_not_reached ();
- }
-
- /**
- * Unimplemented method (read only set).
- */
- public void clear () {
- assert_not_reached ();
- }
-
- /**
- * Unimplemented method (read only set).
- */
- public bool add_all (Collection<G> collection) {
- assert_not_reached ();
- }
-
- /**
- * @inheritDoc
- */
- public bool contains_all (Collection<G> collection) {
- foreach (G element in collection) {
- if (!contains (element)) {
- return false;
- }
- }
- return true;
- }
-
- /**
- * Unimplemented method (read only set).
- */
- public bool remove_all (Collection<G> collection) {
- assert_not_reached ();
- }
-
- /**
- * Unimplemented method (read only set).
- */
- public bool retain_all (Collection<G> collection) {
- assert_not_reached ();
- }
-
- /**
- * @inheritDoc
- */
- public G[] to_array() {
- return _set.to_array ();
- }
-
- private class Iterator<G> : Object, Gee.Iterator<G> {
- public bool next () {
- return false;
- }
-
- public new G? get () {
- return null;
- }
+ base(set);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]