[libgee] Add GenericAccessors attributes to interfaces and remove _impl methods.



commit 2e2b46d5089b413b7ecd3906a5f64a72c8f02b44
Author: Maciej Piechotka <uzytkownik2 gmail com>
Date:   Mon Jul 16 01:22:35 2012 -0700

    Add GenericAccessors attributes to interfaces and remove _impl methods.

 configure.ac                |    2 +-
 gee/abstractcollection.vala |    8 -----
 gee/abstractmap.vala        |   14 ----------
 gee/abstractmultiset.vala   |    8 -----
 gee/arraylist.vala          |    8 -----
 gee/arrayqueue.vala         |    8 -----
 gee/collection.vala         |    1 +
 gee/concurrentlist.vala     |    8 -----
 gee/hashmap.vala            |   24 -----------------
 gee/hashset.vala            |    8 -----
 gee/linkedlist.vala         |    8 -----
 gee/mapiterator.vala        |    1 +
 gee/priorityqueue.vala      |    8 -----
 gee/traversable.vala        |   60 +++++++++++++------------------------------
 gee/treemap.vala            |   48 ----------------------------------
 gee/treeset.vala            |   16 -----------
 gee/unfolditerator.vala     |    8 -----
 17 files changed, 21 insertions(+), 217 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index f8c7176..fe02ef9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -14,7 +14,7 @@ AC_PROG_LIBTOOL
 LIBGEE_LT_VERSION="0:0:0"
 AC_SUBST(LIBGEE_LT_VERSION)
 
-AM_PROG_VALAC([0.14.0])
+AM_PROG_VALAC([0.17.4])
 AC_SUBST(VALAC)
 
 AC_SUBST(VALAFLAGS)
diff --git a/gee/abstractcollection.vala b/gee/abstractcollection.vala
index e130fac..a31cf77 100644
--- a/gee/abstractcollection.vala
+++ b/gee/abstractcollection.vala
@@ -292,14 +292,6 @@ public abstract class Gee.AbstractCollection<G> : Object, Traversable<G>, Iterab
 		return iterator ().stream<A> ((owned) f);
 	}
 
-	public virtual Iterator<G> filter (owned Predicate<G> f) {
-		return Traversable.filter_impl<G> (this, (owned) f);
-	}
-
-	public virtual Iterator<G> chop (int offset, int length = -1) {
-		return Traversable.chop_impl<G> (this, offset, length);
-	}
-
 	private weak Collection<G> _read_only_view;
 
 	/**
diff --git a/gee/abstractmap.vala b/gee/abstractmap.vala
index 33a1ab6..e281f49 100644
--- a/gee/abstractmap.vala
+++ b/gee/abstractmap.vala
@@ -216,18 +216,4 @@ public abstract class Gee.AbstractMap<K,V> : Object, Traversable<Map.Entry<K,V>>
 	public virtual Iterator<A> stream<A> (owned StreamFunc<Map.Entry<K,V>, A> f) {
 		return iterator ().stream<A> ((owned) f);
 	}
-
-	/**
-	 * { inheritDoc}
-	 */
-	public virtual Iterator<Map.Entry<K,V>> filter (owned Predicate<Map.Entry<K,V>> f) {
-		return Traversable.filter_impl<Map.Entry<K,V>> (this, (owned)f);
-	}
-
-	/**
-	 * { inheritDoc}
-	 */
-	public virtual Iterator<Map.Entry<K,V>> chop (int offset, int length = -1) {
-		return Traversable.chop_impl<Map.Entry<K,V>> (this, offset, length);
-	}
 }
diff --git a/gee/abstractmultiset.vala b/gee/abstractmultiset.vala
index 147fb7e..1a5e55b 100644
--- a/gee/abstractmultiset.vala
+++ b/gee/abstractmultiset.vala
@@ -169,13 +169,5 @@ public abstract class Gee.AbstractMultiSet<G> : AbstractCollection<G>, MultiSet<
 		public Gee.Iterator<A> stream<A> (owned StreamFunc<A, G> f) {
 			return Gee.Iterator.stream_impl<G, A>(this, (owned)f);
 		}
-
-		public Gee.Iterator<G> filter (owned Predicate<G> f) {
-			return Traversable.filter_impl<G> (this, (owned)f);
-		}
-
-		public Gee.Iterator<G> chop (int offset, int length = -1) {
-			return Traversable.chop_impl<G> (this, offset, length);
-		}
 	}
 }
diff --git a/gee/arraylist.vala b/gee/arraylist.vala
index 17c9f6b..693130c 100644
--- a/gee/arraylist.vala
+++ b/gee/arraylist.vala
@@ -406,14 +406,6 @@ public class Gee.ArrayList<G> : AbstractBidirList<G> {
 		public Gee.Iterator<A> stream<A> (owned StreamFunc<A, G> f) {
 			return Gee.Iterator.stream_impl<G, A>(this, (owned)f);
 		}
-
-		public Gee.Iterator<G> filter (owned Predicate<G> f) {
-			return Traversable.filter_impl<G> (this, (owned)f);
-		}
-
-		public Gee.Iterator<G> chop (int offset, int length = -1) {
-			return Traversable.chop_impl<G> (this, offset, length);
-		}
 	}
 }
 
diff --git a/gee/arrayqueue.vala b/gee/arrayqueue.vala
index 4e08623..ab1743b 100644
--- a/gee/arrayqueue.vala
+++ b/gee/arrayqueue.vala
@@ -326,14 +326,6 @@ public class Gee.ArrayQueue<G> : Gee.AbstractQueue<G>, Deque<G> {
 			return Gee.Iterator.stream_impl<G, A> (this, (owned)f);
 		}
 
-		public Gee.Iterator<G> filter (owned Predicate<G> f) {
-			return Traversable.filter_impl<G> (this, (owned)f);
-		}
-
-		public Gee.Iterator<G> chop (int offset, int length = -1) {
-			return Traversable.chop_impl<G> (this, offset, length);
-		}
-
 		private ArrayQueue _queue;
 		private int _stamp;
 		private int _offset = -1;
diff --git a/gee/collection.vala b/gee/collection.vala
index 063858b..93238bd 100644
--- a/gee/collection.vala
+++ b/gee/collection.vala
@@ -23,6 +23,7 @@
 /**
  * A generic collection of objects.
  */
+[GenericAccessors]
 public interface Gee.Collection<G> : Iterable<G> {
 	/**
 	 * The number of items in this collection.
diff --git a/gee/concurrentlist.vala b/gee/concurrentlist.vala
index 03d14bb..2d35997 100644
--- a/gee/concurrentlist.vala
+++ b/gee/concurrentlist.vala
@@ -361,14 +361,6 @@ public class Gee.ConcurrentList<G> : AbstractList<G> {
 			return Gee.Iterator.stream_impl<G, A> (this, (owned)f);
 		}
 
-		public Gee.Iterator<G> filter (owned Predicate<G> f) {
-			return Traversable.filter_impl<G> (this, (owned)f);
-		}
-
-		public Gee.Iterator<G> chop (int offset, int length = -1) {
-			return Traversable.chop_impl<G> (this, offset, length);
-		}
-
 		private bool _started;
 		private bool _removed;
 		private int _index;
diff --git a/gee/hashmap.vala b/gee/hashmap.vala
index 16234c8..4096a90 100644
--- a/gee/hashmap.vala
+++ b/gee/hashmap.vala
@@ -572,14 +572,6 @@ public class Gee.HashMap<K,V> : Gee.AbstractMap<K,V> {
 		public Gee.Iterator<A> stream<A> (owned StreamFunc<A, K> f) {
 			return Gee.Iterator.stream_impl<K, A>(this, (owned)f);
 		}
-
-		public Gee.Iterator<K> filter (owned Predicate<K> f) {
-			return Traversable.filter_impl<K> (this, (owned)f);
-		}
-
-		public Gee.Iterator<K> chop (int offset, int length = -1) {
-			return Traversable.chop_impl<K> (this, offset, length);
-		}
 	}
 
 	private class MapIterator<K,V> : NodeIterator<K,V>, Gee.MapIterator<K,V> {
@@ -669,14 +661,6 @@ public class Gee.HashMap<K,V> : Gee.AbstractMap<K,V> {
 		public Gee.Iterator<A> stream<A> (owned StreamFunc<A, V> f) {
 			return Gee.Iterator.stream_impl<V, A>(this, (owned)f);
 		}
-
-		public Gee.Iterator<V> filter (owned Predicate<V> f) {
-			return Traversable.filter_impl<V> (this, (owned)f);
-		}
-
-		public Gee.Iterator<V> chop (int offset, int length = -1) {
-			return Traversable.chop_impl<V> (this, offset, length);
-		}
 	}
 
 	private class EntryIterator<K,V> : NodeIterator<K,V>, Traversable<Map.Entry<K,V>>, Iterator<Map.Entry<K,V>> {
@@ -720,14 +704,6 @@ public class Gee.HashMap<K,V> : Gee.AbstractMap<K,V> {
 		public Gee.Iterator<A> stream<A> (owned StreamFunc<Map.Entry<K,V>, A> f) {
 			return Gee.Iterator.stream_impl<Map.Entry<K,V>, A>(this, (owned)f);
 		}
-
-		public Gee.Iterator<Map.Entry<K,V>> filter (owned Predicate<Map.Entry<K,V>> f) {
-			return Traversable.filter_impl<Map.Entry<K,V>> (this, (owned)f);
-		}
-
-		public Iterator<Map.Entry<K,V>> chop (int offset, int length = -1) {
-			return Traversable.chop_impl<Map.Entry<K,V>> (this, offset, length);
-		}
 	}
 }
 
diff --git a/gee/hashset.vala b/gee/hashset.vala
index 427e84e..b17d415 100644
--- a/gee/hashset.vala
+++ b/gee/hashset.vala
@@ -309,14 +309,6 @@ public class Gee.HashSet<G> : AbstractSet<G> {
 		public Gee.Iterator<A> stream<A> (owned StreamFunc<A, G> f) {
 			return Gee.Iterator.stream_impl<G, A>(this, (owned)f);
 		}
-
-		public Gee.Iterator<G> filter (owned Predicate<G> f) {
-			return Traversable.filter_impl<G> (this, (owned)f);
-		}
-
-		public Gee.Iterator<G> chop (int offset, int length = -1) {
-			return Traversable.chop_impl<G> (this, offset, length);
-		}
 	}
 }
 
diff --git a/gee/linkedlist.vala b/gee/linkedlist.vala
index 7f7ef8a..2b7e4e4 100644
--- a/gee/linkedlist.vala
+++ b/gee/linkedlist.vala
@@ -627,14 +627,6 @@ public class Gee.LinkedList<G> : AbstractBidirList<G>, Queue<G>, Deque<G> {
 		public Gee.Iterator<A> stream<A> (owned StreamFunc<A, G> f) {
 			return Gee.Iterator.stream_impl<G, A>(this, (owned)f);
 		}
-
-		public Gee.Iterator<G> filter (owned Predicate<G> f) {
-			return Traversable.filter_impl<G> (this, (owned)f);
-		}
-
-		public Gee.Iterator<G> chop (int offset, int length = -1) {
-			return Traversable.chop_impl<G> (this, offset, length);
-		}
 	}
 
 	private unowned Node<G>? _get_node_at (int index) {
diff --git a/gee/mapiterator.vala b/gee/mapiterator.vala
index 80f94ef..a098b1d 100644
--- a/gee/mapiterator.vala
+++ b/gee/mapiterator.vala
@@ -38,6 +38,7 @@ namespace Gee {
  * will fail. After the next call to { link next}, they will
  * be defined again.
  */
+[GenericAccessors]
 public interface Gee.MapIterator<K,V> : Object {
 	/**
 	 * Advances to the next entry in the iteration.
diff --git a/gee/priorityqueue.vala b/gee/priorityqueue.vala
index 92e7f01..db7ce4e 100644
--- a/gee/priorityqueue.vala
+++ b/gee/priorityqueue.vala
@@ -1049,13 +1049,5 @@ public class Gee.PriorityQueue<G> : Gee.AbstractQueue<G> {
 		public Gee.Iterator<A> stream<A> (owned StreamFunc<A, G> f) {
 			return Gee.Iterator.stream_impl<G, A>(this, (owned)f);
 		}
-
-		public Gee.Iterator<G> filter (owned Predicate<G> f) {
-			return Traversable.filter_impl<G> (this, (owned)f);
-		}
-
-		public Gee.Iterator<G> chop (int offset, int length = -1) {
-			return Traversable.chop_impl<G> (this, offset, length);
-		}
 	}
 }
diff --git a/gee/traversable.vala b/gee/traversable.vala
index 82a46ab..c3d53bb 100644
--- a/gee/traversable.vala
+++ b/gee/traversable.vala
@@ -53,6 +53,7 @@ namespace Gee {
  *
  * @since 0.7.0
  */
+[GenericAccessors]
 public interface Gee.Traversable<G> : Object {
 	/**
 	 * Apply function to each element returned by iterator. 
@@ -215,8 +216,6 @@ public interface Gee.Traversable<G> : Object {
 	 * Creates a new iterator that contains only values that fullfills the
 	 * predicate.
 	 *
-	 * Note: There is implementation { link filter_impl}.
-	 *
 	 * Note: When the method is called on { link Iterator} using the parent
 	 *    iterator is not allowed befor the inner iterator
 	 *    { link Iterator.next} return false and then it points on its last
@@ -227,40 +226,8 @@ public interface Gee.Traversable<G> : Object {
 	 * @param f Folding function
 	 * @return Iterator containing values of subsequent values of seed
 	 */
-	public abstract Iterator<G> filter (owned Predicate<G> f);
-
-	/**
-	 * Creates a new iterator which contains elements from iterable. The
-	 * first argument states the offset i.e. number of elements the iterator
-	 * skips by default.
-	 *
-	 * Note: There is implementation { link chop_impl}.
-	 *
-	 * Note: In { link Iterator} implementation resulting iterator is
-	 *    { link Iterator.valid} when parent iterator is
-	 *    { link Iterator.valid} and the offset is 0. Using the parent
-	 *    iterator is not allowed before the inner iterator
-	 *    { link Iterator.next} return false and then it points on its last
-	 *    element.
-	 *
-	 * @param offset the offset to first element the iterator is pointing to
-	 * @param length maximum number of elements iterator may return. Negative
-	 *        value means that the number is unbounded
-	 */
-	public abstract Iterator<G> chop (int offset, int length = -1);
-
-
-	/**
-	 * Implementation based on { link stream} for { link filter}.
-	 *
-	 * @param input The current Traversable
-	 * @param pred Predicate
-	 * @return Filtered iterator
-	 * @see filter
-	 * @see stream
-	 */
-	public static Iterator<G> filter_impl<G> (Traversable<G> input, owned Predicate<G> pred) {
-		return input.stream<G> ((state, item, out val) => {
+	public virtual Iterator<G> filter (owned Predicate<G> pred) {
+		return stream<G> ((state, item, out val) => {
 			switch (state) {
 			case Stream.YIELD:
 				val = null;
@@ -284,15 +251,24 @@ public interface Gee.Traversable<G> : Object {
 	}
 
 	/**
-	 * Implementation based on { link stream} for { link filter}.
+	 * Creates a new iterator which contains elements from iterable. The
+	 * first argument states the offset i.e. number of elements the iterator
+	 * skips by default.
+	 *
+	 * Note: In { link Iterator} implementation resulting iterator is
+	 *    { link Iterator.valid} when parent iterator is
+	 *    { link Iterator.valid} and the offset is 0. Using the parent
+	 *    iterator is not allowed before the inner iterator
+	 *    { link Iterator.next} return false and then it points on its last
+	 *    element.
 	 *
-	 * @param input The current Traversable
-	 * @param offset The offset
-	 * @param length The length
+	 * @param offset the offset to first element the iterator is pointing to
+	 * @param length maximum number of elements iterator may return. Negative
+	 *        value means that the number is unbounded
 	 */
-	public static Iterator<G> chop_impl<G> (Traversable<G> input, int offset, int length) {
+	public virtual Iterator<G> chop (int offset, int length = -1) {
 		assert (offset >= 0);
-		return input.stream<G> ((state, item, out val) => {
+		return stream<G> ((state, item, out val) => {
 			switch (state) {
 			case Stream.YIELD:
 				val = null;
diff --git a/gee/treemap.vala b/gee/treemap.vala
index 236b839..bbe35c2 100644
--- a/gee/treemap.vala
+++ b/gee/treemap.vala
@@ -1654,14 +1654,6 @@ public class Gee.TreeMap<K,V> : Gee.AbstractBidirSortedMap<K,V> {
 		public Gee.Iterator<A> stream<A> (owned StreamFunc<A, K> f) {
 			return Gee.Iterator.stream_impl<K, A>(this, (owned)f);
 		}
-
-		public Gee.Iterator<K> filter (owned Predicate<K> f) {
-			return Traversable.filter_impl<K> (this, (owned)f);
-		}
-
-		public Gee.Iterator<K> chop (int offset, int length = -1) {
-			return Traversable.chop_impl<K> (this, offset, length);
-		}
 	}
 
 	private class SubKeyIterator<K,V> : SubNodeIterator<K,V>, Traversable<K>, Gee.Iterator<K>, BidirIterator<K> {
@@ -1692,14 +1684,6 @@ public class Gee.TreeMap<K,V> : Gee.AbstractBidirSortedMap<K,V> {
 		public Gee.Iterator<A> stream<A> (owned StreamFunc<A, K> f) {
 			return Gee.Iterator.stream_impl<K, A>(this, (owned)f);
 		}
-
-		public Gee.Iterator<K> filter (owned Predicate<K> f) {
-			return Traversable.filter_impl<K> (this, (owned)f);
-		}
-
-		public Gee.Iterator<K> chop (int offset, int length = -1) {
-			return Traversable.chop_impl<K> (this, offset, length);
-		}
 	}
 
 	private class ValueIterator<K,V> : NodeIterator<K,V>, Traversable<V>, Gee.Iterator<V>, Gee.BidirIterator<V> {
@@ -1742,14 +1726,6 @@ public class Gee.TreeMap<K,V> : Gee.AbstractBidirSortedMap<K,V> {
 		public Gee.Iterator<A> stream<A> (owned StreamFunc<A, V> f) {
 			return Gee.Iterator.stream_impl<V, A>(this, (owned)f);
 		}
-
-		public Gee.Iterator<V> filter (owned Predicate<V> f) {
-			return Traversable.filter_impl<V> (this, (owned)f);
-		}
-
-		public Gee.Iterator<V> chop (int offset, int length = -1) {
-			return Traversable.chop_impl<V> (this, offset, length);
-		}
 	}
 
 	private class SubValueIterator<K,V> : SubNodeIterator<K,V>, Traversable<V>, Gee.Iterator<V>, BidirIterator<V> {
@@ -1780,14 +1756,6 @@ public class Gee.TreeMap<K,V> : Gee.AbstractBidirSortedMap<K,V> {
 		public Gee.Iterator<A> stream<A> (owned StreamFunc<A, V> f) {
 			return Gee.Iterator.stream_impl<V, A>(this, (owned)f);
 		}
-
-		public Gee.Iterator<V> filter (owned Predicate<V> f) {
-			return Traversable.filter_impl<V> (this, (owned)f);
-		}
-
-		public Gee.Iterator<V> chop (int offset, int length = -1) {
-			return Traversable.chop_impl<V> (this, offset, length);
-		}
 	}
 
 	private class EntryIterator<K,V> : NodeIterator<K,V>, Traversable<Map.Entry<K, V>>, Gee.Iterator<Map.Entry<K,V>>, Gee.BidirIterator<Map.Entry<K,V>> {
@@ -1834,14 +1802,6 @@ public class Gee.TreeMap<K,V> : Gee.AbstractBidirSortedMap<K,V> {
 		public Gee.Iterator<A> stream<A> (owned StreamFunc<Map.Entry<K, V>, A> f) {
 			return Gee.Iterator.stream_impl<Map.Entry<K, V>, A>(this, (owned)f);
 		}
-
-		public Gee.Iterator<Map.Entry<K, V>> filter (owned Predicate<Map.Entry<K, V>> f) {
-			return Traversable.filter_impl<Map.Entry<K, V>> (this, (owned)f);
-		}
-
-		public Gee.Iterator<Map.Entry<K, V>> chop (int offset, int length = -1) {
-			return Traversable.chop_impl<Map.Entry<K, V>> (this, offset, length);
-		}
 	}
 
 	private class SubEntryIterator<K,V> : SubNodeIterator<K,V>, Traversable<Map.Entry<K, V>>, Gee.Iterator<Map.Entry<K,V>>, Gee.BidirIterator<Map.Entry<K,V>> {
@@ -1876,14 +1836,6 @@ public class Gee.TreeMap<K,V> : Gee.AbstractBidirSortedMap<K,V> {
 		public Gee.Iterator<A> stream<A> (owned StreamFunc<Map.Entry<K, V>, A> f) {
 			return Gee.Iterator.stream_impl<Map.Entry<K, V>, A>(this, (owned)f);
 		}
-
-		public Gee.Iterator<Map.Entry<K, V>> filter (owned Predicate<Map.Entry<K, V>> f) {
-			return Traversable.filter_impl<Map.Entry<K, V>> (this, (owned)f);
-		}
-
-		public Gee.Iterator<Map.Entry<K, V>> chop (int offset, int length = -1) {
-			return Traversable.chop_impl<Map.Entry<K, V>> (this, offset, length);
-		}
 	}
 
 	private class MapIterator<K,V> : NodeIterator<K,V>, Gee.MapIterator<K,V>, BidirMapIterator<K,V> {
diff --git a/gee/treeset.vala b/gee/treeset.vala
index 34b4f10..a066290 100644
--- a/gee/treeset.vala
+++ b/gee/treeset.vala
@@ -738,14 +738,6 @@ public class Gee.TreeSet<G> : AbstractBidirSortedSet<G> {
 			return Gee.Iterator.stream_impl<G, A>(this, (owned)f);
 		}
 
-		public Gee.Iterator<G> filter (owned Predicate<G> f) {
-			return Traversable.filter_impl<G> (this, (owned)f);
-		}
-
-		public Gee.Iterator<G> chop (int offset, int length = -1) {
-			return Traversable.chop_impl<G> (this, offset, length);
-		}
-
 		private weak Node<G>? current = null;
 		private weak Node<G>? _next = null;
 		private weak Node<G>? _prev = null;
@@ -1145,14 +1137,6 @@ public class Gee.TreeSet<G> : AbstractBidirSortedSet<G> {
 			return Gee.Iterator.stream_impl<G, A>(this, (owned)f);
 		}
 
-		public Gee.Iterator<G> filter (owned Predicate<G> f) {
-			return Traversable.filter_impl<G> (this, (owned)f);
-		}
-
-		public Gee.Iterator<G> chop (int offset, int length = -1) {
-			return Traversable.chop_impl<G> (this, offset, length);
-		}
-
 		private new TreeSet<G> set;
 		private Range<G> range;
 		private Iterator<G>? iterator = null;
diff --git a/gee/unfolditerator.vala b/gee/unfolditerator.vala
index fb8aa80..3a4c6c6 100644
--- a/gee/unfolditerator.vala
+++ b/gee/unfolditerator.vala
@@ -94,14 +94,6 @@ internal class Gee.UnfoldIterator<G> : Object, Traversable<G>, Iterator<G> {
 		return Iterator.stream_impl<G, A>(this, (owned)f);
 	}
 
-	public Iterator<G> filter (owned Predicate<G> f) {
-		return Traversable.filter_impl<G> (this, (owned)f);
-	}
-
-	public Iterator<G> chop (int offset, int length = -1) {
-		return Traversable.chop_impl<G> (this, offset, length);
-	}
-
 	private UnfoldFunc<G> _func;
 	private Lazy<G>? _current;
 	private Lazy<G>? _next;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]