Update Changelog
[profile/ivi/libgee.git] / gee / traversable.c
1 /* traversable.c generated by valac 0.18.0, the Vala compiler
2  * generated from traversable.vala, do not modify */
3
4 /* traversable.vala
5  *
6  * Copyright (C) 2011-2012  Maciej Piechotka
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
21  *
22  * Author:
23  *      Maciej Piechotka <uzytkownik2@gmail.com>
24  */
25
26 #include <glib.h>
27 #include <glib-object.h>
28
29
30 #define GEE_TYPE_LAZY (gee_lazy_get_type ())
31 #define GEE_LAZY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_LAZY, GeeLazy))
32 #define GEE_LAZY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_LAZY, GeeLazyClass))
33 #define GEE_IS_LAZY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_LAZY))
34 #define GEE_IS_LAZY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_LAZY))
35 #define GEE_LAZY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_LAZY, GeeLazyClass))
36
37 typedef struct _GeeLazy GeeLazy;
38 typedef struct _GeeLazyClass GeeLazyClass;
39
40 #define GEE_TRAVERSABLE_TYPE_STREAM (gee_traversable_stream_get_type ())
41
42 #define GEE_TYPE_TRAVERSABLE (gee_traversable_get_type ())
43 #define GEE_TRAVERSABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TRAVERSABLE, GeeTraversable))
44 #define GEE_IS_TRAVERSABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TRAVERSABLE))
45 #define GEE_TRAVERSABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_TRAVERSABLE, GeeTraversableIface))
46
47 typedef struct _GeeTraversable GeeTraversable;
48 typedef struct _GeeTraversableIface GeeTraversableIface;
49
50 #define GEE_TYPE_ITERATOR (gee_iterator_get_type ())
51 #define GEE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERATOR, GeeIterator))
52 #define GEE_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERATOR))
53 #define GEE_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERATOR, GeeIteratorIface))
54
55 typedef struct _GeeIterator GeeIterator;
56 typedef struct _GeeIteratorIface GeeIteratorIface;
57 typedef struct _Block7Data Block7Data;
58 #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
59
60 #define GEE_TYPE_ITERABLE (gee_iterable_get_type ())
61 #define GEE_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERABLE, GeeIterable))
62 #define GEE_IS_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERABLE))
63 #define GEE_ITERABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERABLE, GeeIterableIface))
64
65 typedef struct _GeeIterable GeeIterable;
66 typedef struct _GeeIterableIface GeeIterableIface;
67 typedef struct _Block8Data Block8Data;
68 #define _gee_lazy_unref0(var) ((var == NULL) ? NULL : (var = (gee_lazy_unref (var), NULL)))
69 typedef struct _Block9Data Block9Data;
70 #define _a_destroy_func0(var) (((var == NULL) || (a_destroy_func == NULL)) ? NULL : (var = (a_destroy_func (var), NULL)))
71 typedef struct _Block10Data Block10Data;
72 typedef struct _Block11Data Block11Data;
73 typedef struct _Block12Data Block12Data;
74 typedef struct _Block13Data Block13Data;
75 typedef struct _Block14Data Block14Data;
76 typedef struct _Block15Data Block15Data;
77 typedef struct _Block16Data Block16Data;
78 #define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
79
80 typedef gpointer (*GeeFoldFunc) (gpointer g, gpointer a, void* user_data);
81 typedef gboolean (*GeeForallFunc) (gpointer g, void* user_data);
82 typedef GeeLazy* (*GeeUnfoldFunc) (void* user_data);
83 typedef enum  {
84         GEE_TRAVERSABLE_STREAM_YIELD,
85         GEE_TRAVERSABLE_STREAM_CONTINUE,
86         GEE_TRAVERSABLE_STREAM_END
87 } GeeTraversableStream;
88
89 typedef GeeTraversableStream (*GeeStreamFunc) (GeeTraversableStream state, GeeLazy* g, GeeLazy** lazy, void* user_data);
90 typedef gpointer (*GeeMapFunc) (gpointer g, void* user_data);
91 typedef gboolean (*GeePredicate) (gconstpointer g, void* user_data);
92 struct _GeeIteratorIface {
93         GTypeInterface parent_iface;
94         gboolean (*next) (GeeIterator* self);
95         gboolean (*has_next) (GeeIterator* self);
96         gpointer (*get) (GeeIterator* self);
97         void (*remove) (GeeIterator* self);
98         gboolean (*get_valid) (GeeIterator* self);
99         gboolean (*get_read_only) (GeeIterator* self);
100 };
101
102 struct _GeeTraversableIface {
103         GTypeInterface parent_iface;
104         GType (*get_g_type) (GeeTraversable* self);
105         GBoxedCopyFunc (*get_g_dup_func) (GeeTraversable* self);
106         GDestroyNotify (*get_g_destroy_func) (GeeTraversable* self);
107         gboolean (*foreach) (GeeTraversable* self, GeeForallFunc f, void* f_target);
108         GeeIterator* (*stream) (GeeTraversable* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeStreamFunc f, void* f_target, GDestroyNotify f_target_destroy_notify);
109         gpointer (*fold) (GeeTraversable* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeFoldFunc f, void* f_target, gpointer seed);
110         GeeIterator* (*map) (GeeTraversable* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeMapFunc f, void* f_target);
111         GeeIterator* (*scan) (GeeTraversable* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeFoldFunc f, void* f_target, gpointer seed);
112         GeeIterator* (*filter) (GeeTraversable* self, GeePredicate pred, void* pred_target, GDestroyNotify pred_target_destroy_notify);
113         GeeIterator* (*chop) (GeeTraversable* self, gint offset, gint length);
114         GType (*get_element_type) (GeeTraversable* self);
115 };
116
117 struct _Block7Data {
118         int _ref_count_;
119         GeeTraversable * self;
120         GType a_type;
121         GBoxedCopyFunc a_dup_func;
122         GDestroyNotify a_destroy_func;
123         GeeIterator* _self_;
124         GeeStreamFunc f;
125         gpointer f_target;
126         GDestroyNotify f_target_destroy_notify;
127 };
128
129 struct _GeeIterableIface {
130         GTypeInterface parent_iface;
131         GType (*get_g_type) (GeeIterable* self);
132         GBoxedCopyFunc (*get_g_dup_func) (GeeIterable* self);
133         GDestroyNotify (*get_g_destroy_func) (GeeIterable* self);
134         GeeIterator* (*iterator) (GeeIterable* self);
135 };
136
137 struct _Block8Data {
138         int _ref_count_;
139         Block7Data * _data7_;
140         GeeTraversableStream str;
141         gboolean need_next;
142 };
143
144 typedef gpointer (*GeeLazyFunc) (void* user_data);
145 struct _Block9Data {
146         int _ref_count_;
147         Block8Data * _data8_;
148 };
149
150 struct _Block10Data {
151         int _ref_count_;
152         GeeTraversable * self;
153         GType a_type;
154         GBoxedCopyFunc a_dup_func;
155         GDestroyNotify a_destroy_func;
156         GeeFoldFunc f;
157         gpointer f_target;
158         gpointer seed;
159 };
160
161 struct _Block11Data {
162         int _ref_count_;
163         GeeTraversable * self;
164         GType a_type;
165         GBoxedCopyFunc a_dup_func;
166         GDestroyNotify a_destroy_func;
167         GeeMapFunc f;
168         gpointer f_target;
169 };
170
171 struct _Block12Data {
172         int _ref_count_;
173         Block11Data * _data11_;
174         GeeLazy* item;
175 };
176
177 struct _Block13Data {
178         int _ref_count_;
179         GeeTraversable * self;
180         GType a_type;
181         GBoxedCopyFunc a_dup_func;
182         GDestroyNotify a_destroy_func;
183         gboolean seed_emitted;
184         GeeFoldFunc f;
185         gpointer f_target;
186         gpointer seed;
187 };
188
189 struct _Block14Data {
190         int _ref_count_;
191         Block13Data * _data13_;
192         GeeLazy* item;
193 };
194
195 struct _Block15Data {
196         int _ref_count_;
197         GeeTraversable * self;
198         GeePredicate pred;
199         gpointer pred_target;
200         GDestroyNotify pred_target_destroy_notify;
201 };
202
203 struct _Block16Data {
204         int _ref_count_;
205         GeeTraversable * self;
206         gint offset;
207         gint length;
208 };
209
210
211
212 gpointer gee_lazy_ref (gpointer instance);
213 void gee_lazy_unref (gpointer instance);
214 GParamSpec* gee_param_spec_lazy (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
215 void gee_value_set_lazy (GValue* value, gpointer v_object);
216 void gee_value_take_lazy (GValue* value, gpointer v_object);
217 gpointer gee_value_get_lazy (const GValue* value);
218 GType gee_lazy_get_type (void) G_GNUC_CONST;
219 GType gee_traversable_stream_get_type (void) G_GNUC_CONST;
220 GType gee_iterator_get_type (void) G_GNUC_CONST;
221 GType gee_traversable_get_type (void) G_GNUC_CONST;
222 gboolean gee_traversable_foreach (GeeTraversable* self, GeeForallFunc f, void* f_target);
223 GeeIterator* gee_traversable_stream (GeeTraversable* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeStreamFunc f, void* f_target, GDestroyNotify f_target_destroy_notify);
224 static GeeIterator* gee_traversable_real_stream (GeeTraversable* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeStreamFunc f, void* f_target, GDestroyNotify f_target_destroy_notify);
225 static Block7Data* block7_data_ref (Block7Data* _data7_);
226 static void block7_data_unref (void * _userdata_);
227 GType gee_iterable_get_type (void) G_GNUC_CONST;
228 static Block8Data* block8_data_ref (Block8Data* _data8_);
229 static void block8_data_unref (void * _userdata_);
230 gboolean gee_iterator_get_valid (GeeIterator* self);
231 static gpointer _____lambda3_ (Block8Data* _data8_);
232 gpointer gee_iterator_get (GeeIterator* self);
233 static gpointer ______lambda3__gee_lazy_func (gpointer self);
234 GeeLazy* gee_lazy_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeLazyFunc func, void* func_target, GDestroyNotify func_target_destroy_notify);
235 GeeLazy* gee_lazy_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeLazyFunc func, void* func_target, GDestroyNotify func_target_destroy_notify);
236 GeeIterator* gee_iterator_unfold (GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeUnfoldFunc f, void* f_target, GDestroyNotify f_target_destroy_notify, GeeLazy* current);
237 static GeeLazy* ______lambda4_ (Block8Data* _data8_);
238 static GeeLazy* _______lambda4__gee_unfold_func (gpointer self);
239 static GeeLazy* ____lambda5_ (Block8Data* _data8_);
240 static GeeLazy* _____lambda5__gee_unfold_func (gpointer self);
241 static GeeLazy* ___lambda6_ (Block8Data* _data8_);
242 static Block9Data* block9_data_ref (Block9Data* _data9_);
243 static void block9_data_unref (void * _userdata_);
244 gboolean gee_iterator_next (GeeIterator* self);
245 static gpointer ___lambda7_ (Block9Data* _data9_);
246 static gpointer ____lambda7__gee_lazy_func (gpointer self);
247 static GeeLazy* ____lambda6__gee_unfold_func (gpointer self);
248 GeeIterator* gee_iterable_iterator (GeeIterable* self);
249 gpointer gee_traversable_fold (GeeTraversable* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeFoldFunc f, void* f_target, gpointer seed);
250 static gpointer gee_traversable_real_fold (GeeTraversable* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeFoldFunc f, void* f_target, gpointer seed);
251 static Block10Data* block10_data_ref (Block10Data* _data10_);
252 static void block10_data_unref (void * _userdata_);
253 static gboolean __lambda8_ (Block10Data* _data10_, gpointer item);
254 static gboolean ___lambda8__gee_forall_func (gpointer g, gpointer self);
255 GeeIterator* gee_traversable_map (GeeTraversable* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeMapFunc f, void* f_target);
256 static GeeIterator* gee_traversable_real_map (GeeTraversable* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeMapFunc f, void* f_target);
257 static Block11Data* block11_data_ref (Block11Data* _data11_);
258 static void block11_data_unref (void * _userdata_);
259 static GeeTraversableStream __lambda9_ (Block11Data* _data11_, GeeTraversableStream state, GeeLazy* item, GeeLazy** val);
260 static Block12Data* block12_data_ref (Block12Data* _data12_);
261 static void block12_data_unref (void * _userdata_);
262 static gpointer ___lambda10_ (Block12Data* _data12_);
263 gpointer gee_lazy_get (GeeLazy* self);
264 static gpointer ____lambda10__gee_lazy_func (gpointer self);
265 static GeeTraversableStream ___lambda9__gee_stream_func (GeeTraversableStream state, GeeLazy* g, GeeLazy** lazy, gpointer self);
266 GeeIterator* gee_traversable_scan (GeeTraversable* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeFoldFunc f, void* f_target, gpointer seed);
267 static GeeIterator* gee_traversable_real_scan (GeeTraversable* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeFoldFunc f, void* f_target, gpointer seed);
268 static Block13Data* block13_data_ref (Block13Data* _data13_);
269 static void block13_data_unref (void * _userdata_);
270 static GeeTraversableStream __lambda11_ (Block13Data* _data13_, GeeTraversableStream state, GeeLazy* item, GeeLazy** val);
271 static Block14Data* block14_data_ref (Block14Data* _data14_);
272 static void block14_data_unref (void * _userdata_);
273 GeeLazy* gee_lazy_new_from_value (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, gconstpointer item);
274 GeeLazy* gee_lazy_construct_from_value (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, gconstpointer item);
275 static gpointer ___lambda12_ (Block14Data* _data14_);
276 static gpointer ____lambda12__gee_lazy_func (gpointer self);
277 static GeeTraversableStream ___lambda11__gee_stream_func (GeeTraversableStream state, GeeLazy* g, GeeLazy** lazy, gpointer self);
278 GeeIterator* gee_traversable_filter (GeeTraversable* self, GeePredicate pred, void* pred_target, GDestroyNotify pred_target_destroy_notify);
279 static GeeIterator* gee_traversable_real_filter (GeeTraversable* self, GeePredicate pred, void* pred_target, GDestroyNotify pred_target_destroy_notify);
280 static Block15Data* block15_data_ref (Block15Data* _data15_);
281 static void block15_data_unref (void * _userdata_);
282 static GeeTraversableStream __lambda13_ (Block15Data* _data15_, GeeTraversableStream state, GeeLazy* item, GeeLazy** val);
283 static GeeTraversableStream ___lambda13__gee_stream_func (GeeTraversableStream state, GeeLazy* g, GeeLazy** lazy, gpointer self);
284 GeeIterator* gee_traversable_chop (GeeTraversable* self, gint offset, gint length);
285 static GeeIterator* gee_traversable_real_chop (GeeTraversable* self, gint offset, gint length);
286 static Block16Data* block16_data_ref (Block16Data* _data16_);
287 static void block16_data_unref (void * _userdata_);
288 static GeeTraversableStream __lambda14_ (Block16Data* _data16_, GeeTraversableStream state, GeeLazy* item, GeeLazy** val);
289 static GeeTraversableStream ___lambda14__gee_stream_func (GeeTraversableStream state, GeeLazy* g, GeeLazy** lazy, gpointer self);
290 GType gee_traversable_get_element_type (GeeTraversable* self);
291
292
293 GType gee_traversable_stream_get_type (void) {
294         static volatile gsize gee_traversable_stream_type_id__volatile = 0;
295         if (g_once_init_enter (&gee_traversable_stream_type_id__volatile)) {
296                 static const GEnumValue values[] = {{GEE_TRAVERSABLE_STREAM_YIELD, "GEE_TRAVERSABLE_STREAM_YIELD", "yield"}, {GEE_TRAVERSABLE_STREAM_CONTINUE, "GEE_TRAVERSABLE_STREAM_CONTINUE", "continue"}, {GEE_TRAVERSABLE_STREAM_END, "GEE_TRAVERSABLE_STREAM_END", "end"}, {0, NULL, NULL}};
297                 GType gee_traversable_stream_type_id;
298                 gee_traversable_stream_type_id = g_enum_register_static ("GeeTraversableStream", values);
299                 g_once_init_leave (&gee_traversable_stream_type_id__volatile, gee_traversable_stream_type_id);
300         }
301         return gee_traversable_stream_type_id__volatile;
302 }
303
304
305 /**
306  * Apply function to each element returned by iterator untill last element
307  * or function return ''false''.
308  *
309  * ''{@link Iterator} implementation:'' Operation moves the iterator
310  * to last element in iteration or the first element that returned ''false''.
311  * If iterator points at some element it will be included in iteration.
312  *
313  * @param f function applied to every element of the collection
314  *
315  * @return ''false'' if the argument returned ''false'' at last invocation and
316  *         ''true'' otherwise.
317  */
318 gboolean gee_traversable_foreach (GeeTraversable* self, GeeForallFunc f, void* f_target) {
319         g_return_val_if_fail (self != NULL, FALSE);
320         return GEE_TRAVERSABLE_GET_INTERFACE (self)->foreach (self, f, f_target);
321 }
322
323
324 /**
325  * Stream function is an abstract function allowing writing many
326  * operations.
327  *
328  * The stream function accepts three parameter:
329  *
330  *   1. state. It is usually the last returned value from function but
331  *      it may be {@link Stream.END} when {@link Stream.CONTINUE} was
332  *      returned and there was no more elements.
333  *   1. input. It is valid only if first argument is
334  *      {@link Stream.CONTINUE}
335  *   1. output. It is valid only if result is Stream.YIELD
336  *
337  * It may return one of 3 results:
338  *
339  *   1. {@link Stream.YIELD}. It means that value was yielded and can
340  *      be passed to outgoing iterator.
341  *   1. {@link Stream.CONTINUE}. It means that the function needs to be
342  *      called with next element or with {@link Stream.END} if it is
343  *      end of stream). If the state element was Stream.END during the
344  *      current iteration function ''must not'' return {@link Stream.CONTINUE}
345  *   1. Stream.END. It means that the last argument was yielded.
346  *
347  * If the function yields the value immediately then the returning iterator
348  * is {@link Iterator.valid} and points to this value as well as in case when the
349  * parent iterator is {@link Iterator.valid} and function yields
350  * after consuming 1 input. In other case returned iterator is invalid.
351  *
352  * Note: In {@link Iterator} implementation: if iterator is
353  *    {@link Iterator.valid} the current value should be fed
354  *    immediately to function if during initial call function returns
355  *    {@link Stream.CONTINUE}. The parent iterator cannot be used before
356  *    the functions return {@link Stream.END} afterwards it points on the
357  *    last element consumed.
358  *
359  * @param f function generating stream
360  * @return iterator containing values yielded by stream
361  */
362 static Block7Data* block7_data_ref (Block7Data* _data7_) {
363         g_atomic_int_inc (&_data7_->_ref_count_);
364         return _data7_;
365 }
366
367
368 static void block7_data_unref (void * _userdata_) {
369         Block7Data* _data7_;
370         _data7_ = (Block7Data*) _userdata_;
371         if (g_atomic_int_dec_and_test (&_data7_->_ref_count_)) {
372                 GeeTraversable * self;
373                 GType a_type;
374                 GBoxedCopyFunc a_dup_func;
375                 GDestroyNotify a_destroy_func;
376                 self = _data7_->self;
377                 a_type = _data7_->a_type;
378                 a_dup_func = _data7_->a_dup_func;
379                 a_destroy_func = _data7_->a_destroy_func;
380                 _g_object_unref0 (_data7_->_self_);
381                 (_data7_->f_target_destroy_notify == NULL) ? NULL : (_data7_->f_target_destroy_notify (_data7_->f_target), NULL);
382                 _data7_->f = NULL;
383                 _data7_->f_target = NULL;
384                 _data7_->f_target_destroy_notify = NULL;
385                 _g_object_unref0 (self);
386                 g_slice_free (Block7Data, _data7_);
387         }
388 }
389
390
391 static gpointer _g_object_ref0 (gpointer self) {
392         return self ? g_object_ref (self) : NULL;
393 }
394
395
396 static Block8Data* block8_data_ref (Block8Data* _data8_) {
397         g_atomic_int_inc (&_data8_->_ref_count_);
398         return _data8_;
399 }
400
401
402 static void block8_data_unref (void * _userdata_) {
403         Block8Data* _data8_;
404         _data8_ = (Block8Data*) _userdata_;
405         if (g_atomic_int_dec_and_test (&_data8_->_ref_count_)) {
406                 GeeTraversable * self;
407                 GType a_type;
408                 GBoxedCopyFunc a_dup_func;
409                 GDestroyNotify a_destroy_func;
410                 self = _data8_->_data7_->self;
411                 a_type = _data8_->_data7_->a_type;
412                 a_dup_func = _data8_->_data7_->a_dup_func;
413                 a_destroy_func = _data8_->_data7_->a_destroy_func;
414                 block7_data_unref (_data8_->_data7_);
415                 _data8_->_data7_ = NULL;
416                 g_slice_free (Block8Data, _data8_);
417         }
418 }
419
420
421 static gpointer _____lambda3_ (Block8Data* _data8_) {
422         Block7Data* _data7_;
423         GeeTraversable * self;
424         GType a_type;
425         GBoxedCopyFunc a_dup_func;
426         GDestroyNotify a_destroy_func;
427         gpointer result = NULL;
428         GeeIterator* _tmp0_;
429         gpointer _tmp1_ = NULL;
430         _data7_ = _data8_->_data7_;
431         self = _data7_->self;
432         a_type = _data7_->a_type;
433         a_dup_func = _data7_->a_dup_func;
434         a_destroy_func = _data7_->a_destroy_func;
435         _tmp0_ = _data7_->_self_;
436         _tmp1_ = gee_iterator_get (_tmp0_);
437         result = _tmp1_;
438         return result;
439 }
440
441
442 static gpointer ______lambda3__gee_lazy_func (gpointer self) {
443         gpointer result;
444         result = _____lambda3_ (self);
445         return result;
446 }
447
448
449 static GeeLazy* ______lambda4_ (Block8Data* _data8_) {
450         Block7Data* _data7_;
451         GeeTraversable * self;
452         GType a_type;
453         GBoxedCopyFunc a_dup_func;
454         GDestroyNotify a_destroy_func;
455         GeeLazy* result = NULL;
456         _data7_ = _data8_->_data7_;
457         self = _data7_->self;
458         a_type = _data7_->a_type;
459         a_dup_func = _data7_->a_dup_func;
460         a_destroy_func = _data7_->a_destroy_func;
461         result = NULL;
462         return result;
463 }
464
465
466 static GeeLazy* _______lambda4__gee_unfold_func (gpointer self) {
467         GeeLazy* result;
468         result = ______lambda4_ (self);
469         return result;
470 }
471
472
473 static GeeLazy* ____lambda5_ (Block8Data* _data8_) {
474         Block7Data* _data7_;
475         GeeTraversable * self;
476         GType a_type;
477         GBoxedCopyFunc a_dup_func;
478         GDestroyNotify a_destroy_func;
479         GeeLazy* result = NULL;
480         _data7_ = _data8_->_data7_;
481         self = _data7_->self;
482         a_type = _data7_->a_type;
483         a_dup_func = _data7_->a_dup_func;
484         a_destroy_func = _data7_->a_destroy_func;
485         result = NULL;
486         return result;
487 }
488
489
490 static GeeLazy* _____lambda5__gee_unfold_func (gpointer self) {
491         GeeLazy* result;
492         result = ____lambda5_ (self);
493         return result;
494 }
495
496
497 static Block9Data* block9_data_ref (Block9Data* _data9_) {
498         g_atomic_int_inc (&_data9_->_ref_count_);
499         return _data9_;
500 }
501
502
503 static void block9_data_unref (void * _userdata_) {
504         Block9Data* _data9_;
505         _data9_ = (Block9Data*) _userdata_;
506         if (g_atomic_int_dec_and_test (&_data9_->_ref_count_)) {
507                 GeeTraversable * self;
508                 GType a_type;
509                 GBoxedCopyFunc a_dup_func;
510                 GDestroyNotify a_destroy_func;
511                 self = _data9_->_data8_->_data7_->self;
512                 a_type = _data9_->_data8_->_data7_->a_type;
513                 a_dup_func = _data9_->_data8_->_data7_->a_dup_func;
514                 a_destroy_func = _data9_->_data8_->_data7_->a_destroy_func;
515                 block8_data_unref (_data9_->_data8_);
516                 _data9_->_data8_ = NULL;
517                 g_slice_free (Block9Data, _data9_);
518         }
519 }
520
521
522 static gpointer ___lambda7_ (Block9Data* _data9_) {
523         Block8Data* _data8_;
524         Block7Data* _data7_;
525         GeeTraversable * self;
526         GType a_type;
527         GBoxedCopyFunc a_dup_func;
528         GDestroyNotify a_destroy_func;
529         gpointer result = NULL;
530         GeeIterator* _tmp0_;
531         gpointer _tmp1_ = NULL;
532         _data8_ = _data9_->_data8_;
533         _data7_ = _data8_->_data7_;
534         self = _data7_->self;
535         a_type = _data7_->a_type;
536         a_dup_func = _data7_->a_dup_func;
537         a_destroy_func = _data7_->a_destroy_func;
538         _tmp0_ = _data7_->_self_;
539         _tmp1_ = gee_iterator_get (_tmp0_);
540         result = _tmp1_;
541         return result;
542 }
543
544
545 static gpointer ____lambda7__gee_lazy_func (gpointer self) {
546         gpointer result;
547         result = ___lambda7_ (self);
548         return result;
549 }
550
551
552 static GeeLazy* ___lambda6_ (Block8Data* _data8_) {
553         Block7Data* _data7_;
554         GeeTraversable * self;
555         GType a_type;
556         GBoxedCopyFunc a_dup_func;
557         GDestroyNotify a_destroy_func;
558         GeeLazy* result = NULL;
559         Block9Data* _data9_;
560         GeeLazy* val;
561         GeeTraversableStream _tmp0_;
562         GeeTraversableStream _tmp16_;
563         _data7_ = _data8_->_data7_;
564         self = _data7_->self;
565         a_type = _data7_->a_type;
566         a_dup_func = _data7_->a_dup_func;
567         a_destroy_func = _data7_->a_destroy_func;
568         _data9_ = g_slice_new0 (Block9Data);
569         _data9_->_ref_count_ = 1;
570         _data9_->_data8_ = block8_data_ref (_data8_);
571         val = NULL;
572         _tmp0_ = _data8_->str;
573         if (_tmp0_ != GEE_TRAVERSABLE_STREAM_CONTINUE) {
574                 GeeStreamFunc _tmp1_;
575                 void* _tmp1__target;
576                 GeeLazy* _tmp2_ = NULL;
577                 GeeTraversableStream _tmp3_ = 0;
578                 _tmp1_ = _data7_->f;
579                 _tmp1__target = _data7_->f_target;
580                 _tmp3_ = _tmp1_ (GEE_TRAVERSABLE_STREAM_YIELD, NULL, &_tmp2_, _tmp1__target);
581                 _gee_lazy_unref0 (val);
582                 val = _tmp2_;
583                 _data8_->str = _tmp3_;
584         }
585         while (TRUE) {
586                 GeeTraversableStream _tmp4_;
587                 gboolean _tmp5_;
588                 GeeStreamFunc _tmp12_;
589                 void* _tmp12__target;
590                 GeeLazy* _tmp13_;
591                 GeeLazy* _tmp14_ = NULL;
592                 GeeTraversableStream _tmp15_ = 0;
593                 _tmp4_ = _data8_->str;
594                 if (!(_tmp4_ == GEE_TRAVERSABLE_STREAM_CONTINUE)) {
595                         break;
596                 }
597                 _tmp5_ = _data8_->need_next;
598                 if (_tmp5_) {
599                         GeeIterator* _tmp6_;
600                         gboolean _tmp7_ = FALSE;
601                         _tmp6_ = _data7_->_self_;
602                         _tmp7_ = gee_iterator_next (_tmp6_);
603                         if (!_tmp7_) {
604                                 GeeStreamFunc _tmp8_;
605                                 void* _tmp8__target;
606                                 GeeLazy* _tmp9_ = NULL;
607                                 GeeTraversableStream _tmp10_ = 0;
608                                 GeeTraversableStream _tmp11_;
609                                 _tmp8_ = _data7_->f;
610                                 _tmp8__target = _data7_->f_target;
611                                 _tmp10_ = _tmp8_ (GEE_TRAVERSABLE_STREAM_END, NULL, &_tmp9_, _tmp8__target);
612                                 _gee_lazy_unref0 (val);
613                                 val = _tmp9_;
614                                 _data8_->str = _tmp10_;
615                                 _tmp11_ = _data8_->str;
616                                 _vala_assert (_tmp11_ != GEE_TRAVERSABLE_STREAM_CONTINUE, "str != Traversable.Stream.CONTINUE");
617                                 break;
618                         }
619                 } else {
620                         _data8_->need_next = TRUE;
621                 }
622                 _tmp12_ = _data7_->f;
623                 _tmp12__target = _data7_->f_target;
624                 _tmp13_ = gee_lazy_new (GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_type (self), (GBoxedCopyFunc) GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_dup_func (self), GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_destroy_func (self), ____lambda7__gee_lazy_func, block9_data_ref (_data9_), block9_data_unref);
625                 _tmp15_ = _tmp12_ (GEE_TRAVERSABLE_STREAM_CONTINUE, _tmp13_, &_tmp14_, _tmp12__target);
626                 _gee_lazy_unref0 (val);
627                 val = _tmp14_;
628                 _data8_->str = _tmp15_;
629         }
630         _tmp16_ = _data8_->str;
631         switch (_tmp16_) {
632                 case GEE_TRAVERSABLE_STREAM_YIELD:
633                 {
634                         result = val;
635                         block9_data_unref (_data9_);
636                         _data9_ = NULL;
637                         return result;
638                 }
639                 case GEE_TRAVERSABLE_STREAM_END:
640                 {
641                         result = NULL;
642                         _gee_lazy_unref0 (val);
643                         block9_data_unref (_data9_);
644                         _data9_ = NULL;
645                         return result;
646                 }
647                 default:
648                 {
649                         g_assert_not_reached ();
650                 }
651         }
652         _gee_lazy_unref0 (val);
653         block9_data_unref (_data9_);
654         _data9_ = NULL;
655 }
656
657
658 static GeeLazy* ____lambda6__gee_unfold_func (gpointer self) {
659         GeeLazy* result;
660         result = ___lambda6_ (self);
661         return result;
662 }
663
664
665 static gpointer _gee_lazy_ref0 (gpointer self) {
666         return self ? gee_lazy_ref (self) : NULL;
667 }
668
669
670 static GeeIterator* gee_traversable_real_stream (GeeTraversable* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeStreamFunc f, void* f_target, GDestroyNotify f_target_destroy_notify) {
671         GeeIterator* result = NULL;
672         Block7Data* _data7_;
673         GeeStreamFunc _tmp0_;
674         void* _tmp0__target;
675         GeeIterable* iself = NULL;
676         GeeIterator* _tmp1_;
677         GeeIterator* _tmp2_;
678         _data7_ = g_slice_new0 (Block7Data);
679         _data7_->_ref_count_ = 1;
680         _data7_->self = g_object_ref (self);
681         _data7_->a_type = a_type;
682         _data7_->a_dup_func = a_dup_func;
683         _data7_->a_destroy_func = a_destroy_func;
684         _tmp0_ = f;
685         _tmp0__target = f_target;
686         (_data7_->f_target_destroy_notify == NULL) ? NULL : (_data7_->f_target_destroy_notify (_data7_->f_target), NULL);
687         _data7_->f = NULL;
688         _data7_->f_target = NULL;
689         _data7_->f_target_destroy_notify = NULL;
690         _data7_->f = _tmp0_;
691         _data7_->f_target = _tmp0__target;
692         _data7_->f_target_destroy_notify = f_target_destroy_notify;
693         _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (self, GEE_TYPE_ITERATOR) ? ((GeeIterator*) self) : NULL);
694         _g_object_unref0 (_data7_->_self_);
695         _data7_->_self_ = _tmp1_;
696         _tmp2_ = _data7_->_self_;
697         if (_tmp2_ != NULL) {
698                 Block8Data* _data8_;
699                 GeeLazy* initial;
700                 GeeStreamFunc _tmp3_;
701                 void* _tmp3__target;
702                 GeeLazy* _tmp4_ = NULL;
703                 GeeTraversableStream _tmp5_ = 0;
704                 GeeTraversableStream _tmp6_;
705                 GeeLazy* _tmp20_;
706                 GeeLazy* _tmp21_;
707                 GeeIterator* _tmp22_ = NULL;
708                 _data8_ = g_slice_new0 (Block8Data);
709                 _data8_->_ref_count_ = 1;
710                 _data8_->_data7_ = block7_data_ref (_data7_);
711                 initial = NULL;
712                 _data8_->need_next = TRUE;
713                 _tmp3_ = _data7_->f;
714                 _tmp3__target = _data7_->f_target;
715                 _tmp5_ = _tmp3_ (GEE_TRAVERSABLE_STREAM_YIELD, NULL, &_tmp4_, _tmp3__target);
716                 _gee_lazy_unref0 (initial);
717                 initial = _tmp4_;
718                 _data8_->str = _tmp5_;
719                 _tmp6_ = _data8_->str;
720                 switch (_tmp6_) {
721                         case GEE_TRAVERSABLE_STREAM_CONTINUE:
722                         {
723                                 GeeIterator* _tmp7_;
724                                 gboolean _tmp8_;
725                                 gboolean _tmp9_;
726                                 _tmp7_ = _data7_->_self_;
727                                 _tmp8_ = gee_iterator_get_valid (_tmp7_);
728                                 _tmp9_ = _tmp8_;
729                                 if (_tmp9_) {
730                                         GeeStreamFunc _tmp10_;
731                                         void* _tmp10__target;
732                                         GeeLazy* _tmp11_;
733                                         GeeLazy* _tmp12_ = NULL;
734                                         GeeTraversableStream _tmp13_ = 0;
735                                         GeeTraversableStream _tmp14_;
736                                         _tmp10_ = _data7_->f;
737                                         _tmp10__target = _data7_->f_target;
738                                         _tmp11_ = gee_lazy_new (GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_type (self), (GBoxedCopyFunc) GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_dup_func (self), GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_destroy_func (self), ______lambda3__gee_lazy_func, block8_data_ref (_data8_), block8_data_unref);
739                                         _tmp13_ = _tmp10_ (GEE_TRAVERSABLE_STREAM_CONTINUE, _tmp11_, &_tmp12_, _tmp10__target);
740                                         _gee_lazy_unref0 (initial);
741                                         initial = _tmp12_;
742                                         _data8_->str = _tmp13_;
743                                         _tmp14_ = _data8_->str;
744                                         switch (_tmp14_) {
745                                                 case GEE_TRAVERSABLE_STREAM_YIELD:
746                                                 case GEE_TRAVERSABLE_STREAM_CONTINUE:
747                                                 {
748                                                         break;
749                                                 }
750                                                 case GEE_TRAVERSABLE_STREAM_END:
751                                                 {
752                                                         GeeIterator* _tmp15_ = NULL;
753                                                         _tmp15_ = gee_iterator_unfold (a_type, (GBoxedCopyFunc) a_dup_func, a_destroy_func, _______lambda4__gee_unfold_func, block8_data_ref (_data8_), block8_data_unref, NULL);
754                                                         result = _tmp15_;
755                                                         _gee_lazy_unref0 (initial);
756                                                         block8_data_unref (_data8_);
757                                                         _data8_ = NULL;
758                                                         _g_object_unref0 (iself);
759                                                         block7_data_unref (_data7_);
760                                                         _data7_ = NULL;
761                                                         return result;
762                                                 }
763                                                 default:
764                                                 {
765                                                         g_assert_not_reached ();
766                                                 }
767                                         }
768                                 }
769                                 break;
770                         }
771                         case GEE_TRAVERSABLE_STREAM_YIELD:
772                         {
773                                 GeeIterator* _tmp16_;
774                                 gboolean _tmp17_;
775                                 gboolean _tmp18_;
776                                 _tmp16_ = _data7_->_self_;
777                                 _tmp17_ = gee_iterator_get_valid (_tmp16_);
778                                 _tmp18_ = _tmp17_;
779                                 if (_tmp18_) {
780                                         _data8_->need_next = FALSE;
781                                 }
782                                 break;
783                         }
784                         case GEE_TRAVERSABLE_STREAM_END:
785                         {
786                                 GeeIterator* _tmp19_ = NULL;
787                                 _tmp19_ = gee_iterator_unfold (a_type, (GBoxedCopyFunc) a_dup_func, a_destroy_func, _____lambda5__gee_unfold_func, block8_data_ref (_data8_), block8_data_unref, NULL);
788                                 result = _tmp19_;
789                                 _gee_lazy_unref0 (initial);
790                                 block8_data_unref (_data8_);
791                                 _data8_ = NULL;
792                                 _g_object_unref0 (iself);
793                                 block7_data_unref (_data7_);
794                                 _data7_ = NULL;
795                                 return result;
796                         }
797                         default:
798                         {
799                                 g_assert_not_reached ();
800                         }
801                 }
802                 _tmp20_ = initial;
803                 _tmp21_ = _gee_lazy_ref0 (_tmp20_);
804                 _tmp22_ = gee_iterator_unfold (a_type, (GBoxedCopyFunc) a_dup_func, a_destroy_func, ____lambda6__gee_unfold_func, block8_data_ref (_data8_), block8_data_unref, _tmp21_);
805                 result = _tmp22_;
806                 _gee_lazy_unref0 (initial);
807                 block8_data_unref (_data8_);
808                 _data8_ = NULL;
809                 _g_object_unref0 (iself);
810                 block7_data_unref (_data7_);
811                 _data7_ = NULL;
812                 return result;
813         } else {
814                 GeeIterable* _tmp23_;
815                 GeeIterable* _tmp24_;
816                 _tmp23_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (self, GEE_TYPE_ITERABLE) ? ((GeeIterable*) self) : NULL);
817                 _g_object_unref0 (iself);
818                 iself = _tmp23_;
819                 _tmp24_ = iself;
820                 if (_tmp24_ != NULL) {
821                         GeeIterable* _tmp25_;
822                         GeeIterator* _tmp26_ = NULL;
823                         GeeIterator* _tmp27_;
824                         GeeStreamFunc _tmp28_;
825                         void* _tmp28__target;
826                         GDestroyNotify _tmp28__target_destroy_notify;
827                         GeeIterator* _tmp29_ = NULL;
828                         GeeIterator* _tmp30_;
829                         _tmp25_ = iself;
830                         _tmp26_ = gee_iterable_iterator (_tmp25_);
831                         _tmp27_ = _tmp26_;
832                         _tmp28_ = _data7_->f;
833                         _tmp28__target = _data7_->f_target;
834                         _tmp28__target_destroy_notify = _data7_->f_target_destroy_notify;
835                         _data7_->f_target_destroy_notify = NULL;
836                         _tmp29_ = gee_traversable_stream ((GeeTraversable*) _tmp27_, a_type, (GBoxedCopyFunc) a_dup_func, a_destroy_func, _tmp28_, _tmp28__target, _tmp28__target_destroy_notify);
837                         _tmp30_ = _tmp29_;
838                         _g_object_unref0 (_tmp27_);
839                         result = _tmp30_;
840                         _g_object_unref0 (iself);
841                         block7_data_unref (_data7_);
842                         _data7_ = NULL;
843                         return result;
844                 } else {
845                         g_assert_not_reached ();
846                 }
847         }
848         _g_object_unref0 (iself);
849         block7_data_unref (_data7_);
850         _data7_ = NULL;
851 }
852
853
854 GeeIterator* gee_traversable_stream (GeeTraversable* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeStreamFunc f, void* f_target, GDestroyNotify f_target_destroy_notify) {
855         g_return_val_if_fail (self != NULL, NULL);
856         return GEE_TRAVERSABLE_GET_INTERFACE (self)->stream (self, a_type, a_dup_func, a_destroy_func, f, f_target, f_target_destroy_notify);
857 }
858
859
860 /**
861  * Standard aggregation function.
862  *
863  * It takes a function, seed and first element, returns the new seed and
864  * progress to next element when the operation repeats.
865  *
866  * Note: Default implementation uses {@link foreach}.
867  *
868  * Note: In {@link Iterator} implementation operation moves the
869  *    iterator to last element in iteration. If iterator is
870  *    {@link Iterator.valid} the current element will be considered
871  *    as well.
872  *
873  */
874 static Block10Data* block10_data_ref (Block10Data* _data10_) {
875         g_atomic_int_inc (&_data10_->_ref_count_);
876         return _data10_;
877 }
878
879
880 static void block10_data_unref (void * _userdata_) {
881         Block10Data* _data10_;
882         _data10_ = (Block10Data*) _userdata_;
883         if (g_atomic_int_dec_and_test (&_data10_->_ref_count_)) {
884                 GeeTraversable * self;
885                 GType a_type;
886                 GBoxedCopyFunc a_dup_func;
887                 GDestroyNotify a_destroy_func;
888                 self = _data10_->self;
889                 a_type = _data10_->a_type;
890                 a_dup_func = _data10_->a_dup_func;
891                 a_destroy_func = _data10_->a_destroy_func;
892                 _a_destroy_func0 (_data10_->seed);
893                 _g_object_unref0 (self);
894                 g_slice_free (Block10Data, _data10_);
895         }
896 }
897
898
899 static gboolean __lambda8_ (Block10Data* _data10_, gpointer item) {
900         GeeTraversable * self;
901         GType a_type;
902         GBoxedCopyFunc a_dup_func;
903         GDestroyNotify a_destroy_func;
904         gboolean result = FALSE;
905         GeeFoldFunc _tmp0_;
906         void* _tmp0__target;
907         gpointer _tmp1_;
908         gpointer _tmp2_;
909         gpointer _tmp3_ = NULL;
910         self = _data10_->self;
911         a_type = _data10_->a_type;
912         a_dup_func = _data10_->a_dup_func;
913         a_destroy_func = _data10_->a_destroy_func;
914         _tmp0_ = _data10_->f;
915         _tmp0__target = _data10_->f_target;
916         _tmp1_ = item;
917         item = NULL;
918         _tmp2_ = _data10_->seed;
919         _data10_->seed = NULL;
920         _tmp3_ = _tmp0_ (_tmp1_, _tmp2_, _tmp0__target);
921         _a_destroy_func0 (_data10_->seed);
922         _data10_->seed = _tmp3_;
923         result = TRUE;
924         ((item == NULL) || (GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_destroy_func (self) == NULL)) ? NULL : (item = (GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_destroy_func (self) (item), NULL));
925         return result;
926 }
927
928
929 static gboolean ___lambda8__gee_forall_func (gpointer g, gpointer self) {
930         gboolean result;
931         result = __lambda8_ (self, g);
932         return result;
933 }
934
935
936 static gpointer gee_traversable_real_fold (GeeTraversable* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeFoldFunc f, void* f_target, gpointer seed) {
937         gpointer result = NULL;
938         Block10Data* _data10_;
939         GeeFoldFunc _tmp0_;
940         void* _tmp0__target;
941         gconstpointer _tmp1_;
942         gpointer _tmp2_;
943         _data10_ = g_slice_new0 (Block10Data);
944         _data10_->_ref_count_ = 1;
945         _data10_->self = g_object_ref (self);
946         _data10_->a_type = a_type;
947         _data10_->a_dup_func = a_dup_func;
948         _data10_->a_destroy_func = a_destroy_func;
949         _tmp0_ = f;
950         _tmp0__target = f_target;
951         _data10_->f = _tmp0_;
952         _data10_->f_target = _tmp0__target;
953         _tmp1_ = seed;
954         _a_destroy_func0 (_data10_->seed);
955         _data10_->seed = _tmp1_;
956         gee_traversable_foreach (self, ___lambda8__gee_forall_func, _data10_);
957         _tmp2_ = _data10_->seed;
958         _data10_->seed = NULL;
959         result = _tmp2_;
960         block10_data_unref (_data10_);
961         _data10_ = NULL;
962         return result;
963 }
964
965
966 gpointer gee_traversable_fold (GeeTraversable* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeFoldFunc f, void* f_target, gpointer seed) {
967         g_return_val_if_fail (self != NULL, NULL);
968         return GEE_TRAVERSABLE_GET_INTERFACE (self)->fold (self, a_type, a_dup_func, a_destroy_func, f, f_target, seed);
969 }
970
971
972 /**
973  * Produces an iterator pointing at elements generated by function passed.
974  *
975  * Iterator is lazy evaluated but value is force-evaluated when
976  * iterator moves to next element. ({@link Iterator.next})
977  *
978  * Note: Default implementation uses {@link stream}.
979  *
980  * Note: In {@link Iterator} implementation if the parent iterator is
981  *    {@link Iterator.valid} so is the returned one. Using the parent
982  *    iterator is not allowed before the inner iterator {@link Iterator.next}
983  *    return false and then it points on its last element.
984  *    The resulting iterator is {@link Iterator.valid} if the parent
985  *    iterator is.
986  *
987  * @param f Mapping function
988  * @return Iterator listing mapped value
989  */
990 static Block11Data* block11_data_ref (Block11Data* _data11_) {
991         g_atomic_int_inc (&_data11_->_ref_count_);
992         return _data11_;
993 }
994
995
996 static void block11_data_unref (void * _userdata_) {
997         Block11Data* _data11_;
998         _data11_ = (Block11Data*) _userdata_;
999         if (g_atomic_int_dec_and_test (&_data11_->_ref_count_)) {
1000                 GeeTraversable * self;
1001                 GType a_type;
1002                 GBoxedCopyFunc a_dup_func;
1003                 GDestroyNotify a_destroy_func;
1004                 self = _data11_->self;
1005                 a_type = _data11_->a_type;
1006                 a_dup_func = _data11_->a_dup_func;
1007                 a_destroy_func = _data11_->a_destroy_func;
1008                 _g_object_unref0 (self);
1009                 g_slice_free (Block11Data, _data11_);
1010         }
1011 }
1012
1013
1014 static Block12Data* block12_data_ref (Block12Data* _data12_) {
1015         g_atomic_int_inc (&_data12_->_ref_count_);
1016         return _data12_;
1017 }
1018
1019
1020 static void block12_data_unref (void * _userdata_) {
1021         Block12Data* _data12_;
1022         _data12_ = (Block12Data*) _userdata_;
1023         if (g_atomic_int_dec_and_test (&_data12_->_ref_count_)) {
1024                 GeeTraversable * self;
1025                 GType a_type;
1026                 GBoxedCopyFunc a_dup_func;
1027                 GDestroyNotify a_destroy_func;
1028                 self = _data12_->_data11_->self;
1029                 a_type = _data12_->_data11_->a_type;
1030                 a_dup_func = _data12_->_data11_->a_dup_func;
1031                 a_destroy_func = _data12_->_data11_->a_destroy_func;
1032                 _gee_lazy_unref0 (_data12_->item);
1033                 block11_data_unref (_data12_->_data11_);
1034                 _data12_->_data11_ = NULL;
1035                 g_slice_free (Block12Data, _data12_);
1036         }
1037 }
1038
1039
1040 static gpointer ___lambda10_ (Block12Data* _data12_) {
1041         Block11Data* _data11_;
1042         GeeTraversable * self;
1043         GType a_type;
1044         GBoxedCopyFunc a_dup_func;
1045         GDestroyNotify a_destroy_func;
1046         gpointer result = NULL;
1047         GeeLazy* _tmp0_;
1048         gpointer _tmp1_ = NULL;
1049         gpointer tmp;
1050         GeeMapFunc _tmp2_;
1051         void* _tmp2__target;
1052         gpointer _tmp3_;
1053         gpointer _tmp4_ = NULL;
1054         _data11_ = _data12_->_data11_;
1055         self = _data11_->self;
1056         a_type = _data11_->a_type;
1057         a_dup_func = _data11_->a_dup_func;
1058         a_destroy_func = _data11_->a_destroy_func;
1059         _tmp0_ = _data12_->item;
1060         _tmp1_ = gee_lazy_get (_tmp0_);
1061         tmp = _tmp1_;
1062         _gee_lazy_unref0 (_data12_->item);
1063         _data12_->item = NULL;
1064         _tmp2_ = _data11_->f;
1065         _tmp2__target = _data11_->f_target;
1066         _tmp3_ = tmp;
1067         tmp = NULL;
1068         _tmp4_ = _tmp2_ (_tmp3_, _tmp2__target);
1069         result = _tmp4_;
1070         _a_destroy_func0 (tmp);
1071         return result;
1072 }
1073
1074
1075 static gpointer ____lambda10__gee_lazy_func (gpointer self) {
1076         gpointer result;
1077         result = ___lambda10_ (self);
1078         return result;
1079 }
1080
1081
1082 static GeeTraversableStream __lambda9_ (Block11Data* _data11_, GeeTraversableStream state, GeeLazy* item, GeeLazy** val) {
1083         GeeTraversable * self;
1084         GType a_type;
1085         GBoxedCopyFunc a_dup_func;
1086         GDestroyNotify a_destroy_func;
1087         GeeLazy* _vala_val = NULL;
1088         GeeTraversableStream result = 0;
1089         Block12Data* _data12_;
1090         GeeLazy* _tmp0_;
1091         GeeTraversableStream _tmp1_;
1092         self = _data11_->self;
1093         a_type = _data11_->a_type;
1094         a_dup_func = _data11_->a_dup_func;
1095         a_destroy_func = _data11_->a_destroy_func;
1096         _data12_ = g_slice_new0 (Block12Data);
1097         _data12_->_ref_count_ = 1;
1098         _data12_->_data11_ = block11_data_ref (_data11_);
1099         _tmp0_ = item;
1100         _gee_lazy_unref0 (_data12_->item);
1101         _data12_->item = _tmp0_;
1102         _tmp1_ = state;
1103         switch (_tmp1_) {
1104                 case GEE_TRAVERSABLE_STREAM_YIELD:
1105                 {
1106                         _gee_lazy_unref0 (_vala_val);
1107                         _vala_val = NULL;
1108                         result = GEE_TRAVERSABLE_STREAM_CONTINUE;
1109                         block12_data_unref (_data12_);
1110                         _data12_ = NULL;
1111                         if (val) {
1112                                 *val = _vala_val;
1113                         } else {
1114                                 _gee_lazy_unref0 (_vala_val);
1115                         }
1116                         return result;
1117                 }
1118                 case GEE_TRAVERSABLE_STREAM_CONTINUE:
1119                 {
1120                         GeeLazy* _tmp2_;
1121                         _tmp2_ = gee_lazy_new (a_type, (GBoxedCopyFunc) a_dup_func, a_destroy_func, ____lambda10__gee_lazy_func, block12_data_ref (_data12_), block12_data_unref);
1122                         _gee_lazy_unref0 (_vala_val);
1123                         _vala_val = _tmp2_;
1124                         result = GEE_TRAVERSABLE_STREAM_YIELD;
1125                         block12_data_unref (_data12_);
1126                         _data12_ = NULL;
1127                         if (val) {
1128                                 *val = _vala_val;
1129                         } else {
1130                                 _gee_lazy_unref0 (_vala_val);
1131                         }
1132                         return result;
1133                 }
1134                 case GEE_TRAVERSABLE_STREAM_END:
1135                 {
1136                         _gee_lazy_unref0 (_vala_val);
1137                         _vala_val = NULL;
1138                         result = GEE_TRAVERSABLE_STREAM_END;
1139                         block12_data_unref (_data12_);
1140                         _data12_ = NULL;
1141                         if (val) {
1142                                 *val = _vala_val;
1143                         } else {
1144                                 _gee_lazy_unref0 (_vala_val);
1145                         }
1146                         return result;
1147                 }
1148                 default:
1149                 {
1150                         g_assert_not_reached ();
1151                 }
1152         }
1153         if (val) {
1154                 *val = _vala_val;
1155         } else {
1156                 _gee_lazy_unref0 (_vala_val);
1157         }
1158         block12_data_unref (_data12_);
1159         _data12_ = NULL;
1160 }
1161
1162
1163 static GeeTraversableStream ___lambda9__gee_stream_func (GeeTraversableStream state, GeeLazy* g, GeeLazy** lazy, gpointer self) {
1164         GeeTraversableStream result;
1165         result = __lambda9_ (self, state, g, lazy);
1166         return result;
1167 }
1168
1169
1170 static GeeIterator* gee_traversable_real_map (GeeTraversable* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeMapFunc f, void* f_target) {
1171         GeeIterator* result = NULL;
1172         Block11Data* _data11_;
1173         GeeMapFunc _tmp0_;
1174         void* _tmp0__target;
1175         GeeIterator* _tmp1_ = NULL;
1176         _data11_ = g_slice_new0 (Block11Data);
1177         _data11_->_ref_count_ = 1;
1178         _data11_->self = g_object_ref (self);
1179         _data11_->a_type = a_type;
1180         _data11_->a_dup_func = a_dup_func;
1181         _data11_->a_destroy_func = a_destroy_func;
1182         _tmp0_ = f;
1183         _tmp0__target = f_target;
1184         _data11_->f = _tmp0_;
1185         _data11_->f_target = _tmp0__target;
1186         _tmp1_ = gee_traversable_stream (self, a_type, (GBoxedCopyFunc) a_dup_func, a_destroy_func, ___lambda9__gee_stream_func, block11_data_ref (_data11_), block11_data_unref);
1187         result = _tmp1_;
1188         block11_data_unref (_data11_);
1189         _data11_ = NULL;
1190         return result;
1191 }
1192
1193
1194 GeeIterator* gee_traversable_map (GeeTraversable* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeMapFunc f, void* f_target) {
1195         g_return_val_if_fail (self != NULL, NULL);
1196         return GEE_TRAVERSABLE_GET_INTERFACE (self)->map (self, a_type, a_dup_func, a_destroy_func, f, f_target);
1197 }
1198
1199
1200 /**
1201  * Creates a new iterator that is initially pointing to seed. Then
1202  * subsequent values are obtained after applying the function to previous
1203  * value and the subsequent items.
1204  *
1205  * The resulting iterator is always valid and it contains the seed value.
1206  *
1207  * Note: Default implementation uses {@link stream}.
1208  *
1209  * Note: When the method is called on {@link Iterator} using the parent
1210  *    iterator is not allowed befor the inner iterator
1211  *    {@link Iterator.next} return false and then it points on its last
1212  *    element. The resulting iterator is {@link Iterator.valid}.
1213  *
1214  * @param f Folding function
1215  * @param seed original seed value
1216  * @return Iterator containing values of subsequent values of seed
1217  */
1218 static Block13Data* block13_data_ref (Block13Data* _data13_) {
1219         g_atomic_int_inc (&_data13_->_ref_count_);
1220         return _data13_;
1221 }
1222
1223
1224 static void block13_data_unref (void * _userdata_) {
1225         Block13Data* _data13_;
1226         _data13_ = (Block13Data*) _userdata_;
1227         if (g_atomic_int_dec_and_test (&_data13_->_ref_count_)) {
1228                 GeeTraversable * self;
1229                 GType a_type;
1230                 GBoxedCopyFunc a_dup_func;
1231                 GDestroyNotify a_destroy_func;
1232                 self = _data13_->self;
1233                 a_type = _data13_->a_type;
1234                 a_dup_func = _data13_->a_dup_func;
1235                 a_destroy_func = _data13_->a_destroy_func;
1236                 _a_destroy_func0 (_data13_->seed);
1237                 _g_object_unref0 (self);
1238                 g_slice_free (Block13Data, _data13_);
1239         }
1240 }
1241
1242
1243 static Block14Data* block14_data_ref (Block14Data* _data14_) {
1244         g_atomic_int_inc (&_data14_->_ref_count_);
1245         return _data14_;
1246 }
1247
1248
1249 static void block14_data_unref (void * _userdata_) {
1250         Block14Data* _data14_;
1251         _data14_ = (Block14Data*) _userdata_;
1252         if (g_atomic_int_dec_and_test (&_data14_->_ref_count_)) {
1253                 GeeTraversable * self;
1254                 GType a_type;
1255                 GBoxedCopyFunc a_dup_func;
1256                 GDestroyNotify a_destroy_func;
1257                 self = _data14_->_data13_->self;
1258                 a_type = _data14_->_data13_->a_type;
1259                 a_dup_func = _data14_->_data13_->a_dup_func;
1260                 a_destroy_func = _data14_->_data13_->a_destroy_func;
1261                 _gee_lazy_unref0 (_data14_->item);
1262                 block13_data_unref (_data14_->_data13_);
1263                 _data14_->_data13_ = NULL;
1264                 g_slice_free (Block14Data, _data14_);
1265         }
1266 }
1267
1268
1269 static gpointer ___lambda12_ (Block14Data* _data14_) {
1270         Block13Data* _data13_;
1271         GeeTraversable * self;
1272         GType a_type;
1273         GBoxedCopyFunc a_dup_func;
1274         GDestroyNotify a_destroy_func;
1275         gpointer result = NULL;
1276         GeeLazy* _tmp0_;
1277         gpointer _tmp1_ = NULL;
1278         gpointer tmp;
1279         GeeFoldFunc _tmp2_;
1280         void* _tmp2__target;
1281         gpointer _tmp3_;
1282         gpointer _tmp4_;
1283         gpointer _tmp5_ = NULL;
1284         gconstpointer _tmp6_;
1285         gpointer _tmp7_;
1286         _data13_ = _data14_->_data13_;
1287         self = _data13_->self;
1288         a_type = _data13_->a_type;
1289         a_dup_func = _data13_->a_dup_func;
1290         a_destroy_func = _data13_->a_destroy_func;
1291         _tmp0_ = _data14_->item;
1292         _tmp1_ = gee_lazy_get (_tmp0_);
1293         tmp = _tmp1_;
1294         _gee_lazy_unref0 (_data14_->item);
1295         _data14_->item = NULL;
1296         _tmp2_ = _data13_->f;
1297         _tmp2__target = _data13_->f_target;
1298         _tmp3_ = tmp;
1299         tmp = NULL;
1300         _tmp4_ = _data13_->seed;
1301         _data13_->seed = NULL;
1302         _tmp5_ = _tmp2_ (_tmp3_, _tmp4_, _tmp2__target);
1303         _a_destroy_func0 (_data13_->seed);
1304         _data13_->seed = _tmp5_;
1305         _tmp6_ = _data13_->seed;
1306         _tmp7_ = ((_tmp6_ != NULL) && (a_dup_func != NULL)) ? a_dup_func ((gpointer) _tmp6_) : ((gpointer) _tmp6_);
1307         result = _tmp7_;
1308         _a_destroy_func0 (tmp);
1309         return result;
1310 }
1311
1312
1313 static gpointer ____lambda12__gee_lazy_func (gpointer self) {
1314         gpointer result;
1315         result = ___lambda12_ (self);
1316         return result;
1317 }
1318
1319
1320 static GeeTraversableStream __lambda11_ (Block13Data* _data13_, GeeTraversableStream state, GeeLazy* item, GeeLazy** val) {
1321         GeeTraversable * self;
1322         GType a_type;
1323         GBoxedCopyFunc a_dup_func;
1324         GDestroyNotify a_destroy_func;
1325         GeeLazy* _vala_val = NULL;
1326         GeeTraversableStream result = 0;
1327         Block14Data* _data14_;
1328         GeeLazy* _tmp0_;
1329         GeeTraversableStream _tmp1_;
1330         self = _data13_->self;
1331         a_type = _data13_->a_type;
1332         a_dup_func = _data13_->a_dup_func;
1333         a_destroy_func = _data13_->a_destroy_func;
1334         _data14_ = g_slice_new0 (Block14Data);
1335         _data14_->_ref_count_ = 1;
1336         _data14_->_data13_ = block13_data_ref (_data13_);
1337         _tmp0_ = item;
1338         _gee_lazy_unref0 (_data14_->item);
1339         _data14_->item = _tmp0_;
1340         _tmp1_ = state;
1341         switch (_tmp1_) {
1342                 case GEE_TRAVERSABLE_STREAM_YIELD:
1343                 {
1344                         if (_data13_->seed_emitted) {
1345                                 _gee_lazy_unref0 (_vala_val);
1346                                 _vala_val = NULL;
1347                                 result = GEE_TRAVERSABLE_STREAM_CONTINUE;
1348                                 block14_data_unref (_data14_);
1349                                 _data14_ = NULL;
1350                                 if (val) {
1351                                         *val = _vala_val;
1352                                 } else {
1353                                         _gee_lazy_unref0 (_vala_val);
1354                                 }
1355                                 return result;
1356                         } else {
1357                                 gconstpointer _tmp2_;
1358                                 GeeLazy* _tmp3_;
1359                                 _tmp2_ = _data13_->seed;
1360                                 _tmp3_ = gee_lazy_new_from_value (a_type, (GBoxedCopyFunc) a_dup_func, a_destroy_func, _tmp2_);
1361                                 _gee_lazy_unref0 (_vala_val);
1362                                 _vala_val = _tmp3_;
1363                                 _data13_->seed_emitted = TRUE;
1364                                 result = GEE_TRAVERSABLE_STREAM_YIELD;
1365                                 block14_data_unref (_data14_);
1366                                 _data14_ = NULL;
1367                                 if (val) {
1368                                         *val = _vala_val;
1369                                 } else {
1370                                         _gee_lazy_unref0 (_vala_val);
1371                                 }
1372                                 return result;
1373                         }
1374                 }
1375                 case GEE_TRAVERSABLE_STREAM_CONTINUE:
1376                 {
1377                         GeeLazy* _tmp4_;
1378                         _tmp4_ = gee_lazy_new (a_type, (GBoxedCopyFunc) a_dup_func, a_destroy_func, ____lambda12__gee_lazy_func, block14_data_ref (_data14_), block14_data_unref);
1379                         _gee_lazy_unref0 (_vala_val);
1380                         _vala_val = _tmp4_;
1381                         result = GEE_TRAVERSABLE_STREAM_YIELD;
1382                         block14_data_unref (_data14_);
1383                         _data14_ = NULL;
1384                         if (val) {
1385                                 *val = _vala_val;
1386                         } else {
1387                                 _gee_lazy_unref0 (_vala_val);
1388                         }
1389                         return result;
1390                 }
1391                 case GEE_TRAVERSABLE_STREAM_END:
1392                 {
1393                         _gee_lazy_unref0 (_vala_val);
1394                         _vala_val = NULL;
1395                         result = GEE_TRAVERSABLE_STREAM_END;
1396                         block14_data_unref (_data14_);
1397                         _data14_ = NULL;
1398                         if (val) {
1399                                 *val = _vala_val;
1400                         } else {
1401                                 _gee_lazy_unref0 (_vala_val);
1402                         }
1403                         return result;
1404                 }
1405                 default:
1406                 {
1407                         g_assert_not_reached ();
1408                 }
1409         }
1410         if (val) {
1411                 *val = _vala_val;
1412         } else {
1413                 _gee_lazy_unref0 (_vala_val);
1414         }
1415         block14_data_unref (_data14_);
1416         _data14_ = NULL;
1417 }
1418
1419
1420 static GeeTraversableStream ___lambda11__gee_stream_func (GeeTraversableStream state, GeeLazy* g, GeeLazy** lazy, gpointer self) {
1421         GeeTraversableStream result;
1422         result = __lambda11_ (self, state, g, lazy);
1423         return result;
1424 }
1425
1426
1427 static GeeIterator* gee_traversable_real_scan (GeeTraversable* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeFoldFunc f, void* f_target, gpointer seed) {
1428         GeeIterator* result = NULL;
1429         Block13Data* _data13_;
1430         GeeFoldFunc _tmp0_;
1431         void* _tmp0__target;
1432         gconstpointer _tmp1_;
1433         GeeIterator* _tmp2_ = NULL;
1434         _data13_ = g_slice_new0 (Block13Data);
1435         _data13_->_ref_count_ = 1;
1436         _data13_->self = g_object_ref (self);
1437         _data13_->a_type = a_type;
1438         _data13_->a_dup_func = a_dup_func;
1439         _data13_->a_destroy_func = a_destroy_func;
1440         _tmp0_ = f;
1441         _tmp0__target = f_target;
1442         _data13_->f = _tmp0_;
1443         _data13_->f_target = _tmp0__target;
1444         _tmp1_ = seed;
1445         _a_destroy_func0 (_data13_->seed);
1446         _data13_->seed = _tmp1_;
1447         _data13_->seed_emitted = FALSE;
1448         _tmp2_ = gee_traversable_stream (self, a_type, (GBoxedCopyFunc) a_dup_func, a_destroy_func, ___lambda11__gee_stream_func, block13_data_ref (_data13_), block13_data_unref);
1449         result = _tmp2_;
1450         block13_data_unref (_data13_);
1451         _data13_ = NULL;
1452         return result;
1453 }
1454
1455
1456 GeeIterator* gee_traversable_scan (GeeTraversable* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeFoldFunc f, void* f_target, gpointer seed) {
1457         g_return_val_if_fail (self != NULL, NULL);
1458         return GEE_TRAVERSABLE_GET_INTERFACE (self)->scan (self, a_type, a_dup_func, a_destroy_func, f, f_target, seed);
1459 }
1460
1461
1462 /**
1463  * Creates a new iterator that contains only values that fullfills the
1464  * predicate.
1465  *
1466  * Note: When the method is called on {@link Iterator} using the parent
1467  *    iterator is not allowed befor the inner iterator
1468  *    {@link Iterator.next} return false and then it points on its last
1469  *    element. The resulting iterator is {@link Iterator.valid} if parent
1470  *    iterator is {@link Iterator.valid} and value it is pointing on
1471  *    fullfills the predicate.
1472  *
1473  * @param pred predicate to check should the value be retained
1474  * @return Iterator containing values of subsequent values of seed
1475  */
1476 static Block15Data* block15_data_ref (Block15Data* _data15_) {
1477         g_atomic_int_inc (&_data15_->_ref_count_);
1478         return _data15_;
1479 }
1480
1481
1482 static void block15_data_unref (void * _userdata_) {
1483         Block15Data* _data15_;
1484         _data15_ = (Block15Data*) _userdata_;
1485         if (g_atomic_int_dec_and_test (&_data15_->_ref_count_)) {
1486                 GeeTraversable * self;
1487                 self = _data15_->self;
1488                 (_data15_->pred_target_destroy_notify == NULL) ? NULL : (_data15_->pred_target_destroy_notify (_data15_->pred_target), NULL);
1489                 _data15_->pred = NULL;
1490                 _data15_->pred_target = NULL;
1491                 _data15_->pred_target_destroy_notify = NULL;
1492                 _g_object_unref0 (self);
1493                 g_slice_free (Block15Data, _data15_);
1494         }
1495 }
1496
1497
1498 static GeeTraversableStream __lambda13_ (Block15Data* _data15_, GeeTraversableStream state, GeeLazy* item, GeeLazy** val) {
1499         GeeTraversable * self;
1500         GeeLazy* _vala_val = NULL;
1501         GeeTraversableStream result = 0;
1502         GeeTraversableStream _tmp0_;
1503         self = _data15_->self;
1504         _tmp0_ = state;
1505         switch (_tmp0_) {
1506                 case GEE_TRAVERSABLE_STREAM_YIELD:
1507                 {
1508                         _gee_lazy_unref0 (_vala_val);
1509                         _vala_val = NULL;
1510                         result = GEE_TRAVERSABLE_STREAM_CONTINUE;
1511                         _gee_lazy_unref0 (item);
1512                         if (val) {
1513                                 *val = _vala_val;
1514                         } else {
1515                                 _gee_lazy_unref0 (_vala_val);
1516                         }
1517                         return result;
1518                 }
1519                 case GEE_TRAVERSABLE_STREAM_CONTINUE:
1520                 {
1521                         GeeLazy* _tmp1_;
1522                         gpointer _tmp2_ = NULL;
1523                         gpointer g;
1524                         GeePredicate _tmp3_;
1525                         void* _tmp3__target;
1526                         gconstpointer _tmp4_;
1527                         gboolean _tmp5_ = FALSE;
1528                         _tmp1_ = item;
1529                         _tmp2_ = gee_lazy_get (_tmp1_);
1530                         g = _tmp2_;
1531                         _tmp3_ = _data15_->pred;
1532                         _tmp3__target = _data15_->pred_target;
1533                         _tmp4_ = g;
1534                         _tmp5_ = _tmp3_ (_tmp4_, _tmp3__target);
1535                         if (_tmp5_) {
1536                                 GeeLazy* _tmp6_;
1537                                 GeeLazy* _tmp7_;
1538                                 _tmp6_ = item;
1539                                 _tmp7_ = _gee_lazy_ref0 (_tmp6_);
1540                                 _gee_lazy_unref0 (_vala_val);
1541                                 _vala_val = _tmp7_;
1542                                 result = GEE_TRAVERSABLE_STREAM_YIELD;
1543                                 ((g == NULL) || (GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_destroy_func (self) == NULL)) ? NULL : (g = (GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_destroy_func (self) (g), NULL));
1544                                 _gee_lazy_unref0 (item);
1545                                 if (val) {
1546                                         *val = _vala_val;
1547                                 } else {
1548                                         _gee_lazy_unref0 (_vala_val);
1549                                 }
1550                                 return result;
1551                         } else {
1552                                 _gee_lazy_unref0 (_vala_val);
1553                                 _vala_val = NULL;
1554                                 result = GEE_TRAVERSABLE_STREAM_CONTINUE;
1555                                 ((g == NULL) || (GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_destroy_func (self) == NULL)) ? NULL : (g = (GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_destroy_func (self) (g), NULL));
1556                                 _gee_lazy_unref0 (item);
1557                                 if (val) {
1558                                         *val = _vala_val;
1559                                 } else {
1560                                         _gee_lazy_unref0 (_vala_val);
1561                                 }
1562                                 return result;
1563                         }
1564                         ((g == NULL) || (GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_destroy_func (self) == NULL)) ? NULL : (g = (GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_destroy_func (self) (g), NULL));
1565                 }
1566                 case GEE_TRAVERSABLE_STREAM_END:
1567                 {
1568                         _gee_lazy_unref0 (_vala_val);
1569                         _vala_val = NULL;
1570                         result = GEE_TRAVERSABLE_STREAM_END;
1571                         _gee_lazy_unref0 (item);
1572                         if (val) {
1573                                 *val = _vala_val;
1574                         } else {
1575                                 _gee_lazy_unref0 (_vala_val);
1576                         }
1577                         return result;
1578                 }
1579                 default:
1580                 {
1581                         g_assert_not_reached ();
1582                 }
1583         }
1584         _gee_lazy_unref0 (item);
1585         if (val) {
1586                 *val = _vala_val;
1587         } else {
1588                 _gee_lazy_unref0 (_vala_val);
1589         }
1590 }
1591
1592
1593 static GeeTraversableStream ___lambda13__gee_stream_func (GeeTraversableStream state, GeeLazy* g, GeeLazy** lazy, gpointer self) {
1594         GeeTraversableStream result;
1595         result = __lambda13_ (self, state, g, lazy);
1596         return result;
1597 }
1598
1599
1600 static GeeIterator* gee_traversable_real_filter (GeeTraversable* self, GeePredicate pred, void* pred_target, GDestroyNotify pred_target_destroy_notify) {
1601         GeeIterator* result = NULL;
1602         Block15Data* _data15_;
1603         GeePredicate _tmp0_;
1604         void* _tmp0__target;
1605         GeeIterator* _tmp1_ = NULL;
1606         _data15_ = g_slice_new0 (Block15Data);
1607         _data15_->_ref_count_ = 1;
1608         _data15_->self = g_object_ref (self);
1609         _tmp0_ = pred;
1610         _tmp0__target = pred_target;
1611         (_data15_->pred_target_destroy_notify == NULL) ? NULL : (_data15_->pred_target_destroy_notify (_data15_->pred_target), NULL);
1612         _data15_->pred = NULL;
1613         _data15_->pred_target = NULL;
1614         _data15_->pred_target_destroy_notify = NULL;
1615         _data15_->pred = _tmp0_;
1616         _data15_->pred_target = _tmp0__target;
1617         _data15_->pred_target_destroy_notify = pred_target_destroy_notify;
1618         _tmp1_ = gee_traversable_stream (self, GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_type (self), (GBoxedCopyFunc) GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_dup_func (self), GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_destroy_func (self), ___lambda13__gee_stream_func, block15_data_ref (_data15_), block15_data_unref);
1619         result = _tmp1_;
1620         block15_data_unref (_data15_);
1621         _data15_ = NULL;
1622         return result;
1623 }
1624
1625
1626 GeeIterator* gee_traversable_filter (GeeTraversable* self, GeePredicate pred, void* pred_target, GDestroyNotify pred_target_destroy_notify) {
1627         g_return_val_if_fail (self != NULL, NULL);
1628         return GEE_TRAVERSABLE_GET_INTERFACE (self)->filter (self, pred, pred_target, pred_target_destroy_notify);
1629 }
1630
1631
1632 /**
1633  * Creates a new iterator which contains elements from iterable. The
1634  * first argument states the offset i.e. number of elements the iterator
1635  * skips by default.
1636  *
1637  * Note: In {@link Iterator} implementation resulting iterator is
1638  *    {@link Iterator.valid} when parent iterator is
1639  *    {@link Iterator.valid} and the offset is 0. Using the parent
1640  *    iterator is not allowed before the inner iterator
1641  *    {@link Iterator.next} return false and then it points on its last
1642  *    element.
1643  *
1644  * @param offset the offset to first element the iterator is pointing to
1645  * @param length maximum number of elements iterator may return. Negative
1646  *        value means that the number is unbounded
1647  */
1648 static Block16Data* block16_data_ref (Block16Data* _data16_) {
1649         g_atomic_int_inc (&_data16_->_ref_count_);
1650         return _data16_;
1651 }
1652
1653
1654 static void block16_data_unref (void * _userdata_) {
1655         Block16Data* _data16_;
1656         _data16_ = (Block16Data*) _userdata_;
1657         if (g_atomic_int_dec_and_test (&_data16_->_ref_count_)) {
1658                 GeeTraversable * self;
1659                 self = _data16_->self;
1660                 _g_object_unref0 (self);
1661                 g_slice_free (Block16Data, _data16_);
1662         }
1663 }
1664
1665
1666 static GeeTraversableStream __lambda14_ (Block16Data* _data16_, GeeTraversableStream state, GeeLazy* item, GeeLazy** val) {
1667         GeeTraversable * self;
1668         GeeLazy* _vala_val = NULL;
1669         GeeTraversableStream result = 0;
1670         GeeTraversableStream _tmp0_;
1671         self = _data16_->self;
1672         _tmp0_ = state;
1673         switch (_tmp0_) {
1674                 case GEE_TRAVERSABLE_STREAM_YIELD:
1675                 {
1676                         gint _tmp1_;
1677                         _gee_lazy_unref0 (_vala_val);
1678                         _vala_val = NULL;
1679                         _tmp1_ = _data16_->offset;
1680                         if (_tmp1_ > 0) {
1681                                 result = GEE_TRAVERSABLE_STREAM_CONTINUE;
1682                                 _gee_lazy_unref0 (item);
1683                                 if (val) {
1684                                         *val = _vala_val;
1685                                 } else {
1686                                         _gee_lazy_unref0 (_vala_val);
1687                                 }
1688                                 return result;
1689                         } else {
1690                                 gint _tmp2_;
1691                                 _tmp2_ = _data16_->length;
1692                                 if (_tmp2_ > 0) {
1693                                         GeeTraversableStream _tmp3_ = 0;
1694                                         gint _tmp4_;
1695                                         GeeTraversableStream _tmp5_;
1696                                         _tmp4_ = _data16_->length;
1697                                         if (_tmp4_ != 0) {
1698                                                 _tmp3_ = GEE_TRAVERSABLE_STREAM_CONTINUE;
1699                                         } else {
1700                                                 _tmp3_ = GEE_TRAVERSABLE_STREAM_END;
1701                                         }
1702                                         _tmp5_ = _tmp3_;
1703                                         result = _tmp5_;
1704                                         _gee_lazy_unref0 (item);
1705                                         if (val) {
1706                                                 *val = _vala_val;
1707                                         } else {
1708                                                 _gee_lazy_unref0 (_vala_val);
1709                                         }
1710                                         return result;
1711                                 } else {
1712                                         gint _tmp6_;
1713                                         _tmp6_ = _data16_->length;
1714                                         if (_tmp6_ == 0) {
1715                                                 result = GEE_TRAVERSABLE_STREAM_END;
1716                                                 _gee_lazy_unref0 (item);
1717                                                 if (val) {
1718                                                         *val = _vala_val;
1719                                                 } else {
1720                                                         _gee_lazy_unref0 (_vala_val);
1721                                                 }
1722                                                 return result;
1723                                         } else {
1724                                                 result = GEE_TRAVERSABLE_STREAM_CONTINUE;
1725                                                 _gee_lazy_unref0 (item);
1726                                                 if (val) {
1727                                                         *val = _vala_val;
1728                                                 } else {
1729                                                         _gee_lazy_unref0 (_vala_val);
1730                                                 }
1731                                                 return result;
1732                                         }
1733                                 }
1734                         }
1735                 }
1736                 case GEE_TRAVERSABLE_STREAM_CONTINUE:
1737                 {
1738                         gint _tmp7_;
1739                         _tmp7_ = _data16_->offset;
1740                         if (_tmp7_ == 0) {
1741                                 GeeLazy* _tmp8_;
1742                                 GeeLazy* _tmp9_;
1743                                 gint _tmp10_;
1744                                 _tmp8_ = item;
1745                                 _tmp9_ = _gee_lazy_ref0 (_tmp8_);
1746                                 _gee_lazy_unref0 (_vala_val);
1747                                 _vala_val = _tmp9_;
1748                                 _tmp10_ = _data16_->length;
1749                                 _data16_->length = _tmp10_ - 1;
1750                                 result = GEE_TRAVERSABLE_STREAM_YIELD;
1751                                 _gee_lazy_unref0 (item);
1752                                 if (val) {
1753                                         *val = _vala_val;
1754                                 } else {
1755                                         _gee_lazy_unref0 (_vala_val);
1756                                 }
1757                                 return result;
1758                         } else {
1759                                 gint _tmp11_;
1760                                 _gee_lazy_unref0 (_vala_val);
1761                                 _vala_val = NULL;
1762                                 _tmp11_ = _data16_->offset;
1763                                 _data16_->offset = _tmp11_ - 1;
1764                                 result = GEE_TRAVERSABLE_STREAM_CONTINUE;
1765                                 _gee_lazy_unref0 (item);
1766                                 if (val) {
1767                                         *val = _vala_val;
1768                                 } else {
1769                                         _gee_lazy_unref0 (_vala_val);
1770                                 }
1771                                 return result;
1772                         }
1773                 }
1774                 case GEE_TRAVERSABLE_STREAM_END:
1775                 {
1776                         _gee_lazy_unref0 (_vala_val);
1777                         _vala_val = NULL;
1778                         result = GEE_TRAVERSABLE_STREAM_END;
1779                         _gee_lazy_unref0 (item);
1780                         if (val) {
1781                                 *val = _vala_val;
1782                         } else {
1783                                 _gee_lazy_unref0 (_vala_val);
1784                         }
1785                         return result;
1786                 }
1787                 default:
1788                 {
1789                         g_assert_not_reached ();
1790                 }
1791         }
1792         _gee_lazy_unref0 (item);
1793         if (val) {
1794                 *val = _vala_val;
1795         } else {
1796                 _gee_lazy_unref0 (_vala_val);
1797         }
1798 }
1799
1800
1801 static GeeTraversableStream ___lambda14__gee_stream_func (GeeTraversableStream state, GeeLazy* g, GeeLazy** lazy, gpointer self) {
1802         GeeTraversableStream result;
1803         result = __lambda14_ (self, state, g, lazy);
1804         return result;
1805 }
1806
1807
1808 static GeeIterator* gee_traversable_real_chop (GeeTraversable* self, gint offset, gint length) {
1809         GeeIterator* result = NULL;
1810         Block16Data* _data16_;
1811         gint _tmp0_;
1812         gint _tmp1_;
1813         gint _tmp2_;
1814         GeeIterator* _tmp3_ = NULL;
1815         _data16_ = g_slice_new0 (Block16Data);
1816         _data16_->_ref_count_ = 1;
1817         _data16_->self = g_object_ref (self);
1818         _tmp0_ = offset;
1819         _data16_->offset = _tmp0_;
1820         _tmp1_ = length;
1821         _data16_->length = _tmp1_;
1822         _tmp2_ = _data16_->offset;
1823         _vala_assert (_tmp2_ >= 0, "offset >= 0");
1824         _tmp3_ = gee_traversable_stream (self, GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_type (self), (GBoxedCopyFunc) GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_dup_func (self), GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_destroy_func (self), ___lambda14__gee_stream_func, block16_data_ref (_data16_), block16_data_unref);
1825         result = _tmp3_;
1826         block16_data_unref (_data16_);
1827         _data16_ = NULL;
1828         return result;
1829 }
1830
1831
1832 GeeIterator* gee_traversable_chop (GeeTraversable* self, gint offset, gint length) {
1833         g_return_val_if_fail (self != NULL, NULL);
1834         return GEE_TRAVERSABLE_GET_INTERFACE (self)->chop (self, offset, length);
1835 }
1836
1837
1838 GType gee_traversable_get_element_type (GeeTraversable* self) {
1839         g_return_val_if_fail (self != NULL, 0UL);
1840         return GEE_TRAVERSABLE_GET_INTERFACE (self)->get_element_type (self);
1841 }
1842
1843
1844 static GType gee_traversable_real_get_element_type (GeeTraversable* base) {
1845         GType result;
1846         GeeTraversable* self;
1847         self = base;
1848         result = GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_type (self);
1849         return result;
1850 }
1851
1852
1853 static void gee_traversable_base_init (GeeTraversableIface * iface) {
1854         static gboolean initialized = FALSE;
1855         if (!initialized) {
1856                 initialized = TRUE;
1857                 iface->stream = gee_traversable_real_stream;
1858                 iface->fold = gee_traversable_real_fold;
1859                 iface->map = gee_traversable_real_map;
1860                 iface->scan = gee_traversable_real_scan;
1861                 iface->filter = gee_traversable_real_filter;
1862                 iface->chop = gee_traversable_real_chop;
1863                 iface->get_element_type = gee_traversable_real_get_element_type;
1864         }
1865 }
1866
1867
1868 /**
1869  * It's a common interface for {@link Iterator} and {@link Iterable}. It
1870  * provides a fast, high level functions.
1871  *
1872  * ''{@link Iterator} implementation:'' Please note that most of the functions
1873  * affect the state of the iterator by moving it forward.
1874  * Even if the iterator is {@link BidirIterator} it ''must not''
1875  * rewind the state.
1876  *
1877  * ''{@link Iterable} implementation:'' validy ({@link Iterator.valid})
1878  * of returned iterator is the same as for invalid
1879  * iterator. In other words the following code is semantically equivalent:
1880  *
1881  * {{{
1882  *     var x = iterable.function (args);
1883  *     var x = iterable.iterator ().function(args);
1884  * }}}
1885  *
1886  * @since 0.7.0
1887  */
1888 GType gee_traversable_get_type (void) {
1889         static volatile gsize gee_traversable_type_id__volatile = 0;
1890         if (g_once_init_enter (&gee_traversable_type_id__volatile)) {
1891                 static const GTypeInfo g_define_type_info = { sizeof (GeeTraversableIface), (GBaseInitFunc) gee_traversable_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
1892                 GType gee_traversable_type_id;
1893                 gee_traversable_type_id = g_type_register_static (G_TYPE_INTERFACE, "GeeTraversable", &g_define_type_info, 0);
1894                 g_type_interface_add_prerequisite (gee_traversable_type_id, G_TYPE_OBJECT);
1895                 g_once_init_leave (&gee_traversable_type_id__volatile, gee_traversable_type_id);
1896         }
1897         return gee_traversable_type_id__volatile;
1898 }
1899
1900
1901