6b5e6c6033803d68d6fcc4c7050ed1a28cfc9878
[profile/ivi/libgee.git] / gee / arraylist.c
1 /* arraylist.c generated by valac 0.18.0, the Vala compiler
2  * generated from arraylist.vala, do not modify */
3
4 /* arraylist.vala
5  *
6  * Copyright (C) 2004-2005  Novell, Inc
7  * Copyright (C) 2005  David Waite
8  * Copyright (C) 2007-2008  Jürg Billeter
9  * Copyright (C) 2009  Didier Villevalois
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Lesser General Public
13  * License as published by the Free Software Foundation; either
14  * version 2.1 of the License, or (at your option) any later version.
15
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19  * Lesser General Public License for more details.
20
21  * You should have received a copy of the GNU Lesser General Public
22  * License along with this library; if not, write to the Free Software
23  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
24  *
25  * Author:
26  *      Jürg Billeter <j@bitron.ch>
27  *      Didier 'Ptitjes Villevalois <ptitjes@free.fr>
28  */
29
30 #include <glib.h>
31 #include <glib-object.h>
32 #include <string.h>
33
34
35 #define GEE_TYPE_ITERABLE (gee_iterable_get_type ())
36 #define GEE_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERABLE, GeeIterable))
37 #define GEE_IS_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERABLE))
38 #define GEE_ITERABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERABLE, GeeIterableIface))
39
40 typedef struct _GeeIterable GeeIterable;
41 typedef struct _GeeIterableIface GeeIterableIface;
42
43 #define GEE_TYPE_ITERATOR (gee_iterator_get_type ())
44 #define GEE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERATOR, GeeIterator))
45 #define GEE_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERATOR))
46 #define GEE_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERATOR, GeeIteratorIface))
47
48 typedef struct _GeeIterator GeeIterator;
49 typedef struct _GeeIteratorIface GeeIteratorIface;
50
51 #define GEE_TYPE_COLLECTION (gee_collection_get_type ())
52 #define GEE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_COLLECTION, GeeCollection))
53 #define GEE_IS_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_COLLECTION))
54 #define GEE_COLLECTION_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_COLLECTION, GeeCollectionIface))
55
56 typedef struct _GeeCollection GeeCollection;
57 typedef struct _GeeCollectionIface GeeCollectionIface;
58
59 #define GEE_TYPE_ABSTRACT_COLLECTION (gee_abstract_collection_get_type ())
60 #define GEE_ABSTRACT_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection))
61 #define GEE_ABSTRACT_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollectionClass))
62 #define GEE_IS_ABSTRACT_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_COLLECTION))
63 #define GEE_IS_ABSTRACT_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_COLLECTION))
64 #define GEE_ABSTRACT_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollectionClass))
65
66 typedef struct _GeeAbstractCollection GeeAbstractCollection;
67 typedef struct _GeeAbstractCollectionClass GeeAbstractCollectionClass;
68 typedef struct _GeeAbstractCollectionPrivate GeeAbstractCollectionPrivate;
69
70 #define GEE_TYPE_LIST (gee_list_get_type ())
71 #define GEE_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_LIST, GeeList))
72 #define GEE_IS_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_LIST))
73 #define GEE_LIST_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_LIST, GeeListIface))
74
75 typedef struct _GeeList GeeList;
76 typedef struct _GeeListIface GeeListIface;
77
78 #define GEE_TYPE_BIDIR_ITERATOR (gee_bidir_iterator_get_type ())
79 #define GEE_BIDIR_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_BIDIR_ITERATOR, GeeBidirIterator))
80 #define GEE_IS_BIDIR_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_BIDIR_ITERATOR))
81 #define GEE_BIDIR_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_BIDIR_ITERATOR, GeeBidirIteratorIface))
82
83 typedef struct _GeeBidirIterator GeeBidirIterator;
84 typedef struct _GeeBidirIteratorIface GeeBidirIteratorIface;
85
86 #define GEE_TYPE_LIST_ITERATOR (gee_list_iterator_get_type ())
87 #define GEE_LIST_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_LIST_ITERATOR, GeeListIterator))
88 #define GEE_IS_LIST_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_LIST_ITERATOR))
89 #define GEE_LIST_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_LIST_ITERATOR, GeeListIteratorIface))
90
91 typedef struct _GeeListIterator GeeListIterator;
92 typedef struct _GeeListIteratorIface GeeListIteratorIface;
93
94 #define GEE_TYPE_ABSTRACT_LIST (gee_abstract_list_get_type ())
95 #define GEE_ABSTRACT_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_LIST, GeeAbstractList))
96 #define GEE_ABSTRACT_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_LIST, GeeAbstractListClass))
97 #define GEE_IS_ABSTRACT_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_LIST))
98 #define GEE_IS_ABSTRACT_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_LIST))
99 #define GEE_ABSTRACT_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_LIST, GeeAbstractListClass))
100
101 typedef struct _GeeAbstractList GeeAbstractList;
102 typedef struct _GeeAbstractListClass GeeAbstractListClass;
103 typedef struct _GeeAbstractListPrivate GeeAbstractListPrivate;
104
105 #define GEE_TYPE_ARRAY_LIST (gee_array_list_get_type ())
106 #define GEE_ARRAY_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ARRAY_LIST, GeeArrayList))
107 #define GEE_ARRAY_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ARRAY_LIST, GeeArrayListClass))
108 #define GEE_IS_ARRAY_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ARRAY_LIST))
109 #define GEE_IS_ARRAY_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ARRAY_LIST))
110 #define GEE_ARRAY_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ARRAY_LIST, GeeArrayListClass))
111
112 typedef struct _GeeArrayList GeeArrayList;
113 typedef struct _GeeArrayListClass GeeArrayListClass;
114 typedef struct _GeeArrayListPrivate GeeArrayListPrivate;
115
116 #define GEE_ARRAY_LIST_TYPE_ITERATOR (gee_array_list_iterator_get_type ())
117 #define GEE_ARRAY_LIST_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_ARRAY_LIST_TYPE_ITERATOR, GeeArrayListIterator))
118 #define GEE_ARRAY_LIST_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_ARRAY_LIST_TYPE_ITERATOR, GeeArrayListIteratorClass))
119 #define GEE_ARRAY_LIST_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_ARRAY_LIST_TYPE_ITERATOR))
120 #define GEE_ARRAY_LIST_IS_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_ARRAY_LIST_TYPE_ITERATOR))
121 #define GEE_ARRAY_LIST_ITERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_ARRAY_LIST_TYPE_ITERATOR, GeeArrayListIteratorClass))
122
123 typedef struct _GeeArrayListIterator GeeArrayListIterator;
124 typedef struct _GeeArrayListIteratorClass GeeArrayListIteratorClass;
125 #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
126 typedef struct _GeeArrayListIteratorPrivate GeeArrayListIteratorPrivate;
127 #define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
128
129 struct _GeeIteratorIface {
130         GTypeInterface parent_iface;
131         gboolean (*next) (GeeIterator* self);
132         gboolean (*has_next) (GeeIterator* self);
133         gboolean (*first) (GeeIterator* self);
134         gpointer (*get) (GeeIterator* self);
135         void (*remove) (GeeIterator* self);
136 };
137
138 struct _GeeIterableIface {
139         GTypeInterface parent_iface;
140         GeeIterator* (*iterator) (GeeIterable* self);
141         GType (*get_element_type) (GeeIterable* self);
142 };
143
144 struct _GeeCollectionIface {
145         GTypeInterface parent_iface;
146         gboolean (*contains) (GeeCollection* self, gconstpointer item);
147         gboolean (*add) (GeeCollection* self, gconstpointer item);
148         gboolean (*remove) (GeeCollection* self, gconstpointer item);
149         void (*clear) (GeeCollection* self);
150         gboolean (*add_all) (GeeCollection* self, GeeCollection* collection);
151         gboolean (*contains_all) (GeeCollection* self, GeeCollection* collection);
152         gboolean (*remove_all) (GeeCollection* self, GeeCollection* collection);
153         gboolean (*retain_all) (GeeCollection* self, GeeCollection* collection);
154         gpointer* (*to_array) (GeeCollection* self, int* result_length1);
155         gint (*get_size) (GeeCollection* self);
156         gboolean (*get_is_empty) (GeeCollection* self);
157         GeeCollection* (*get_read_only_view) (GeeCollection* self);
158 };
159
160 struct _GeeAbstractCollection {
161         GObject parent_instance;
162         GeeAbstractCollectionPrivate * priv;
163 };
164
165 struct _GeeAbstractCollectionClass {
166         GObjectClass parent_class;
167         gboolean (*contains) (GeeAbstractCollection* self, gconstpointer item);
168         gboolean (*add) (GeeAbstractCollection* self, gconstpointer item);
169         gboolean (*remove) (GeeAbstractCollection* self, gconstpointer item);
170         void (*clear) (GeeAbstractCollection* self);
171         gpointer* (*to_array) (GeeAbstractCollection* self, int* result_length1);
172         gboolean (*add_all) (GeeAbstractCollection* self, GeeCollection* collection);
173         gboolean (*contains_all) (GeeAbstractCollection* self, GeeCollection* collection);
174         gboolean (*remove_all) (GeeAbstractCollection* self, GeeCollection* collection);
175         gboolean (*retain_all) (GeeAbstractCollection* self, GeeCollection* collection);
176         GeeIterator* (*iterator) (GeeAbstractCollection* self);
177         gint (*get_size) (GeeAbstractCollection* self);
178         gboolean (*get_is_empty) (GeeAbstractCollection* self);
179         GeeCollection* (*get_read_only_view) (GeeAbstractCollection* self);
180 };
181
182 struct _GeeBidirIteratorIface {
183         GTypeInterface parent_iface;
184         gboolean (*previous) (GeeBidirIterator* self);
185         gboolean (*has_previous) (GeeBidirIterator* self);
186         gboolean (*last) (GeeBidirIterator* self);
187 };
188
189 struct _GeeListIteratorIface {
190         GTypeInterface parent_iface;
191         void (*set) (GeeListIterator* self, gconstpointer item);
192         void (*insert) (GeeListIterator* self, gconstpointer item);
193         void (*add) (GeeListIterator* self, gconstpointer item);
194         gint (*index) (GeeListIterator* self);
195 };
196
197 struct _GeeListIface {
198         GTypeInterface parent_iface;
199         GeeListIterator* (*list_iterator) (GeeList* self);
200         gpointer (*get) (GeeList* self, gint index);
201         void (*set) (GeeList* self, gint index, gconstpointer item);
202         gint (*index_of) (GeeList* self, gconstpointer item);
203         void (*insert) (GeeList* self, gint index, gconstpointer item);
204         gpointer (*remove_at) (GeeList* self, gint index);
205         GeeList* (*slice) (GeeList* self, gint start, gint stop);
206         gpointer (*first) (GeeList* self);
207         gpointer (*last) (GeeList* self);
208         void (*insert_all) (GeeList* self, gint index, GeeCollection* collection);
209         void (*sort) (GeeList* self, GCompareFunc compare_func);
210         GeeList* (*get_read_only_view) (GeeList* self);
211 };
212
213 struct _GeeAbstractList {
214         GeeAbstractCollection parent_instance;
215         GeeAbstractListPrivate * priv;
216 };
217
218 struct _GeeAbstractListClass {
219         GeeAbstractCollectionClass parent_class;
220         GeeListIterator* (*list_iterator) (GeeAbstractList* self);
221         gpointer (*get) (GeeAbstractList* self, gint index);
222         void (*set) (GeeAbstractList* self, gint index, gconstpointer item);
223         gint (*index_of) (GeeAbstractList* self, gconstpointer item);
224         void (*insert) (GeeAbstractList* self, gint index, gconstpointer item);
225         gpointer (*remove_at) (GeeAbstractList* self, gint index);
226         GeeList* (*slice) (GeeAbstractList* self, gint start, gint stop);
227         gpointer (*first) (GeeAbstractList* self);
228         gpointer (*last) (GeeAbstractList* self);
229         void (*insert_all) (GeeAbstractList* self, gint index, GeeCollection* collection);
230         GeeList* (*get_read_only_view) (GeeAbstractList* self);
231 };
232
233 struct _GeeArrayList {
234         GeeAbstractList parent_instance;
235         GeeArrayListPrivate * priv;
236         gpointer* _items;
237         gint _items_length1;
238         gint __items_size_;
239         gint _size;
240 };
241
242 struct _GeeArrayListClass {
243         GeeAbstractListClass parent_class;
244 };
245
246 struct _GeeArrayListPrivate {
247         GType g_type;
248         GBoxedCopyFunc g_dup_func;
249         GDestroyNotify g_destroy_func;
250         GEqualFunc _equal_func;
251         gint _stamp;
252 };
253
254 struct _GeeArrayListIterator {
255         GObject parent_instance;
256         GeeArrayListIteratorPrivate * priv;
257 };
258
259 struct _GeeArrayListIteratorClass {
260         GObjectClass parent_class;
261 };
262
263 struct _GeeArrayListIteratorPrivate {
264         GType g_type;
265         GBoxedCopyFunc g_dup_func;
266         GDestroyNotify g_destroy_func;
267         GeeArrayList* _list;
268         gint _index;
269         gboolean _removed;
270         gint _stamp;
271 };
272
273
274 static gpointer gee_array_list_parent_class = NULL;
275 static gpointer gee_array_list_iterator_parent_class = NULL;
276 static GeeIteratorIface* gee_array_list_iterator_gee_iterator_parent_iface = NULL;
277 static GeeBidirIteratorIface* gee_array_list_iterator_gee_bidir_iterator_parent_iface = NULL;
278 static GeeListIteratorIface* gee_array_list_iterator_gee_list_iterator_parent_iface = NULL;
279
280 GType gee_iterator_get_type (void) G_GNUC_CONST;
281 GType gee_iterable_get_type (void) G_GNUC_CONST;
282 GType gee_collection_get_type (void) G_GNUC_CONST;
283 GType gee_abstract_collection_get_type (void) G_GNUC_CONST;
284 GType gee_bidir_iterator_get_type (void) G_GNUC_CONST;
285 GType gee_list_iterator_get_type (void) G_GNUC_CONST;
286 GType gee_list_get_type (void) G_GNUC_CONST;
287 GType gee_abstract_list_get_type (void) G_GNUC_CONST;
288 GType gee_array_list_get_type (void) G_GNUC_CONST;
289 #define GEE_ARRAY_LIST_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_TYPE_ARRAY_LIST, GeeArrayListPrivate))
290 enum  {
291         GEE_ARRAY_LIST_DUMMY_PROPERTY,
292         GEE_ARRAY_LIST_G_TYPE,
293         GEE_ARRAY_LIST_G_DUP_FUNC,
294         GEE_ARRAY_LIST_G_DESTROY_FUNC,
295         GEE_ARRAY_LIST_SIZE,
296         GEE_ARRAY_LIST_EQUAL_FUNC
297 };
298 GeeArrayList* gee_array_list_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GEqualFunc equal_func);
299 GeeArrayList* gee_array_list_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GEqualFunc equal_func);
300 GeeAbstractList* gee_abstract_list_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func);
301 GEqualFunc gee_functions_get_equal_func_for (GType t);
302 static void gee_array_list_set_equal_func (GeeArrayList* self, GEqualFunc value);
303 static GeeIterator* gee_array_list_real_iterator (GeeAbstractCollection* base);
304 static GeeArrayListIterator* gee_array_list_iterator_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeArrayList* list);
305 static GeeArrayListIterator* gee_array_list_iterator_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeArrayList* list);
306 static GType gee_array_list_iterator_get_type (void) G_GNUC_CONST G_GNUC_UNUSED;
307 static GeeListIterator* gee_array_list_real_list_iterator (GeeAbstractList* base);
308 static gboolean gee_array_list_real_contains (GeeAbstractCollection* base, gconstpointer item);
309 gint gee_abstract_list_index_of (GeeAbstractList* self, gconstpointer item);
310 static gint gee_array_list_real_index_of (GeeAbstractList* base, gconstpointer item);
311 GEqualFunc gee_array_list_get_equal_func (GeeArrayList* self);
312 static gpointer gee_array_list_real_get (GeeAbstractList* base, gint index);
313 static void gee_array_list_real_set (GeeAbstractList* base, gint index, gconstpointer item);
314 static gboolean gee_array_list_real_add (GeeAbstractCollection* base, gconstpointer item);
315 static void gee_array_list_grow_if_needed (GeeArrayList* self, gint new_count);
316 static void gee_array_list_real_insert (GeeAbstractList* base, gint index, gconstpointer item);
317 static void gee_array_list_shift (GeeArrayList* self, gint start, gint delta);
318 static gboolean gee_array_list_real_remove (GeeAbstractCollection* base, gconstpointer item);
319 gpointer gee_abstract_list_remove_at (GeeAbstractList* self, gint index);
320 static gpointer gee_array_list_real_remove_at (GeeAbstractList* base, gint index);
321 static void gee_array_list_real_clear (GeeAbstractCollection* base);
322 static GeeList* gee_array_list_real_slice (GeeAbstractList* base, gint start, gint stop);
323 gboolean gee_abstract_collection_add (GeeAbstractCollection* self, gconstpointer item);
324 gpointer gee_abstract_list_get (GeeAbstractList* self, gint index);
325 static gboolean gee_array_list_real_add_all (GeeAbstractCollection* base, GeeCollection* collection);
326 gboolean gee_collection_get_is_empty (GeeCollection* self);
327 gint gee_collection_get_size (GeeCollection* self);
328 GeeIterator* gee_iterable_iterator (GeeIterable* self);
329 gboolean gee_iterator_next (GeeIterator* self);
330 gpointer gee_iterator_get (GeeIterator* self);
331 void gee_array_list_sort_with_data (GeeArrayList* self, GCompareDataFunc compare, void* compare_target);
332 void gee_tim_sort_sort_with_data (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeList* list, GCompareDataFunc compare_data, void* compare_data_target);
333 static void gee_array_list_set_capacity (GeeArrayList* self, gint value);
334 #define GEE_ARRAY_LIST_ITERATOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_ARRAY_LIST_TYPE_ITERATOR, GeeArrayListIteratorPrivate))
335 enum  {
336         GEE_ARRAY_LIST_ITERATOR_DUMMY_PROPERTY,
337         GEE_ARRAY_LIST_ITERATOR_G_TYPE,
338         GEE_ARRAY_LIST_ITERATOR_G_DUP_FUNC,
339         GEE_ARRAY_LIST_ITERATOR_G_DESTROY_FUNC
340 };
341 static gboolean gee_array_list_iterator_real_next (GeeIterator* base);
342 static gboolean gee_array_list_iterator_real_has_next (GeeIterator* base);
343 static gboolean gee_array_list_iterator_real_first (GeeIterator* base);
344 gint gee_abstract_collection_get_size (GeeAbstractCollection* self);
345 static gpointer gee_array_list_iterator_real_get (GeeIterator* base);
346 static void gee_array_list_iterator_real_remove (GeeIterator* base);
347 static gboolean gee_array_list_iterator_real_previous (GeeBidirIterator* base);
348 static gboolean gee_array_list_iterator_real_has_previous (GeeBidirIterator* base);
349 static gboolean gee_array_list_iterator_real_last (GeeBidirIterator* base);
350 static void gee_array_list_iterator_real_set (GeeListIterator* base, gconstpointer item);
351 static void gee_array_list_iterator_real_insert (GeeListIterator* base, gconstpointer item);
352 void gee_abstract_list_insert (GeeAbstractList* self, gint index, gconstpointer item);
353 static void gee_array_list_iterator_real_add (GeeListIterator* base, gconstpointer item);
354 static gint gee_array_list_iterator_real_index (GeeListIterator* base);
355 static void gee_array_list_iterator_finalize (GObject* obj);
356 static void _vala_gee_array_list_iterator_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
357 static void _vala_gee_array_list_iterator_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
358 static void gee_array_list_finalize (GObject* obj);
359 static void _vala_gee_array_list_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
360 static void _vala_gee_array_list_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
361 static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
362 static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
363 static void _vala_array_move (gpointer array, gsize element_size, gint src, gint dest, gint length);
364
365
366 /**
367  * Constructs a new, empty array list.
368  *
369  * If not provided, the function parameter is requested to the
370  * {@link Functions} function factory methods.
371  *
372  * @param equal_func an optional element equality testing function
373  */
374 GeeArrayList* gee_array_list_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GEqualFunc equal_func) {
375         GeeArrayList * self = NULL;
376         GEqualFunc _tmp0_;
377         GEqualFunc _tmp2_;
378         self = (GeeArrayList*) gee_abstract_list_construct (object_type, g_type, (GBoxedCopyFunc) g_dup_func, g_destroy_func);
379         self->priv->g_type = g_type;
380         self->priv->g_dup_func = g_dup_func;
381         self->priv->g_destroy_func = g_destroy_func;
382         _tmp0_ = equal_func;
383         if (_tmp0_ == NULL) {
384                 GEqualFunc _tmp1_ = NULL;
385                 _tmp1_ = gee_functions_get_equal_func_for (g_type);
386                 equal_func = _tmp1_;
387         }
388         _tmp2_ = equal_func;
389         gee_array_list_set_equal_func (self, _tmp2_);
390         return self;
391 }
392
393
394 GeeArrayList* gee_array_list_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GEqualFunc equal_func) {
395         return gee_array_list_construct (GEE_TYPE_ARRAY_LIST, g_type, g_dup_func, g_destroy_func, equal_func);
396 }
397
398
399 /**
400  * {@inheritDoc}
401  */
402 static GeeIterator* gee_array_list_real_iterator (GeeAbstractCollection* base) {
403         GeeArrayList * self;
404         GeeIterator* result = NULL;
405         GeeArrayListIterator* _tmp0_;
406         self = (GeeArrayList*) base;
407         _tmp0_ = gee_array_list_iterator_new (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, self);
408         result = (GeeIterator*) _tmp0_;
409         return result;
410 }
411
412
413 /**
414  * {@inheritDoc}
415  */
416 static GeeListIterator* gee_array_list_real_list_iterator (GeeAbstractList* base) {
417         GeeArrayList * self;
418         GeeListIterator* result = NULL;
419         GeeArrayListIterator* _tmp0_;
420         self = (GeeArrayList*) base;
421         _tmp0_ = gee_array_list_iterator_new (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, self);
422         result = (GeeListIterator*) _tmp0_;
423         return result;
424 }
425
426
427 /**
428  * {@inheritDoc}
429  */
430 static gboolean gee_array_list_real_contains (GeeAbstractCollection* base, gconstpointer item) {
431         GeeArrayList * self;
432         gboolean result = FALSE;
433         gconstpointer _tmp0_;
434         gint _tmp1_ = 0;
435         self = (GeeArrayList*) base;
436         _tmp0_ = item;
437         _tmp1_ = gee_abstract_list_index_of ((GeeAbstractList*) self, _tmp0_);
438         result = _tmp1_ != (-1);
439         return result;
440 }
441
442
443 /**
444  * {@inheritDoc}
445  */
446 static gint gee_array_list_real_index_of (GeeAbstractList* base, gconstpointer item) {
447         GeeArrayList * self;
448         gint result = 0;
449         self = (GeeArrayList*) base;
450         {
451                 gint index;
452                 index = 0;
453                 {
454                         gboolean _tmp0_;
455                         _tmp0_ = TRUE;
456                         while (TRUE) {
457                                 gboolean _tmp1_;
458                                 gint _tmp3_;
459                                 gint _tmp4_;
460                                 GEqualFunc _tmp5_;
461                                 GEqualFunc _tmp6_;
462                                 gpointer* _tmp7_;
463                                 gint _tmp7__length1;
464                                 gint _tmp8_;
465                                 gconstpointer _tmp9_;
466                                 gconstpointer _tmp10_;
467                                 gboolean _tmp11_ = FALSE;
468                                 _tmp1_ = _tmp0_;
469                                 if (!_tmp1_) {
470                                         gint _tmp2_;
471                                         _tmp2_ = index;
472                                         index = _tmp2_ + 1;
473                                 }
474                                 _tmp0_ = FALSE;
475                                 _tmp3_ = index;
476                                 _tmp4_ = self->_size;
477                                 if (!(_tmp3_ < _tmp4_)) {
478                                         break;
479                                 }
480                                 _tmp5_ = gee_array_list_get_equal_func (self);
481                                 _tmp6_ = _tmp5_;
482                                 _tmp7_ = self->_items;
483                                 _tmp7__length1 = self->_items_length1;
484                                 _tmp8_ = index;
485                                 _tmp9_ = _tmp7_[_tmp8_];
486                                 _tmp10_ = item;
487                                 _tmp11_ = _tmp6_ (_tmp9_, _tmp10_);
488                                 if (_tmp11_) {
489                                         result = index;
490                                         return result;
491                                 }
492                         }
493                 }
494         }
495         result = -1;
496         return result;
497 }
498
499
500 /**
501  * {@inheritDoc}
502  */
503 static gpointer gee_array_list_real_get (GeeAbstractList* base, gint index) {
504         GeeArrayList * self;
505         gpointer result = NULL;
506         gint _tmp0_;
507         gint _tmp1_;
508         gint _tmp2_;
509         gpointer* _tmp3_;
510         gint _tmp3__length1;
511         gint _tmp4_;
512         gconstpointer _tmp5_;
513         gpointer _tmp6_;
514         self = (GeeArrayList*) base;
515         _tmp0_ = index;
516         _vala_assert (_tmp0_ >= 0, "index >= 0");
517         _tmp1_ = index;
518         _tmp2_ = self->_size;
519         _vala_assert (_tmp1_ < _tmp2_, "index < _size");
520         _tmp3_ = self->_items;
521         _tmp3__length1 = self->_items_length1;
522         _tmp4_ = index;
523         _tmp5_ = _tmp3_[_tmp4_];
524         _tmp6_ = ((_tmp5_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp5_) : ((gpointer) _tmp5_);
525         result = _tmp6_;
526         return result;
527 }
528
529
530 /**
531  * {@inheritDoc}
532  */
533 static void gee_array_list_real_set (GeeAbstractList* base, gint index, gconstpointer item) {
534         GeeArrayList * self;
535         gint _tmp0_;
536         gint _tmp1_;
537         gint _tmp2_;
538         gpointer* _tmp3_;
539         gint _tmp3__length1;
540         gint _tmp4_;
541         gconstpointer _tmp5_;
542         gpointer _tmp6_;
543         gpointer _tmp7_;
544         self = (GeeArrayList*) base;
545         _tmp0_ = index;
546         _vala_assert (_tmp0_ >= 0, "index >= 0");
547         _tmp1_ = index;
548         _tmp2_ = self->_size;
549         _vala_assert (_tmp1_ < _tmp2_, "index < _size");
550         _tmp3_ = self->_items;
551         _tmp3__length1 = self->_items_length1;
552         _tmp4_ = index;
553         _tmp5_ = item;
554         _tmp6_ = ((_tmp5_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp5_) : ((gpointer) _tmp5_);
555         ((_tmp3_[_tmp4_] == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_tmp3_[_tmp4_] = (self->priv->g_destroy_func (_tmp3_[_tmp4_]), NULL));
556         _tmp3_[_tmp4_] = _tmp6_;
557         _tmp7_ = _tmp3_[_tmp4_];
558 }
559
560
561 /**
562  * {@inheritDoc}
563  */
564 static gboolean gee_array_list_real_add (GeeAbstractCollection* base, gconstpointer item) {
565         GeeArrayList * self;
566         gboolean result = FALSE;
567         gint _tmp0_;
568         gpointer* _tmp1_;
569         gint _tmp1__length1;
570         gpointer* _tmp2_;
571         gint _tmp2__length1;
572         gint _tmp3_;
573         gconstpointer _tmp4_;
574         gpointer _tmp5_;
575         gpointer _tmp6_;
576         gint _tmp7_;
577         self = (GeeArrayList*) base;
578         _tmp0_ = self->_size;
579         _tmp1_ = self->_items;
580         _tmp1__length1 = self->_items_length1;
581         if (_tmp0_ == _tmp1__length1) {
582                 gee_array_list_grow_if_needed (self, 1);
583         }
584         _tmp2_ = self->_items;
585         _tmp2__length1 = self->_items_length1;
586         _tmp3_ = self->_size;
587         self->_size = _tmp3_ + 1;
588         _tmp4_ = item;
589         _tmp5_ = ((_tmp4_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp4_) : ((gpointer) _tmp4_);
590         ((_tmp2_[_tmp3_] == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_tmp2_[_tmp3_] = (self->priv->g_destroy_func (_tmp2_[_tmp3_]), NULL));
591         _tmp2_[_tmp3_] = _tmp5_;
592         _tmp6_ = _tmp2_[_tmp3_];
593         _tmp7_ = self->priv->_stamp;
594         self->priv->_stamp = _tmp7_ + 1;
595         result = TRUE;
596         return result;
597 }
598
599
600 /**
601  * {@inheritDoc}
602  */
603 static void gee_array_list_real_insert (GeeAbstractList* base, gint index, gconstpointer item) {
604         GeeArrayList * self;
605         gint _tmp0_;
606         gint _tmp1_;
607         gint _tmp2_;
608         gint _tmp3_;
609         gpointer* _tmp4_;
610         gint _tmp4__length1;
611         gint _tmp5_;
612         gpointer* _tmp6_;
613         gint _tmp6__length1;
614         gint _tmp7_;
615         gconstpointer _tmp8_;
616         gpointer _tmp9_;
617         gpointer _tmp10_;
618         gint _tmp11_;
619         self = (GeeArrayList*) base;
620         _tmp0_ = index;
621         _vala_assert (_tmp0_ >= 0, "index >= 0");
622         _tmp1_ = index;
623         _tmp2_ = self->_size;
624         _vala_assert (_tmp1_ <= _tmp2_, "index <= _size");
625         _tmp3_ = self->_size;
626         _tmp4_ = self->_items;
627         _tmp4__length1 = self->_items_length1;
628         if (_tmp3_ == _tmp4__length1) {
629                 gee_array_list_grow_if_needed (self, 1);
630         }
631         _tmp5_ = index;
632         gee_array_list_shift (self, _tmp5_, 1);
633         _tmp6_ = self->_items;
634         _tmp6__length1 = self->_items_length1;
635         _tmp7_ = index;
636         _tmp8_ = item;
637         _tmp9_ = ((_tmp8_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp8_) : ((gpointer) _tmp8_);
638         ((_tmp6_[_tmp7_] == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_tmp6_[_tmp7_] = (self->priv->g_destroy_func (_tmp6_[_tmp7_]), NULL));
639         _tmp6_[_tmp7_] = _tmp9_;
640         _tmp10_ = _tmp6_[_tmp7_];
641         _tmp11_ = self->priv->_stamp;
642         self->priv->_stamp = _tmp11_ + 1;
643 }
644
645
646 /**
647  * {@inheritDoc}
648  */
649 static gboolean gee_array_list_real_remove (GeeAbstractCollection* base, gconstpointer item) {
650         GeeArrayList * self;
651         gboolean result = FALSE;
652         self = (GeeArrayList*) base;
653         {
654                 gint index;
655                 index = 0;
656                 {
657                         gboolean _tmp0_;
658                         _tmp0_ = TRUE;
659                         while (TRUE) {
660                                 gboolean _tmp1_;
661                                 gint _tmp3_;
662                                 gint _tmp4_;
663                                 GEqualFunc _tmp5_;
664                                 GEqualFunc _tmp6_;
665                                 gpointer* _tmp7_;
666                                 gint _tmp7__length1;
667                                 gint _tmp8_;
668                                 gconstpointer _tmp9_;
669                                 gconstpointer _tmp10_;
670                                 gboolean _tmp11_ = FALSE;
671                                 _tmp1_ = _tmp0_;
672                                 if (!_tmp1_) {
673                                         gint _tmp2_;
674                                         _tmp2_ = index;
675                                         index = _tmp2_ + 1;
676                                 }
677                                 _tmp0_ = FALSE;
678                                 _tmp3_ = index;
679                                 _tmp4_ = self->_size;
680                                 if (!(_tmp3_ < _tmp4_)) {
681                                         break;
682                                 }
683                                 _tmp5_ = gee_array_list_get_equal_func (self);
684                                 _tmp6_ = _tmp5_;
685                                 _tmp7_ = self->_items;
686                                 _tmp7__length1 = self->_items_length1;
687                                 _tmp8_ = index;
688                                 _tmp9_ = _tmp7_[_tmp8_];
689                                 _tmp10_ = item;
690                                 _tmp11_ = _tmp6_ (_tmp9_, _tmp10_);
691                                 if (_tmp11_) {
692                                         gint _tmp12_;
693                                         gpointer _tmp13_ = NULL;
694                                         gpointer _tmp14_;
695                                         _tmp12_ = index;
696                                         _tmp13_ = gee_abstract_list_remove_at ((GeeAbstractList*) self, _tmp12_);
697                                         _tmp14_ = _tmp13_;
698                                         ((_tmp14_ == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_tmp14_ = (self->priv->g_destroy_func (_tmp14_), NULL));
699                                         result = TRUE;
700                                         return result;
701                                 }
702                         }
703                 }
704         }
705         result = FALSE;
706         return result;
707 }
708
709
710 /**
711  * {@inheritDoc}
712  */
713 static gpointer gee_array_list_real_remove_at (GeeAbstractList* base, gint index) {
714         GeeArrayList * self;
715         gpointer result = NULL;
716         gint _tmp0_;
717         gint _tmp1_;
718         gint _tmp2_;
719         gpointer* _tmp3_;
720         gint _tmp3__length1;
721         gint _tmp4_;
722         gconstpointer _tmp5_;
723         gpointer _tmp6_;
724         gpointer item;
725         gpointer* _tmp7_;
726         gint _tmp7__length1;
727         gint _tmp8_;
728         gpointer _tmp9_;
729         gint _tmp10_;
730         gint _tmp11_;
731         self = (GeeArrayList*) base;
732         _tmp0_ = index;
733         _vala_assert (_tmp0_ >= 0, "index >= 0");
734         _tmp1_ = index;
735         _tmp2_ = self->_size;
736         _vala_assert (_tmp1_ < _tmp2_, "index < _size");
737         _tmp3_ = self->_items;
738         _tmp3__length1 = self->_items_length1;
739         _tmp4_ = index;
740         _tmp5_ = _tmp3_[_tmp4_];
741         _tmp6_ = ((_tmp5_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp5_) : ((gpointer) _tmp5_);
742         item = _tmp6_;
743         _tmp7_ = self->_items;
744         _tmp7__length1 = self->_items_length1;
745         _tmp8_ = index;
746         ((_tmp7_[_tmp8_] == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_tmp7_[_tmp8_] = (self->priv->g_destroy_func (_tmp7_[_tmp8_]), NULL));
747         _tmp7_[_tmp8_] = NULL;
748         _tmp9_ = _tmp7_[_tmp8_];
749         _tmp10_ = index;
750         gee_array_list_shift (self, _tmp10_ + 1, -1);
751         _tmp11_ = self->priv->_stamp;
752         self->priv->_stamp = _tmp11_ + 1;
753         result = item;
754         return result;
755 }
756
757
758 /**
759  * {@inheritDoc}
760  */
761 static void gee_array_list_real_clear (GeeAbstractCollection* base) {
762         GeeArrayList * self;
763         gint _tmp8_;
764         self = (GeeArrayList*) base;
765         {
766                 gint index;
767                 index = 0;
768                 {
769                         gboolean _tmp0_;
770                         _tmp0_ = TRUE;
771                         while (TRUE) {
772                                 gboolean _tmp1_;
773                                 gint _tmp3_;
774                                 gint _tmp4_;
775                                 gpointer* _tmp5_;
776                                 gint _tmp5__length1;
777                                 gint _tmp6_;
778                                 gpointer _tmp7_;
779                                 _tmp1_ = _tmp0_;
780                                 if (!_tmp1_) {
781                                         gint _tmp2_;
782                                         _tmp2_ = index;
783                                         index = _tmp2_ + 1;
784                                 }
785                                 _tmp0_ = FALSE;
786                                 _tmp3_ = index;
787                                 _tmp4_ = self->_size;
788                                 if (!(_tmp3_ < _tmp4_)) {
789                                         break;
790                                 }
791                                 _tmp5_ = self->_items;
792                                 _tmp5__length1 = self->_items_length1;
793                                 _tmp6_ = index;
794                                 ((_tmp5_[_tmp6_] == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_tmp5_[_tmp6_] = (self->priv->g_destroy_func (_tmp5_[_tmp6_]), NULL));
795                                 _tmp5_[_tmp6_] = NULL;
796                                 _tmp7_ = _tmp5_[_tmp6_];
797                         }
798                 }
799         }
800         self->_size = 0;
801         _tmp8_ = self->priv->_stamp;
802         self->priv->_stamp = _tmp8_ + 1;
803 }
804
805
806 /**
807  * {@inheritDoc}
808  */
809 static GeeList* gee_array_list_real_slice (GeeAbstractList* base, gint start, gint stop) {
810         GeeArrayList * self;
811         GeeList* result = NULL;
812         gint _tmp0_;
813         gint _tmp1_;
814         gint _tmp2_;
815         gint _tmp3_;
816         gint _tmp4_;
817         GEqualFunc _tmp5_;
818         GEqualFunc _tmp6_;
819         GeeArrayList* _tmp7_;
820         GeeArrayList* slice;
821         self = (GeeArrayList*) base;
822         _tmp0_ = start;
823         _tmp1_ = stop;
824         g_return_val_if_fail (_tmp0_ <= _tmp1_, NULL);
825         _tmp2_ = start;
826         g_return_val_if_fail (_tmp2_ >= 0, NULL);
827         _tmp3_ = stop;
828         _tmp4_ = self->_size;
829         g_return_val_if_fail (_tmp3_ <= _tmp4_, NULL);
830         _tmp5_ = gee_array_list_get_equal_func (self);
831         _tmp6_ = _tmp5_;
832         _tmp7_ = gee_array_list_new (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, _tmp6_);
833         slice = _tmp7_;
834         {
835                 gint _tmp8_;
836                 gint i;
837                 _tmp8_ = start;
838                 i = _tmp8_;
839                 {
840                         gboolean _tmp9_;
841                         _tmp9_ = TRUE;
842                         while (TRUE) {
843                                 gboolean _tmp10_;
844                                 gint _tmp12_;
845                                 gint _tmp13_;
846                                 GeeArrayList* _tmp14_;
847                                 gint _tmp15_;
848                                 gpointer _tmp16_ = NULL;
849                                 gpointer _tmp17_;
850                                 _tmp10_ = _tmp9_;
851                                 if (!_tmp10_) {
852                                         gint _tmp11_;
853                                         _tmp11_ = i;
854                                         i = _tmp11_ + 1;
855                                 }
856                                 _tmp9_ = FALSE;
857                                 _tmp12_ = i;
858                                 _tmp13_ = stop;
859                                 if (!(_tmp12_ < _tmp13_)) {
860                                         break;
861                                 }
862                                 _tmp14_ = slice;
863                                 _tmp15_ = i;
864                                 _tmp16_ = gee_abstract_list_get ((GeeAbstractList*) self, _tmp15_);
865                                 _tmp17_ = _tmp16_;
866                                 gee_abstract_collection_add ((GeeAbstractCollection*) _tmp14_, _tmp17_);
867                                 ((_tmp17_ == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_tmp17_ = (self->priv->g_destroy_func (_tmp17_), NULL));
868                         }
869                 }
870         }
871         result = (GeeList*) slice;
872         return result;
873 }
874
875
876 /**
877  * {@inheritDoc}
878  */
879 static gboolean gee_array_list_real_add_all (GeeAbstractCollection* base, GeeCollection* collection) {
880         GeeArrayList * self;
881         gboolean result = FALSE;
882         GeeCollection* _tmp0_;
883         gboolean _tmp1_;
884         gboolean _tmp2_;
885         GeeCollection* _tmp3_;
886         gint _tmp4_;
887         gint _tmp5_;
888         gint _tmp17_;
889         self = (GeeArrayList*) base;
890         g_return_val_if_fail (collection != NULL, FALSE);
891         _tmp0_ = collection;
892         _tmp1_ = gee_collection_get_is_empty (_tmp0_);
893         _tmp2_ = _tmp1_;
894         if (_tmp2_) {
895                 result = FALSE;
896                 return result;
897         }
898         _tmp3_ = collection;
899         _tmp4_ = gee_collection_get_size (_tmp3_);
900         _tmp5_ = _tmp4_;
901         gee_array_list_grow_if_needed (self, _tmp5_);
902         {
903                 GeeCollection* _tmp6_;
904                 GeeIterator* _tmp7_ = NULL;
905                 GeeIterator* _item_it;
906                 _tmp6_ = collection;
907                 _tmp7_ = gee_iterable_iterator ((GeeIterable*) _tmp6_);
908                 _item_it = _tmp7_;
909                 while (TRUE) {
910                         GeeIterator* _tmp8_;
911                         gboolean _tmp9_ = FALSE;
912                         GeeIterator* _tmp10_;
913                         gpointer _tmp11_ = NULL;
914                         gpointer item;
915                         gpointer* _tmp12_;
916                         gint _tmp12__length1;
917                         gint _tmp13_;
918                         gconstpointer _tmp14_;
919                         gpointer _tmp15_;
920                         gpointer _tmp16_;
921                         _tmp8_ = _item_it;
922                         _tmp9_ = gee_iterator_next (_tmp8_);
923                         if (!_tmp9_) {
924                                 break;
925                         }
926                         _tmp10_ = _item_it;
927                         _tmp11_ = gee_iterator_get (_tmp10_);
928                         item = _tmp11_;
929                         _tmp12_ = self->_items;
930                         _tmp12__length1 = self->_items_length1;
931                         _tmp13_ = self->_size;
932                         self->_size = _tmp13_ + 1;
933                         _tmp14_ = item;
934                         _tmp15_ = ((_tmp14_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp14_) : ((gpointer) _tmp14_);
935                         ((_tmp12_[_tmp13_] == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_tmp12_[_tmp13_] = (self->priv->g_destroy_func (_tmp12_[_tmp13_]), NULL));
936                         _tmp12_[_tmp13_] = _tmp15_;
937                         _tmp16_ = _tmp12_[_tmp13_];
938                         ((item == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (item = (self->priv->g_destroy_func (item), NULL));
939                 }
940                 _g_object_unref0 (_item_it);
941         }
942         _tmp17_ = self->priv->_stamp;
943         self->priv->_stamp = _tmp17_ + 1;
944         result = TRUE;
945         return result;
946 }
947
948
949 /**
950  * Sorts items by comparing with the specified compare function.
951  *
952  * @deprecated This method has only been added as hack and will be
953  * deprecated after the next odd minor version bump (>= 0.7.x).
954  *
955  * @param compare_func compare function to use to compare items
956  */
957 void gee_array_list_sort_with_data (GeeArrayList* self, GCompareDataFunc compare, void* compare_target) {
958         GCompareDataFunc _tmp0_;
959         void* _tmp0__target;
960         g_return_if_fail (self != NULL);
961         _tmp0_ = compare;
962         _tmp0__target = compare_target;
963         gee_tim_sort_sort_with_data (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, (GeeList*) self, _tmp0_, _tmp0__target);
964 }
965
966
967 static void gee_array_list_shift (GeeArrayList* self, gint start, gint delta) {
968         gint _tmp0_;
969         gint _tmp1_;
970         gint _tmp2_;
971         gint _tmp3_;
972         gint _tmp4_;
973         gint _tmp5_;
974         gint _tmp6_;
975         gint _tmp7_;
976         gint _tmp8_;
977         gint _tmp9_;
978         gint _tmp10_;
979         gint _tmp11_;
980         g_return_if_fail (self != NULL);
981         _tmp0_ = start;
982         _vala_assert (_tmp0_ >= 0, "start >= 0");
983         _tmp1_ = start;
984         _tmp2_ = self->_size;
985         _vala_assert (_tmp1_ <= _tmp2_, "start <= _size");
986         _tmp3_ = start;
987         _tmp4_ = delta;
988         _vala_assert (_tmp3_ >= (-_tmp4_), "start >= -delta");
989         _tmp5_ = start;
990         _tmp6_ = start;
991         _tmp7_ = delta;
992         _tmp8_ = self->_size;
993         _tmp9_ = start;
994         _vala_array_move (self->_items, sizeof (gpointer), _tmp5_, _tmp6_ + _tmp7_, _tmp8_ - _tmp9_);
995         _tmp10_ = self->_size;
996         _tmp11_ = delta;
997         self->_size = _tmp10_ + _tmp11_;
998 }
999
1000
1001 static void gee_array_list_grow_if_needed (GeeArrayList* self, gint new_count) {
1002         gint _tmp0_;
1003         gint _tmp1_;
1004         gint _tmp2_;
1005         gint minimum_size;
1006         gint _tmp3_;
1007         gpointer* _tmp4_;
1008         gint _tmp4__length1;
1009         g_return_if_fail (self != NULL);
1010         _tmp0_ = new_count;
1011         _vala_assert (_tmp0_ >= 0, "new_count >= 0");
1012         _tmp1_ = self->_size;
1013         _tmp2_ = new_count;
1014         minimum_size = _tmp1_ + _tmp2_;
1015         _tmp3_ = minimum_size;
1016         _tmp4_ = self->_items;
1017         _tmp4__length1 = self->_items_length1;
1018         if (_tmp3_ > _tmp4__length1) {
1019                 gint _tmp5_ = 0;
1020                 gint _tmp6_;
1021                 gpointer* _tmp7_;
1022                 gint _tmp7__length1;
1023                 gint _tmp10_;
1024                 _tmp6_ = new_count;
1025                 _tmp7_ = self->_items;
1026                 _tmp7__length1 = self->_items_length1;
1027                 if (_tmp6_ > _tmp7__length1) {
1028                         gint _tmp8_;
1029                         _tmp8_ = minimum_size;
1030                         _tmp5_ = _tmp8_;
1031                 } else {
1032                         gpointer* _tmp9_;
1033                         gint _tmp9__length1;
1034                         _tmp9_ = self->_items;
1035                         _tmp9__length1 = self->_items_length1;
1036                         _tmp5_ = 2 * _tmp9__length1;
1037                 }
1038                 _tmp10_ = _tmp5_;
1039                 gee_array_list_set_capacity (self, _tmp10_);
1040         }
1041 }
1042
1043
1044 static void gee_array_list_set_capacity (GeeArrayList* self, gint value) {
1045         gint _tmp0_;
1046         gint _tmp1_;
1047         gint _tmp2_;
1048         gint _tmp3_ = 0;
1049         g_return_if_fail (self != NULL);
1050         _tmp0_ = value;
1051         _tmp1_ = self->_size;
1052         _vala_assert (_tmp0_ >= _tmp1_, "value >= _size");
1053         _tmp2_ = value;
1054         _tmp3_ = _tmp2_;
1055         self->_items = g_renew (gpointer, self->_items, _tmp2_);
1056         (_tmp3_ > self->_items_length1) ? memset (self->_items + self->_items_length1, 0, sizeof (gpointer) * (_tmp3_ - self->_items_length1)) : NULL;
1057         self->_items_length1 = _tmp3_;
1058         self->__items_size_ = _tmp3_;
1059 }
1060
1061
1062 static gint gee_array_list_real_get_size (GeeAbstractCollection* base) {
1063         gint result;
1064         GeeArrayList* self;
1065         gint _tmp0_;
1066         self = (GeeArrayList*) base;
1067         _tmp0_ = self->_size;
1068         result = _tmp0_;
1069         return result;
1070 }
1071
1072
1073 GEqualFunc gee_array_list_get_equal_func (GeeArrayList* self) {
1074         GEqualFunc result;
1075         GEqualFunc _tmp0_;
1076         g_return_val_if_fail (self != NULL, NULL);
1077         _tmp0_ = self->priv->_equal_func;
1078         result = _tmp0_;
1079         return result;
1080 }
1081
1082
1083 static void gee_array_list_set_equal_func (GeeArrayList* self, GEqualFunc value) {
1084         GEqualFunc _tmp0_;
1085         g_return_if_fail (self != NULL);
1086         _tmp0_ = value;
1087         self->priv->_equal_func = _tmp0_;
1088         g_object_notify ((GObject *) self, "equal-func");
1089 }
1090
1091
1092 static gpointer _g_object_ref0 (gpointer self) {
1093         return self ? g_object_ref (self) : NULL;
1094 }
1095
1096
1097 static GeeArrayListIterator* gee_array_list_iterator_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeArrayList* list) {
1098         GeeArrayListIterator * self = NULL;
1099         GeeArrayList* _tmp0_;
1100         GeeArrayList* _tmp1_;
1101         GeeArrayList* _tmp2_;
1102         gint _tmp3_;
1103         g_return_val_if_fail (list != NULL, NULL);
1104         self = (GeeArrayListIterator*) g_object_new (object_type, NULL);
1105         self->priv->g_type = g_type;
1106         self->priv->g_dup_func = g_dup_func;
1107         self->priv->g_destroy_func = g_destroy_func;
1108         _tmp0_ = list;
1109         _tmp1_ = _g_object_ref0 (_tmp0_);
1110         _g_object_unref0 (self->priv->_list);
1111         self->priv->_list = _tmp1_;
1112         _tmp2_ = self->priv->_list;
1113         _tmp3_ = _tmp2_->priv->_stamp;
1114         self->priv->_stamp = _tmp3_;
1115         return self;
1116 }
1117
1118
1119 static GeeArrayListIterator* gee_array_list_iterator_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeArrayList* list) {
1120         return gee_array_list_iterator_construct (GEE_ARRAY_LIST_TYPE_ITERATOR, g_type, g_dup_func, g_destroy_func, list);
1121 }
1122
1123
1124 static gboolean gee_array_list_iterator_real_next (GeeIterator* base) {
1125         GeeArrayListIterator * self;
1126         gboolean result = FALSE;
1127         gint _tmp0_;
1128         GeeArrayList* _tmp1_;
1129         gint _tmp2_;
1130         gint _tmp3_;
1131         GeeArrayList* _tmp4_;
1132         gint _tmp5_;
1133         self = (GeeArrayListIterator*) base;
1134         _tmp0_ = self->priv->_stamp;
1135         _tmp1_ = self->priv->_list;
1136         _tmp2_ = _tmp1_->priv->_stamp;
1137         _vala_assert (_tmp0_ == _tmp2_, "_stamp == _list._stamp");
1138         _tmp3_ = self->priv->_index;
1139         _tmp4_ = self->priv->_list;
1140         _tmp5_ = _tmp4_->_size;
1141         if ((_tmp3_ + 1) < _tmp5_) {
1142                 gint _tmp6_;
1143                 _tmp6_ = self->priv->_index;
1144                 self->priv->_index = _tmp6_ + 1;
1145                 self->priv->_removed = FALSE;
1146                 result = TRUE;
1147                 return result;
1148         }
1149         result = FALSE;
1150         return result;
1151 }
1152
1153
1154 static gboolean gee_array_list_iterator_real_has_next (GeeIterator* base) {
1155         GeeArrayListIterator * self;
1156         gboolean result = FALSE;
1157         gint _tmp0_;
1158         GeeArrayList* _tmp1_;
1159         gint _tmp2_;
1160         gint _tmp3_;
1161         GeeArrayList* _tmp4_;
1162         gint _tmp5_;
1163         self = (GeeArrayListIterator*) base;
1164         _tmp0_ = self->priv->_stamp;
1165         _tmp1_ = self->priv->_list;
1166         _tmp2_ = _tmp1_->priv->_stamp;
1167         _vala_assert (_tmp0_ == _tmp2_, "_stamp == _list._stamp");
1168         _tmp3_ = self->priv->_index;
1169         _tmp4_ = self->priv->_list;
1170         _tmp5_ = _tmp4_->_size;
1171         result = (_tmp3_ + 1) < _tmp5_;
1172         return result;
1173 }
1174
1175
1176 static gboolean gee_array_list_iterator_real_first (GeeIterator* base) {
1177         GeeArrayListIterator * self;
1178         gboolean result = FALSE;
1179         gint _tmp0_;
1180         GeeArrayList* _tmp1_;
1181         gint _tmp2_;
1182         GeeArrayList* _tmp3_;
1183         gint _tmp4_;
1184         gint _tmp5_;
1185         self = (GeeArrayListIterator*) base;
1186         _tmp0_ = self->priv->_stamp;
1187         _tmp1_ = self->priv->_list;
1188         _tmp2_ = _tmp1_->priv->_stamp;
1189         _vala_assert (_tmp0_ == _tmp2_, "_stamp == _list._stamp");
1190         _tmp3_ = self->priv->_list;
1191         _tmp4_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp3_);
1192         _tmp5_ = _tmp4_;
1193         if (_tmp5_ == 0) {
1194                 result = FALSE;
1195                 return result;
1196         }
1197         self->priv->_index = 0;
1198         self->priv->_removed = FALSE;
1199         result = TRUE;
1200         return result;
1201 }
1202
1203
1204 static gpointer gee_array_list_iterator_real_get (GeeIterator* base) {
1205         GeeArrayListIterator * self;
1206         gpointer result = NULL;
1207         gint _tmp0_;
1208         GeeArrayList* _tmp1_;
1209         gint _tmp2_;
1210         gint _tmp3_;
1211         gint _tmp4_;
1212         GeeArrayList* _tmp5_;
1213         gint _tmp6_;
1214         gboolean _tmp7_;
1215         GeeArrayList* _tmp8_;
1216         gpointer* _tmp9_;
1217         gint _tmp9__length1;
1218         gint _tmp10_;
1219         gconstpointer _tmp11_;
1220         gpointer _tmp12_;
1221         self = (GeeArrayListIterator*) base;
1222         _tmp0_ = self->priv->_stamp;
1223         _tmp1_ = self->priv->_list;
1224         _tmp2_ = _tmp1_->priv->_stamp;
1225         _vala_assert (_tmp0_ == _tmp2_, "_stamp == _list._stamp");
1226         _tmp3_ = self->priv->_index;
1227         _vala_assert (_tmp3_ >= 0, "_index >= 0");
1228         _tmp4_ = self->priv->_index;
1229         _tmp5_ = self->priv->_list;
1230         _tmp6_ = _tmp5_->_size;
1231         _vala_assert (_tmp4_ < _tmp6_, "_index < _list._size");
1232         _tmp7_ = self->priv->_removed;
1233         _vala_assert (!_tmp7_, "! _removed");
1234         _tmp8_ = self->priv->_list;
1235         _tmp9_ = _tmp8_->_items;
1236         _tmp9__length1 = _tmp8_->_items_length1;
1237         _tmp10_ = self->priv->_index;
1238         _tmp11_ = _tmp9_[_tmp10_];
1239         _tmp12_ = ((_tmp11_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp11_) : ((gpointer) _tmp11_);
1240         result = _tmp12_;
1241         return result;
1242 }
1243
1244
1245 static void gee_array_list_iterator_real_remove (GeeIterator* base) {
1246         GeeArrayListIterator * self;
1247         gint _tmp0_;
1248         GeeArrayList* _tmp1_;
1249         gint _tmp2_;
1250         gint _tmp3_;
1251         gint _tmp4_;
1252         GeeArrayList* _tmp5_;
1253         gint _tmp6_;
1254         gboolean _tmp7_;
1255         GeeArrayList* _tmp8_;
1256         gint _tmp9_;
1257         gpointer _tmp10_ = NULL;
1258         gpointer _tmp11_;
1259         gint _tmp12_;
1260         GeeArrayList* _tmp13_;
1261         gint _tmp14_;
1262         self = (GeeArrayListIterator*) base;
1263         _tmp0_ = self->priv->_stamp;
1264         _tmp1_ = self->priv->_list;
1265         _tmp2_ = _tmp1_->priv->_stamp;
1266         _vala_assert (_tmp0_ == _tmp2_, "_stamp == _list._stamp");
1267         _tmp3_ = self->priv->_index;
1268         _vala_assert (_tmp3_ >= 0, "_index >= 0");
1269         _tmp4_ = self->priv->_index;
1270         _tmp5_ = self->priv->_list;
1271         _tmp6_ = _tmp5_->_size;
1272         _vala_assert (_tmp4_ < _tmp6_, "_index < _list._size");
1273         _tmp7_ = self->priv->_removed;
1274         _vala_assert (!_tmp7_, "! _removed");
1275         _tmp8_ = self->priv->_list;
1276         _tmp9_ = self->priv->_index;
1277         _tmp10_ = gee_abstract_list_remove_at ((GeeAbstractList*) _tmp8_, _tmp9_);
1278         _tmp11_ = _tmp10_;
1279         ((_tmp11_ == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_tmp11_ = (self->priv->g_destroy_func (_tmp11_), NULL));
1280         _tmp12_ = self->priv->_index;
1281         self->priv->_index = _tmp12_ - 1;
1282         self->priv->_removed = TRUE;
1283         _tmp13_ = self->priv->_list;
1284         _tmp14_ = _tmp13_->priv->_stamp;
1285         self->priv->_stamp = _tmp14_;
1286 }
1287
1288
1289 static gboolean gee_array_list_iterator_real_previous (GeeBidirIterator* base) {
1290         GeeArrayListIterator * self;
1291         gboolean result = FALSE;
1292         gint _tmp0_;
1293         GeeArrayList* _tmp1_;
1294         gint _tmp2_;
1295         gint _tmp3_;
1296         self = (GeeArrayListIterator*) base;
1297         _tmp0_ = self->priv->_stamp;
1298         _tmp1_ = self->priv->_list;
1299         _tmp2_ = _tmp1_->priv->_stamp;
1300         _vala_assert (_tmp0_ == _tmp2_, "_stamp == _list._stamp");
1301         _tmp3_ = self->priv->_index;
1302         if (_tmp3_ > 0) {
1303                 gint _tmp4_;
1304                 _tmp4_ = self->priv->_index;
1305                 self->priv->_index = _tmp4_ - 1;
1306                 result = TRUE;
1307                 return result;
1308         }
1309         result = FALSE;
1310         return result;
1311 }
1312
1313
1314 static gboolean gee_array_list_iterator_real_has_previous (GeeBidirIterator* base) {
1315         GeeArrayListIterator * self;
1316         gboolean result = FALSE;
1317         gint _tmp0_;
1318         GeeArrayList* _tmp1_;
1319         gint _tmp2_;
1320         gint _tmp3_;
1321         self = (GeeArrayListIterator*) base;
1322         _tmp0_ = self->priv->_stamp;
1323         _tmp1_ = self->priv->_list;
1324         _tmp2_ = _tmp1_->priv->_stamp;
1325         _vala_assert (_tmp0_ == _tmp2_, "_stamp == _list._stamp");
1326         _tmp3_ = self->priv->_index;
1327         result = (_tmp3_ - 1) >= 0;
1328         return result;
1329 }
1330
1331
1332 static gboolean gee_array_list_iterator_real_last (GeeBidirIterator* base) {
1333         GeeArrayListIterator * self;
1334         gboolean result = FALSE;
1335         gint _tmp0_;
1336         GeeArrayList* _tmp1_;
1337         gint _tmp2_;
1338         GeeArrayList* _tmp3_;
1339         gint _tmp4_;
1340         gint _tmp5_;
1341         GeeArrayList* _tmp6_;
1342         gint _tmp7_;
1343         self = (GeeArrayListIterator*) base;
1344         _tmp0_ = self->priv->_stamp;
1345         _tmp1_ = self->priv->_list;
1346         _tmp2_ = _tmp1_->priv->_stamp;
1347         _vala_assert (_tmp0_ == _tmp2_, "_stamp == _list._stamp");
1348         _tmp3_ = self->priv->_list;
1349         _tmp4_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp3_);
1350         _tmp5_ = _tmp4_;
1351         if (_tmp5_ == 0) {
1352                 result = FALSE;
1353                 return result;
1354         }
1355         _tmp6_ = self->priv->_list;
1356         _tmp7_ = _tmp6_->_size;
1357         self->priv->_index = _tmp7_ - 1;
1358         result = TRUE;
1359         return result;
1360 }
1361
1362
1363 static void gee_array_list_iterator_real_set (GeeListIterator* base, gconstpointer item) {
1364         GeeArrayListIterator * self;
1365         gint _tmp0_;
1366         GeeArrayList* _tmp1_;
1367         gint _tmp2_;
1368         gint _tmp3_;
1369         gint _tmp4_;
1370         GeeArrayList* _tmp5_;
1371         gint _tmp6_;
1372         GeeArrayList* _tmp7_;
1373         gpointer* _tmp8_;
1374         gint _tmp8__length1;
1375         gint _tmp9_;
1376         gconstpointer _tmp10_;
1377         gpointer _tmp11_;
1378         gpointer _tmp12_;
1379         GeeArrayList* _tmp13_;
1380         GeeArrayList* _tmp14_;
1381         gint _tmp15_;
1382         gint _tmp16_;
1383         self = (GeeArrayListIterator*) base;
1384         _tmp0_ = self->priv->_stamp;
1385         _tmp1_ = self->priv->_list;
1386         _tmp2_ = _tmp1_->priv->_stamp;
1387         _vala_assert (_tmp0_ == _tmp2_, "_stamp == _list._stamp");
1388         _tmp3_ = self->priv->_index;
1389         _vala_assert (_tmp3_ >= 0, "_index >= 0");
1390         _tmp4_ = self->priv->_index;
1391         _tmp5_ = self->priv->_list;
1392         _tmp6_ = _tmp5_->_size;
1393         _vala_assert (_tmp4_ < _tmp6_, "_index < _list._size");
1394         _tmp7_ = self->priv->_list;
1395         _tmp8_ = _tmp7_->_items;
1396         _tmp8__length1 = _tmp7_->_items_length1;
1397         _tmp9_ = self->priv->_index;
1398         _tmp10_ = item;
1399         _tmp11_ = ((_tmp10_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp10_) : ((gpointer) _tmp10_);
1400         ((_tmp8_[_tmp9_] == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_tmp8_[_tmp9_] = (self->priv->g_destroy_func (_tmp8_[_tmp9_]), NULL));
1401         _tmp8_[_tmp9_] = _tmp11_;
1402         _tmp12_ = _tmp8_[_tmp9_];
1403         _tmp13_ = self->priv->_list;
1404         _tmp14_ = self->priv->_list;
1405         _tmp15_ = _tmp14_->priv->_stamp;
1406         _tmp14_->priv->_stamp = _tmp15_ + 1;
1407         _tmp16_ = _tmp14_->priv->_stamp;
1408         self->priv->_stamp = _tmp16_;
1409 }
1410
1411
1412 static void gee_array_list_iterator_real_insert (GeeListIterator* base, gconstpointer item) {
1413         GeeArrayListIterator * self;
1414         gint _tmp0_;
1415         GeeArrayList* _tmp1_;
1416         gint _tmp2_;
1417         gint _tmp3_;
1418         gint _tmp4_;
1419         GeeArrayList* _tmp5_;
1420         gint _tmp6_;
1421         GeeArrayList* _tmp7_;
1422         gint _tmp8_;
1423         gconstpointer _tmp9_;
1424         gint _tmp10_;
1425         GeeArrayList* _tmp11_;
1426         gint _tmp12_;
1427         self = (GeeArrayListIterator*) base;
1428         _tmp0_ = self->priv->_stamp;
1429         _tmp1_ = self->priv->_list;
1430         _tmp2_ = _tmp1_->priv->_stamp;
1431         _vala_assert (_tmp0_ == _tmp2_, "_stamp == _list._stamp");
1432         _tmp3_ = self->priv->_index;
1433         _vala_assert (_tmp3_ >= 0, "_index >= 0");
1434         _tmp4_ = self->priv->_index;
1435         _tmp5_ = self->priv->_list;
1436         _tmp6_ = _tmp5_->_size;
1437         _vala_assert (_tmp4_ < _tmp6_, "_index < _list._size");
1438         _tmp7_ = self->priv->_list;
1439         _tmp8_ = self->priv->_index;
1440         _tmp9_ = item;
1441         gee_abstract_list_insert ((GeeAbstractList*) _tmp7_, _tmp8_, _tmp9_);
1442         _tmp10_ = self->priv->_index;
1443         self->priv->_index = _tmp10_ + 1;
1444         _tmp11_ = self->priv->_list;
1445         _tmp12_ = _tmp11_->priv->_stamp;
1446         self->priv->_stamp = _tmp12_;
1447 }
1448
1449
1450 static void gee_array_list_iterator_real_add (GeeListIterator* base, gconstpointer item) {
1451         GeeArrayListIterator * self;
1452         gint _tmp0_;
1453         GeeArrayList* _tmp1_;
1454         gint _tmp2_;
1455         gint _tmp3_;
1456         gint _tmp4_;
1457         GeeArrayList* _tmp5_;
1458         gint _tmp6_;
1459         GeeArrayList* _tmp7_;
1460         gint _tmp8_;
1461         gconstpointer _tmp9_;
1462         gint _tmp10_;
1463         GeeArrayList* _tmp11_;
1464         gint _tmp12_;
1465         self = (GeeArrayListIterator*) base;
1466         _tmp0_ = self->priv->_stamp;
1467         _tmp1_ = self->priv->_list;
1468         _tmp2_ = _tmp1_->priv->_stamp;
1469         _vala_assert (_tmp0_ == _tmp2_, "_stamp == _list._stamp");
1470         _tmp3_ = self->priv->_index;
1471         _vala_assert (_tmp3_ >= 0, "_index >= 0");
1472         _tmp4_ = self->priv->_index;
1473         _tmp5_ = self->priv->_list;
1474         _tmp6_ = _tmp5_->_size;
1475         _vala_assert (_tmp4_ < _tmp6_, "_index < _list._size");
1476         _tmp7_ = self->priv->_list;
1477         _tmp8_ = self->priv->_index;
1478         _tmp9_ = item;
1479         gee_abstract_list_insert ((GeeAbstractList*) _tmp7_, _tmp8_ + 1, _tmp9_);
1480         _tmp10_ = self->priv->_index;
1481         self->priv->_index = _tmp10_ + 1;
1482         _tmp11_ = self->priv->_list;
1483         _tmp12_ = _tmp11_->priv->_stamp;
1484         self->priv->_stamp = _tmp12_;
1485 }
1486
1487
1488 static gint gee_array_list_iterator_real_index (GeeListIterator* base) {
1489         GeeArrayListIterator * self;
1490         gint result = 0;
1491         gint _tmp0_;
1492         GeeArrayList* _tmp1_;
1493         gint _tmp2_;
1494         gint _tmp3_;
1495         gint _tmp4_;
1496         GeeArrayList* _tmp5_;
1497         gint _tmp6_;
1498         gint _tmp7_;
1499         self = (GeeArrayListIterator*) base;
1500         _tmp0_ = self->priv->_stamp;
1501         _tmp1_ = self->priv->_list;
1502         _tmp2_ = _tmp1_->priv->_stamp;
1503         _vala_assert (_tmp0_ == _tmp2_, "_stamp == _list._stamp");
1504         _tmp3_ = self->priv->_index;
1505         _vala_assert (_tmp3_ >= 0, "_index >= 0");
1506         _tmp4_ = self->priv->_index;
1507         _tmp5_ = self->priv->_list;
1508         _tmp6_ = _tmp5_->_size;
1509         _vala_assert (_tmp4_ < _tmp6_, "_index < _list._size");
1510         _tmp7_ = self->priv->_index;
1511         result = _tmp7_;
1512         return result;
1513 }
1514
1515
1516 static void gee_array_list_iterator_class_init (GeeArrayListIteratorClass * klass) {
1517         gee_array_list_iterator_parent_class = g_type_class_peek_parent (klass);
1518         g_type_class_add_private (klass, sizeof (GeeArrayListIteratorPrivate));
1519         G_OBJECT_CLASS (klass)->get_property = _vala_gee_array_list_iterator_get_property;
1520         G_OBJECT_CLASS (klass)->set_property = _vala_gee_array_list_iterator_set_property;
1521         G_OBJECT_CLASS (klass)->finalize = gee_array_list_iterator_finalize;
1522         g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ARRAY_LIST_ITERATOR_G_TYPE, g_param_spec_gtype ("g-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
1523         g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ARRAY_LIST_ITERATOR_G_DUP_FUNC, g_param_spec_pointer ("g-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
1524         g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ARRAY_LIST_ITERATOR_G_DESTROY_FUNC, g_param_spec_pointer ("g-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
1525 }
1526
1527
1528 static void gee_array_list_iterator_gee_iterator_interface_init (GeeIteratorIface * iface) {
1529         gee_array_list_iterator_gee_iterator_parent_iface = g_type_interface_peek_parent (iface);
1530         iface->next = (gboolean (*)(GeeIterator*)) gee_array_list_iterator_real_next;
1531         iface->has_next = (gboolean (*)(GeeIterator*)) gee_array_list_iterator_real_has_next;
1532         iface->first = (gboolean (*)(GeeIterator*)) gee_array_list_iterator_real_first;
1533         iface->get = (gpointer (*)(GeeIterator*)) gee_array_list_iterator_real_get;
1534         iface->remove = (void (*)(GeeIterator*)) gee_array_list_iterator_real_remove;
1535 }
1536
1537
1538 static void gee_array_list_iterator_gee_bidir_iterator_interface_init (GeeBidirIteratorIface * iface) {
1539         gee_array_list_iterator_gee_bidir_iterator_parent_iface = g_type_interface_peek_parent (iface);
1540         iface->previous = (gboolean (*)(GeeBidirIterator*)) gee_array_list_iterator_real_previous;
1541         iface->has_previous = (gboolean (*)(GeeBidirIterator*)) gee_array_list_iterator_real_has_previous;
1542         iface->last = (gboolean (*)(GeeBidirIterator*)) gee_array_list_iterator_real_last;
1543 }
1544
1545
1546 static void gee_array_list_iterator_gee_list_iterator_interface_init (GeeListIteratorIface * iface) {
1547         gee_array_list_iterator_gee_list_iterator_parent_iface = g_type_interface_peek_parent (iface);
1548         iface->set = (void (*)(GeeListIterator*, gconstpointer)) gee_array_list_iterator_real_set;
1549         iface->insert = (void (*)(GeeListIterator*, gconstpointer)) gee_array_list_iterator_real_insert;
1550         iface->add = (void (*)(GeeListIterator*, gconstpointer)) gee_array_list_iterator_real_add;
1551         iface->index = (gint (*)(GeeListIterator*)) gee_array_list_iterator_real_index;
1552 }
1553
1554
1555 static void gee_array_list_iterator_instance_init (GeeArrayListIterator * self) {
1556         self->priv = GEE_ARRAY_LIST_ITERATOR_GET_PRIVATE (self);
1557         self->priv->_index = -1;
1558         self->priv->_removed = FALSE;
1559         self->priv->_stamp = 0;
1560 }
1561
1562
1563 static void gee_array_list_iterator_finalize (GObject* obj) {
1564         GeeArrayListIterator * self;
1565         self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEE_ARRAY_LIST_TYPE_ITERATOR, GeeArrayListIterator);
1566         _g_object_unref0 (self->priv->_list);
1567         G_OBJECT_CLASS (gee_array_list_iterator_parent_class)->finalize (obj);
1568 }
1569
1570
1571 static GType gee_array_list_iterator_get_type (void) {
1572         static volatile gsize gee_array_list_iterator_type_id__volatile = 0;
1573         if (g_once_init_enter (&gee_array_list_iterator_type_id__volatile)) {
1574                 static const GTypeInfo g_define_type_info = { sizeof (GeeArrayListIteratorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_array_list_iterator_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeArrayListIterator), 0, (GInstanceInitFunc) gee_array_list_iterator_instance_init, NULL };
1575                 static const GInterfaceInfo gee_iterator_info = { (GInterfaceInitFunc) gee_array_list_iterator_gee_iterator_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
1576                 static const GInterfaceInfo gee_bidir_iterator_info = { (GInterfaceInitFunc) gee_array_list_iterator_gee_bidir_iterator_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
1577                 static const GInterfaceInfo gee_list_iterator_info = { (GInterfaceInitFunc) gee_array_list_iterator_gee_list_iterator_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
1578                 GType gee_array_list_iterator_type_id;
1579                 gee_array_list_iterator_type_id = g_type_register_static (G_TYPE_OBJECT, "GeeArrayListIterator", &g_define_type_info, 0);
1580                 g_type_add_interface_static (gee_array_list_iterator_type_id, GEE_TYPE_ITERATOR, &gee_iterator_info);
1581                 g_type_add_interface_static (gee_array_list_iterator_type_id, GEE_TYPE_BIDIR_ITERATOR, &gee_bidir_iterator_info);
1582                 g_type_add_interface_static (gee_array_list_iterator_type_id, GEE_TYPE_LIST_ITERATOR, &gee_list_iterator_info);
1583                 g_once_init_leave (&gee_array_list_iterator_type_id__volatile, gee_array_list_iterator_type_id);
1584         }
1585         return gee_array_list_iterator_type_id__volatile;
1586 }
1587
1588
1589 static void _vala_gee_array_list_iterator_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
1590         GeeArrayListIterator * self;
1591         self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_ARRAY_LIST_TYPE_ITERATOR, GeeArrayListIterator);
1592         switch (property_id) {
1593                 default:
1594                 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
1595                 break;
1596         }
1597 }
1598
1599
1600 static void _vala_gee_array_list_iterator_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
1601         GeeArrayListIterator * self;
1602         self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_ARRAY_LIST_TYPE_ITERATOR, GeeArrayListIterator);
1603         switch (property_id) {
1604                 case GEE_ARRAY_LIST_ITERATOR_G_TYPE:
1605                 self->priv->g_type = g_value_get_gtype (value);
1606                 break;
1607                 case GEE_ARRAY_LIST_ITERATOR_G_DUP_FUNC:
1608                 self->priv->g_dup_func = g_value_get_pointer (value);
1609                 break;
1610                 case GEE_ARRAY_LIST_ITERATOR_G_DESTROY_FUNC:
1611                 self->priv->g_destroy_func = g_value_get_pointer (value);
1612                 break;
1613                 default:
1614                 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
1615                 break;
1616         }
1617 }
1618
1619
1620 static void gee_array_list_class_init (GeeArrayListClass * klass) {
1621         gee_array_list_parent_class = g_type_class_peek_parent (klass);
1622         g_type_class_add_private (klass, sizeof (GeeArrayListPrivate));
1623         GEE_ABSTRACT_COLLECTION_CLASS (klass)->iterator = gee_array_list_real_iterator;
1624         GEE_ABSTRACT_LIST_CLASS (klass)->list_iterator = gee_array_list_real_list_iterator;
1625         GEE_ABSTRACT_COLLECTION_CLASS (klass)->contains = gee_array_list_real_contains;
1626         GEE_ABSTRACT_LIST_CLASS (klass)->index_of = gee_array_list_real_index_of;
1627         GEE_ABSTRACT_LIST_CLASS (klass)->get = gee_array_list_real_get;
1628         GEE_ABSTRACT_LIST_CLASS (klass)->set = gee_array_list_real_set;
1629         GEE_ABSTRACT_COLLECTION_CLASS (klass)->add = gee_array_list_real_add;
1630         GEE_ABSTRACT_LIST_CLASS (klass)->insert = gee_array_list_real_insert;
1631         GEE_ABSTRACT_COLLECTION_CLASS (klass)->remove = gee_array_list_real_remove;
1632         GEE_ABSTRACT_LIST_CLASS (klass)->remove_at = gee_array_list_real_remove_at;
1633         GEE_ABSTRACT_COLLECTION_CLASS (klass)->clear = gee_array_list_real_clear;
1634         GEE_ABSTRACT_LIST_CLASS (klass)->slice = gee_array_list_real_slice;
1635         GEE_ABSTRACT_COLLECTION_CLASS (klass)->add_all = gee_array_list_real_add_all;
1636         GEE_ABSTRACT_COLLECTION_CLASS (klass)->get_size = gee_array_list_real_get_size;
1637         G_OBJECT_CLASS (klass)->get_property = _vala_gee_array_list_get_property;
1638         G_OBJECT_CLASS (klass)->set_property = _vala_gee_array_list_set_property;
1639         G_OBJECT_CLASS (klass)->finalize = gee_array_list_finalize;
1640         g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ARRAY_LIST_G_TYPE, g_param_spec_gtype ("g-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
1641         g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ARRAY_LIST_G_DUP_FUNC, g_param_spec_pointer ("g-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
1642         g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ARRAY_LIST_G_DESTROY_FUNC, g_param_spec_pointer ("g-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
1643         /**
1644          * {@inheritDoc}
1645          */
1646         g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ARRAY_LIST_SIZE, g_param_spec_int ("size", "size", "size", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
1647         /**
1648          * The elements' equality testing function.
1649          */
1650         g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ARRAY_LIST_EQUAL_FUNC, g_param_spec_pointer ("equal-func", "equal-func", "equal-func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
1651 }
1652
1653
1654 static void gee_array_list_instance_init (GeeArrayList * self) {
1655         gpointer* _tmp0_ = NULL;
1656         self->priv = GEE_ARRAY_LIST_GET_PRIVATE (self);
1657         _tmp0_ = g_new0 (gpointer, 4);
1658         self->_items = _tmp0_;
1659         self->_items_length1 = 4;
1660         self->__items_size_ = self->_items_length1;
1661         self->priv->_stamp = 0;
1662 }
1663
1664
1665 static void gee_array_list_finalize (GObject* obj) {
1666         GeeArrayList * self;
1667         self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEE_TYPE_ARRAY_LIST, GeeArrayList);
1668         self->_items = (_vala_array_free (self->_items, self->_items_length1, (GDestroyNotify) self->priv->g_destroy_func), NULL);
1669         G_OBJECT_CLASS (gee_array_list_parent_class)->finalize (obj);
1670 }
1671
1672
1673 /**
1674  * Resizable array implementation of the {@link List} interface.
1675  *
1676  * The storage array grows automatically when needed.
1677  *
1678  * This implementation is pretty good for rarely modified data. Because they are
1679  * stored in an array this structure does not fit for highly mutable data. For an
1680  * alternative implementation see {@link LinkedList}.
1681  *
1682  * @see LinkedList
1683  */
1684 GType gee_array_list_get_type (void) {
1685         static volatile gsize gee_array_list_type_id__volatile = 0;
1686         if (g_once_init_enter (&gee_array_list_type_id__volatile)) {
1687                 static const GTypeInfo g_define_type_info = { sizeof (GeeArrayListClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_array_list_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeArrayList), 0, (GInstanceInitFunc) gee_array_list_instance_init, NULL };
1688                 GType gee_array_list_type_id;
1689                 gee_array_list_type_id = g_type_register_static (GEE_TYPE_ABSTRACT_LIST, "GeeArrayList", &g_define_type_info, 0);
1690                 g_once_init_leave (&gee_array_list_type_id__volatile, gee_array_list_type_id);
1691         }
1692         return gee_array_list_type_id__volatile;
1693 }
1694
1695
1696 static void _vala_gee_array_list_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
1697         GeeArrayList * self;
1698         self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_ARRAY_LIST, GeeArrayList);
1699         switch (property_id) {
1700                 case GEE_ARRAY_LIST_SIZE:
1701                 g_value_set_int (value, gee_abstract_collection_get_size ((GeeAbstractCollection*) self));
1702                 break;
1703                 case GEE_ARRAY_LIST_EQUAL_FUNC:
1704                 g_value_set_pointer (value, gee_array_list_get_equal_func (self));
1705                 break;
1706                 default:
1707                 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
1708                 break;
1709         }
1710 }
1711
1712
1713 static void _vala_gee_array_list_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
1714         GeeArrayList * self;
1715         self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_ARRAY_LIST, GeeArrayList);
1716         switch (property_id) {
1717                 case GEE_ARRAY_LIST_EQUAL_FUNC:
1718                 gee_array_list_set_equal_func (self, g_value_get_pointer (value));
1719                 break;
1720                 case GEE_ARRAY_LIST_G_TYPE:
1721                 self->priv->g_type = g_value_get_gtype (value);
1722                 break;
1723                 case GEE_ARRAY_LIST_G_DUP_FUNC:
1724                 self->priv->g_dup_func = g_value_get_pointer (value);
1725                 break;
1726                 case GEE_ARRAY_LIST_G_DESTROY_FUNC:
1727                 self->priv->g_destroy_func = g_value_get_pointer (value);
1728                 break;
1729                 default:
1730                 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
1731                 break;
1732         }
1733 }
1734
1735
1736 static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
1737         if ((array != NULL) && (destroy_func != NULL)) {
1738                 int i;
1739                 for (i = 0; i < array_length; i = i + 1) {
1740                         if (((gpointer*) array)[i] != NULL) {
1741                                 destroy_func (((gpointer*) array)[i]);
1742                         }
1743                 }
1744         }
1745 }
1746
1747
1748 static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
1749         _vala_array_destroy (array, array_length, destroy_func);
1750         g_free (array);
1751 }
1752
1753
1754 static void _vala_array_move (gpointer array, gsize element_size, gint src, gint dest, gint length) {
1755         g_memmove (((char*) array) + (dest * element_size), ((char*) array) + (src * element_size), length * element_size);
1756         if ((src < dest) && ((src + length) > dest)) {
1757                 memset (((char*) array) + (src * element_size), 0, (dest - src) * element_size);
1758         } else if ((src > dest) && (src < (dest + length))) {
1759                 memset (((char*) array) + ((dest + length) * element_size), 0, (src - dest) * element_size);
1760         } else if (src != dest) {
1761                 memset (((char*) array) + (src * element_size), 0, length * element_size);
1762         }
1763 }
1764
1765
1766