Re: [Vala] Gee tests and extension proposal
- From: Quikee <quikee gmail com>
- To: vala-list gnome org
- Subject: Re: [Vala] Gee tests and extension proposal
- Date: Mon, 24 Mar 2008 00:04:54 +0100
On Sun, Mar 23, 2008 at 11:52 PM, Quikee <quikee gmail com> wrote:
Hello.
I have extended the tests in Gee library. Now they cover all methods
provided by the interfaces they extend so that future changes to the
library can be done without fear to break the behavior of those
methods. The extended tests are attached to this post.
I would also like to propose an extension to the interfaces in form of
additional convenient / often used methods. What I had in mind is
this:
Collection interface:
- void add_all(Collection) - Adds all items from the input collection
to this collection. Convenient for joining collections. Java also has
this on the interface of Collection.
- bool contains_all(Collection) - Checks if all items in the input
collection are present in this collection. Convenient for checking
items for example if "a" AND "b" exist in collection.
- bool contains_any(Collection) - Checks if any items in the input
collection are present in this collection. Convenient for checking
items for example if "a" OR "b" exist in collection.
- bool is_empty() - special state of a collection when it doesn't
contain any value. Added because it is clearer as list.size == 0.
List interface
- G first()
- G last() - First and last items are often special - it adds better
clarity to the algorithm if they don't need to be "addressed" as
list.get(0) or worse list.get(list.size -1).
Set interface
Map interface
- void set_all(Map) - Same as add_all for collections.
- expose Node<K,V> and make it possible to iterate through Nodes:
foreach (Node<int,int> item in map.get_nodes()) {
}
Iterators
- It would be convenient
Sorry. I hit the wrong button and sended an incomplete mail.
iterators
- It would be convenient to have a reverse iterator for lists which
would also allow to iterate backwards.
- class with special iterators/iterables that can iterate Forward /
Backwards, skip elements, iterate through enumerated list, generators
I have most of this already added to libgee however I want to discuss
this before I release a patch or anything.
Best regards,
Tomaz
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]