1 /* traversable.c generated by valac 0.46.6, 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 typedef gpointer (*GeeFoldFunc) (gpointer g, gpointer a, gpointer user_data);
30 typedef gboolean (*GeeForallFunc) (gpointer g, gpointer user_data);
31
32 #define GEE_TYPE_LAZY (gee_lazy_get_type ())
33 #define GEE_LAZY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_LAZY, GeeLazy))
34 #define GEE_LAZY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_LAZY, GeeLazyClass))
35 #define GEE_IS_LAZY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_LAZY))
36 #define GEE_IS_LAZY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_LAZY))
37 #define GEE_LAZY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_LAZY, GeeLazyClass))
38
39 typedef struct _GeeLazy GeeLazy;
40 typedef struct _GeeLazyClass GeeLazyClass;
41 typedef GeeLazy* (*GeeUnfoldFunc) (gpointer user_data);
42 typedef enum {
43 GEE_TRAVERSABLE_STREAM_YIELD,
44 GEE_TRAVERSABLE_STREAM_CONTINUE,
45 GEE_TRAVERSABLE_STREAM_END,
46 GEE_TRAVERSABLE_STREAM_WAIT
47 } GeeTraversableStream;
48
49 #define GEE_TRAVERSABLE_TYPE_STREAM (gee_traversable_stream_get_type ())
50 typedef GeeTraversableStream (*GeeStreamFunc) (GeeTraversableStream state, GeeLazy* g, GeeLazy* * lazy, gpointer user_data);
51 typedef gpointer (*GeeMapFunc) (gpointer g, gpointer user_data);
52 typedef gboolean (*GeePredicate) (gconstpointer g, gpointer user_data);
53
54 #define GEE_TYPE_TRAVERSABLE (gee_traversable_get_type ())
55 #define GEE_TRAVERSABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TRAVERSABLE, GeeTraversable))
56 #define GEE_IS_TRAVERSABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TRAVERSABLE))
57 #define GEE_TRAVERSABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_TRAVERSABLE, GeeTraversableIface))
58
59 typedef struct _GeeTraversable GeeTraversable;
60 typedef struct _GeeTraversableIface GeeTraversableIface;
61
62 #define GEE_TYPE_ITERATOR (gee_iterator_get_type ())
63 #define GEE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERATOR, GeeIterator))
64 #define GEE_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERATOR))
65 #define GEE_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERATOR, GeeIteratorIface))
66
67 typedef struct _GeeIterator GeeIterator;
68 typedef struct _GeeIteratorIface GeeIteratorIface;
69 typedef GeeIterator* (*GeeFlatMapFunc) (gpointer g, gpointer user_data);
70
71 #define GEE_TYPE_ITERABLE (gee_iterable_get_type ())
72 #define GEE_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ITERABLE, GeeIterable))
73 #define GEE_IS_ITERABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ITERABLE))
74 #define GEE_ITERABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_ITERABLE, GeeIterableIface))
75
76 typedef struct _GeeIterable GeeIterable;
77 typedef struct _GeeIterableIface GeeIterableIface;
78
79 #define GEE_TYPE_STREAM_ITERATOR (gee_stream_iterator_get_type ())
80 #define GEE_STREAM_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_STREAM_ITERATOR, GeeStreamIterator))
81 #define GEE_STREAM_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_STREAM_ITERATOR, GeeStreamIteratorClass))
82 #define GEE_IS_STREAM_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_STREAM_ITERATOR))
83 #define GEE_IS_STREAM_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_STREAM_ITERATOR))
84 #define GEE_STREAM_ITERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_STREAM_ITERATOR, GeeStreamIteratorClass))
85
86 typedef struct _GeeStreamIterator GeeStreamIterator;
87 typedef struct _GeeStreamIteratorClass GeeStreamIteratorClass;
88 #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
89 #define _a_destroy_func0(var) (((var == NULL) || (a_destroy_func == NULL)) ? NULL : (var = (a_destroy_func (var), NULL)))
90 typedef struct _Block15Data Block15Data;
91 typedef struct _Block16Data Block16Data;
92 #define _gee_lazy_unref0(var) ((var == NULL) ? NULL : (var = (gee_lazy_unref (var), NULL)))
93 typedef struct _Block17Data Block17Data;
94 typedef gpointer (*GeeLazyFunc) (gpointer user_data);
95 typedef struct _Block18Data Block18Data;
96 typedef struct _Block19Data Block19Data;
97 typedef struct _Block20Data Block20Data;
98 typedef struct _Block21Data Block21Data;
99 typedef struct _Block22Data Block22Data;
100 typedef struct _Block23Data Block23Data;
101 typedef struct _Block24Data Block24Data;
102
103 #define GEE_TEE_ITERATOR_TYPE_NODE (gee_tee_iterator_node_get_type ())
104 #define GEE_TEE_ITERATOR_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TEE_ITERATOR_TYPE_NODE, GeeTeeIteratorNode))
105 #define GEE_TEE_ITERATOR_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TEE_ITERATOR_TYPE_NODE, GeeTeeIteratorNodeClass))
106 #define GEE_TEE_ITERATOR_IS_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TEE_ITERATOR_TYPE_NODE))
107 #define GEE_TEE_ITERATOR_IS_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TEE_ITERATOR_TYPE_NODE))
108 #define GEE_TEE_ITERATOR_NODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TEE_ITERATOR_TYPE_NODE, GeeTeeIteratorNodeClass))
109
110 typedef struct _GeeTeeIteratorNode GeeTeeIteratorNode;
111 typedef struct _GeeTeeIteratorNodeClass GeeTeeIteratorNodeClass;
112
113 #define GEE_TYPE_TEE_ITERATOR (gee_tee_iterator_get_type ())
114 #define GEE_TEE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEE_ITERATOR, GeeTeeIterator))
115 #define GEE_TEE_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEE_ITERATOR, GeeTeeIteratorClass))
116 #define GEE_IS_TEE_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEE_ITERATOR))
117 #define GEE_IS_TEE_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEE_ITERATOR))
118 #define GEE_TEE_ITERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEE_ITERATOR, GeeTeeIteratorClass))
119
120 typedef struct _GeeTeeIterator GeeTeeIterator;
121 typedef struct _GeeTeeIteratorClass GeeTeeIteratorClass;
122 #define _gee_tee_iterator_node_unref0(var) ((var == NULL) ? NULL : (var = (gee_tee_iterator_node_unref (var), NULL)))
123 typedef struct _Block25Data Block25Data;
124 typedef struct _Block26Data Block26Data;
125 typedef struct _Block27Data Block27Data;
126 typedef struct _Block28Data Block28Data;
127
128 #define GEE_TYPE_ABSTRACT_COLLECTION (gee_abstract_collection_get_type ())
129 #define GEE_ABSTRACT_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection))
130 #define GEE_ABSTRACT_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollectionClass))
131 #define GEE_IS_ABSTRACT_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_COLLECTION))
132 #define GEE_IS_ABSTRACT_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_COLLECTION))
133 #define GEE_ABSTRACT_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollectionClass))
134
135 typedef struct _GeeAbstractCollection GeeAbstractCollection;
136 typedef struct _GeeAbstractCollectionClass GeeAbstractCollectionClass;
137
138 #define GEE_TYPE_ABSTRACT_LIST (gee_abstract_list_get_type ())
139 #define GEE_ABSTRACT_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_LIST, GeeAbstractList))
140 #define GEE_ABSTRACT_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_LIST, GeeAbstractListClass))
141 #define GEE_IS_ABSTRACT_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_LIST))
142 #define GEE_IS_ABSTRACT_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_LIST))
143 #define GEE_ABSTRACT_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_LIST, GeeAbstractListClass))
144
145 typedef struct _GeeAbstractList GeeAbstractList;
146 typedef struct _GeeAbstractListClass GeeAbstractListClass;
147
148 #define GEE_TYPE_ABSTRACT_BIDIR_LIST (gee_abstract_bidir_list_get_type ())
149 #define GEE_ABSTRACT_BIDIR_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ABSTRACT_BIDIR_LIST, GeeAbstractBidirList))
150 #define GEE_ABSTRACT_BIDIR_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ABSTRACT_BIDIR_LIST, GeeAbstractBidirListClass))
151 #define GEE_IS_ABSTRACT_BIDIR_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ABSTRACT_BIDIR_LIST))
152 #define GEE_IS_ABSTRACT_BIDIR_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ABSTRACT_BIDIR_LIST))
153 #define GEE_ABSTRACT_BIDIR_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ABSTRACT_BIDIR_LIST, GeeAbstractBidirListClass))
154
155 typedef struct _GeeAbstractBidirList GeeAbstractBidirList;
156 typedef struct _GeeAbstractBidirListClass GeeAbstractBidirListClass;
157
158 #define GEE_TYPE_ARRAY_LIST (gee_array_list_get_type ())
159 #define GEE_ARRAY_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ARRAY_LIST, GeeArrayList))
160 #define GEE_ARRAY_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ARRAY_LIST, GeeArrayListClass))
161 #define GEE_IS_ARRAY_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ARRAY_LIST))
162 #define GEE_IS_ARRAY_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ARRAY_LIST))
163 #define GEE_ARRAY_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ARRAY_LIST, GeeArrayListClass))
164
165 typedef struct _GeeArrayList GeeArrayList;
166 typedef struct _GeeArrayListClass GeeArrayListClass;
167 typedef struct _Block29Data Block29Data;
168 typedef gboolean (*GeeEqualDataFunc) (gconstpointer a, gconstpointer b, gpointer user_data);
169
170 #define GEE_TYPE_LIST (gee_list_get_type ())
171 #define GEE_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_LIST, GeeList))
172 #define GEE_IS_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_LIST))
173 #define GEE_LIST_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_LIST, GeeListIface))
174
175 typedef struct _GeeList GeeList;
176 typedef struct _GeeListIface GeeListIface;
177
178 #define GEE_TYPE_COLLECTION (gee_collection_get_type ())
179 #define GEE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_COLLECTION, GeeCollection))
180 #define GEE_IS_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_COLLECTION))
181 #define GEE_COLLECTION_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_COLLECTION, GeeCollectionIface))
182
183 typedef struct _GeeCollection GeeCollection;
184 typedef struct _GeeCollectionIface GeeCollectionIface;
185
186 #define GEE_TYPE_LIST_ITERATOR (gee_list_iterator_get_type ())
187 #define GEE_LIST_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_LIST_ITERATOR, GeeListIterator))
188 #define GEE_IS_LIST_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_LIST_ITERATOR))
189 #define GEE_LIST_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_LIST_ITERATOR, GeeListIteratorIface))
190
191 typedef struct _GeeListIterator GeeListIterator;
192 typedef struct _GeeListIteratorIface GeeListIteratorIface;
193 #define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
194 #define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
195 #define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
196 #define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
197
198 struct _GeeIteratorIface {
199 GTypeInterface parent_iface;
200 gboolean (*next) (GeeIterator* self);
201 gboolean (*has_next) (GeeIterator* self);
202 gpointer (*get) (GeeIterator* self);
203 void (*remove) (GeeIterator* self);
204 gboolean (*get_valid) (GeeIterator* self);
205 gboolean (*get_read_only) (GeeIterator* self);
206 };
207
208 struct _GeeTraversableIface {
209 GTypeInterface parent_iface;
210 GType (*get_g_type) (GeeTraversable* self);
211 GBoxedCopyFunc (*get_g_dup_func) (GeeTraversable* self);
212 GDestroyNotify (*get_g_destroy_func) (GeeTraversable* self);
213 gboolean (*foreach) (GeeTraversable* self, GeeForallFunc f, gpointer f_target);
214 GeeIterator* (*stream) (GeeTraversable* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeStreamFunc f, gpointer f_target, GDestroyNotify f_target_destroy_notify);
215 gpointer (*fold) (GeeTraversable* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeFoldFunc f, gpointer f_target, gpointer seed);
216 GeeIterator* (*map) (GeeTraversable* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeMapFunc f, gpointer f_target);
217 GeeIterator* (*scan) (GeeTraversable* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeFoldFunc f, gpointer f_target, gpointer seed);
218 GeeIterator* (*filter) (GeeTraversable* self, GeePredicate pred, gpointer pred_target, GDestroyNotify pred_target_destroy_notify);
219 GeeIterator* (*chop) (GeeTraversable* self, gint offset, gint length);
220 GType (*get_element_type) (GeeTraversable* self);
221 GeeIterator* (*flat_map) (GeeTraversable* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeFlatMapFunc f, gpointer f_target, GDestroyNotify f_target_destroy_notify);
222 GeeIterator** (*tee) (GeeTraversable* self, guint forks, gint* result_length1);
223 gpointer (*first_match) (GeeTraversable* self, GeePredicate pred, gpointer pred_target, GDestroyNotify pred_target_destroy_notify);
224 gboolean (*any_match) (GeeTraversable* self, GeePredicate pred, gpointer pred_target, GDestroyNotify pred_target_destroy_notify);
225 gboolean (*all_match) (GeeTraversable* self, GeePredicate pred, gpointer pred_target, GDestroyNotify pred_target_destroy_notify);
226 gpointer (*max) (GeeTraversable* self, GCompareDataFunc compare, gpointer compare_target, GDestroyNotify compare_target_destroy_notify);
227 gpointer (*min) (GeeTraversable* self, GCompareDataFunc compare, gpointer compare_target, GDestroyNotify compare_target_destroy_notify);
228 GeeIterator* (*order_by) (GeeTraversable* self, GCompareDataFunc compare, gpointer compare_target, GDestroyNotify compare_target_destroy_notify);
229 };
230
231 struct _GeeIterableIface {
232 GTypeInterface parent_iface;
233 GType (*get_g_type) (GeeIterable* self);
234 GBoxedCopyFunc (*get_g_dup_func) (GeeIterable* self);
235 GDestroyNotify (*get_g_destroy_func) (GeeIterable* self);
236 GeeIterator* (*iterator) (GeeIterable* self);
237 };
238
239 struct _Block15Data {
240 int _ref_count_;
241 GeeTraversable* self;
242 GType a_type;
243 GBoxedCopyFunc a_dup_func;
244 GDestroyNotify a_destroy_func;
245 GeeFoldFunc f;
246 gpointer f_target;
247 gpointer seed;
248 };
249
250 struct _Block16Data {
251 int _ref_count_;
252 GeeTraversable* self;
253 GType a_type;
254 GBoxedCopyFunc a_dup_func;
255 GDestroyNotify a_destroy_func;
256 GeeMapFunc f;
257 gpointer f_target;
258 };
259
260 struct _Block17Data {
261 int _ref_count_;
262 Block16Data * _data16_;
263 GeeLazy* item;
264 };
265
266 struct _Block18Data {
267 int _ref_count_;
268 GeeTraversable* self;
269 GType a_type;
270 GBoxedCopyFunc a_dup_func;
271 GDestroyNotify a_destroy_func;
272 gboolean seed_emitted;
273 GeeFoldFunc f;
274 gpointer f_target;
275 gpointer seed;
276 };
277
278 struct _Block19Data {
279 int _ref_count_;
280 Block18Data * _data18_;
281 GeeLazy* item;
282 };
283
284 struct _Block20Data {
285 int _ref_count_;
286 GeeTraversable* self;
287 GeePredicate pred;
288 gpointer pred_target;
289 GDestroyNotify pred_target_destroy_notify;
290 };
291
292 struct _Block21Data {
293 int _ref_count_;
294 GeeTraversable* self;
295 gint offset;
296 gint length;
297 };
298
299 struct _Block22Data {
300 int _ref_count_;
301 GeeTraversable* self;
302 GType a_type;
303 GBoxedCopyFunc a_dup_func;
304 GDestroyNotify a_destroy_func;
305 GeeIterator* current;
306 GeeFlatMapFunc f;
307 gpointer f_target;
308 GDestroyNotify f_target_destroy_notify;
309 };
310
311 struct _Block23Data {
312 int _ref_count_;
313 Block22Data * _data22_;
314 };
315
316 struct _Block24Data {
317 int _ref_count_;
318 GeeTraversable* self;
319 GeeIterator* _self_;
320 };
321
322 struct _Block25Data {
323 int _ref_count_;
324 GeeTraversable* self;
325 gpointer _result_;
326 GeePredicate pred;
327 gpointer pred_target;
328 GDestroyNotify pred_target_destroy_notify;
329 };
330
331 struct _Block26Data {
332 int _ref_count_;
333 GeeTraversable* self;
334 gboolean _result_;
335 GeePredicate pred;
336 gpointer pred_target;
337 GDestroyNotify pred_target_destroy_notify;
338 };
339
340 struct _Block27Data {
341 int _ref_count_;
342 GeeTraversable* self;
343 gpointer max_value;
344 GCompareDataFunc compare;
345 gpointer compare_target;
346 GDestroyNotify compare_target_destroy_notify;
347 };
348
349 struct _Block28Data {
350 int _ref_count_;
351 GeeTraversable* self;
352 gpointer min_value;
353 GCompareDataFunc compare;
354 gpointer compare_target;
355 GDestroyNotify compare_target_destroy_notify;
356 };
357
358 struct _Block29Data {
359 int _ref_count_;
360 GeeTraversable* self;
361 GeeArrayList* _result_;
362 };
363
364 struct _GeeCollectionIface {
365 GTypeInterface parent_iface;
366 GType (*get_g_type) (GeeCollection* self);
367 GBoxedCopyFunc (*get_g_dup_func) (GeeCollection* self);
368 GDestroyNotify (*get_g_destroy_func) (GeeCollection* self);
369 gboolean (*contains) (GeeCollection* self, gconstpointer item);
370 gboolean (*add) (GeeCollection* self, gconstpointer item);
371 gboolean (*remove) (GeeCollection* self, gconstpointer item);
372 void (*clear) (GeeCollection* self);
373 gboolean (*add_all) (GeeCollection* self, GeeCollection* collection);
374 gboolean (*contains_all) (GeeCollection* self, GeeCollection* collection);
375 gboolean (*remove_all) (GeeCollection* self, GeeCollection* collection);
376 gboolean (*retain_all) (GeeCollection* self, GeeCollection* collection);
377 gpointer* (*to_array) (GeeCollection* self, gint* result_length1);
378 gint (*get_size) (GeeCollection* self);
379 gboolean (*get_is_empty) (GeeCollection* self);
380 gboolean (*get_read_only) (GeeCollection* self);
381 GeeCollection* (*get_read_only_view) (GeeCollection* self);
382 gboolean (*add_all_array) (GeeCollection* self, gpointer* array, gint array_length1);
383 gboolean (*contains_all_array) (GeeCollection* self, gpointer* array, gint array_length1);
384 gboolean (*remove_all_array) (GeeCollection* self, gpointer* array, gint array_length1);
385 gboolean (*add_all_iterator) (GeeCollection* self, GeeIterator* iter);
386 gboolean (*contains_all_iterator) (GeeCollection* self, GeeIterator* iter);
387 gboolean (*remove_all_iterator) (GeeCollection* self, GeeIterator* iter);
388 };
389
390 struct _GeeListIteratorIface {
391 GTypeInterface parent_iface;
392 void (*set) (GeeListIterator* self, gconstpointer item);
393 void (*add) (GeeListIterator* self, gconstpointer item);
394 gint (*index) (GeeListIterator* self);
395 };
396
397 struct _GeeListIface {
398 GTypeInterface parent_iface;
399 GType (*get_g_type) (GeeList* self);
400 GBoxedCopyFunc (*get_g_dup_func) (GeeList* self);
401 GDestroyNotify (*get_g_destroy_func) (GeeList* self);
402 GeeListIterator* (*list_iterator) (GeeList* self);
403 gpointer (*get) (GeeList* self, gint index);
404 void (*set) (GeeList* self, gint index, gconstpointer item);
405 gint (*index_of) (GeeList* self, gconstpointer item);
406 void (*insert) (GeeList* self, gint index, gconstpointer item);
407 gpointer (*remove_at) (GeeList* self, gint index);
408 GeeList* (*slice) (GeeList* self, gint start, gint stop);
409 gpointer (*first) (GeeList* self);
410 gpointer (*last) (GeeList* self);
411 void (*insert_all) (GeeList* self, gint index, GeeCollection* collection);
412 void (*sort) (GeeList* self, GCompareDataFunc compare_func, gpointer compare_func_target, GDestroyNotify compare_func_target_destroy_notify);
413 GeeList* (*get_read_only_view) (GeeList* self);
414 };
415
416 gpointer gee_lazy_ref (gpointer instance);
417 void gee_lazy_unref (gpointer instance);
418 GParamSpec* gee_param_spec_lazy (const gchar* name,
419 const gchar* nick,
420 const gchar* blurb,
421 GType object_type,
422 GParamFlags flags);
423 void gee_value_set_lazy (GValue* value,
424 gpointer v_object);
425 void gee_value_take_lazy (GValue* value,
426 gpointer v_object);
427 gpointer gee_value_get_lazy (const GValue* value);
428 GType gee_lazy_get_type (void) G_GNUC_CONST;
429 G_DEFINE_AUTOPTR_CLEANUP_FUNC (GeeLazy, gee_lazy_unref)
430 GType gee_traversable_stream_get_type (void) G_GNUC_CONST;
431 GType gee_iterator_get_type (void) G_GNUC_CONST;
432 GType gee_traversable_get_type (void) G_GNUC_CONST;
433 gboolean gee_traversable_foreach (GeeTraversable* self,
434 GeeForallFunc f,
435 gpointer f_target);
436 GeeIterator* gee_traversable_stream (GeeTraversable* self,
437 GType a_type,
438 GBoxedCopyFunc a_dup_func,
439 GDestroyNotify a_destroy_func,
440 GeeStreamFunc f,
441 gpointer f_target,
442 GDestroyNotify f_target_destroy_notify);
443 static GeeIterator* gee_traversable_real_stream (GeeTraversable* self,
444 GType a_type,
445 GBoxedCopyFunc a_dup_func,
446 GDestroyNotify a_destroy_func,
447 GeeStreamFunc f,
448 gpointer f_target,
449 GDestroyNotify f_target_destroy_notify);
450 GType gee_iterable_get_type (void) G_GNUC_CONST;
451 G_GNUC_INTERNAL GeeStreamIterator* gee_stream_iterator_new (GType a_type,
452 GBoxedCopyFunc a_dup_func,
453 GDestroyNotify a_destroy_func,
454 GType g_type,
455 GBoxedCopyFunc g_dup_func,
456 GDestroyNotify g_destroy_func,
457 GeeIterator* outer,
458 GeeStreamFunc func,
459 gpointer func_target,
460 GDestroyNotify func_target_destroy_notify);
461 G_GNUC_INTERNAL GeeStreamIterator* gee_stream_iterator_construct (GType object_type,
462 GType a_type,
463 GBoxedCopyFunc a_dup_func,
464 GDestroyNotify a_destroy_func,
465 GType g_type,
466 GBoxedCopyFunc g_dup_func,
467 GDestroyNotify g_destroy_func,
468 GeeIterator* outer,
469 GeeStreamFunc func,
470 gpointer func_target,
471 GDestroyNotify func_target_destroy_notify);
472 G_GNUC_INTERNAL GType gee_stream_iterator_get_type (void) G_GNUC_CONST G_GNUC_UNUSED;
473 G_DEFINE_AUTOPTR_CLEANUP_FUNC (GeeStreamIterator, g_object_unref)
474 GeeIterator* gee_iterable_iterator (GeeIterable* self);
475 gpointer gee_traversable_fold (GeeTraversable* self,
476 GType a_type,
477 GBoxedCopyFunc a_dup_func,
478 GDestroyNotify a_destroy_func,
479 GeeFoldFunc f,
480 gpointer f_target,
481 gpointer seed);
482 static gpointer gee_traversable_real_fold (GeeTraversable* self,
483 GType a_type,
484 GBoxedCopyFunc a_dup_func,
485 GDestroyNotify a_destroy_func,
486 GeeFoldFunc f,
487 gpointer f_target,
488 gpointer seed);
489 static Block15Data* block15_data_ref (Block15Data* _data15_);
490 static void block15_data_unref (void * _userdata_);
491 static gboolean __lambda11_ (Block15Data* _data15_,
492 gpointer item);
493 static gboolean ___lambda11__gee_forall_func (gpointer g,
494 gpointer self);
495 GeeIterator* gee_traversable_map (GeeTraversable* self,
496 GType a_type,
497 GBoxedCopyFunc a_dup_func,
498 GDestroyNotify a_destroy_func,
499 GeeMapFunc f,
500 gpointer f_target);
501 static GeeIterator* gee_traversable_real_map (GeeTraversable* self,
502 GType a_type,
503 GBoxedCopyFunc a_dup_func,
504 GDestroyNotify a_destroy_func,
505 GeeMapFunc f,
506 gpointer f_target);
507 static Block16Data* block16_data_ref (Block16Data* _data16_);
508 static void block16_data_unref (void * _userdata_);
509 static GeeTraversableStream __lambda12_ (Block16Data* _data16_,
510 GeeTraversableStream state,
511 GeeLazy* item,
512 GeeLazy* * val);
513 static Block17Data* block17_data_ref (Block17Data* _data17_);
514 static void block17_data_unref (void * _userdata_);
515 static gpointer ___lambda13_ (Block17Data* _data17_);
516 gpointer gee_lazy_get (GeeLazy* self);
517 static gpointer ____lambda13__gee_lazy_func (gpointer self);
518 GeeLazy* gee_lazy_new (GType g_type,
519 GBoxedCopyFunc g_dup_func,
520 GDestroyNotify g_destroy_func,
521 GeeLazyFunc func,
522 gpointer func_target,
523 GDestroyNotify func_target_destroy_notify);
524 GeeLazy* gee_lazy_construct (GType object_type,
525 GType g_type,
526 GBoxedCopyFunc g_dup_func,
527 GDestroyNotify g_destroy_func,
528 GeeLazyFunc func,
529 gpointer func_target,
530 GDestroyNotify func_target_destroy_notify);
531 static GeeTraversableStream ___lambda12__gee_stream_func (GeeTraversableStream state,
532 GeeLazy* g,
533 GeeLazy* * lazy,
534 gpointer self);
535 GeeIterator* gee_traversable_scan (GeeTraversable* self,
536 GType a_type,
537 GBoxedCopyFunc a_dup_func,
538 GDestroyNotify a_destroy_func,
539 GeeFoldFunc f,
540 gpointer f_target,
541 gpointer seed);
542 static GeeIterator* gee_traversable_real_scan (GeeTraversable* self,
543 GType a_type,
544 GBoxedCopyFunc a_dup_func,
545 GDestroyNotify a_destroy_func,
546 GeeFoldFunc f,
547 gpointer f_target,
548 gpointer seed);
549 static Block18Data* block18_data_ref (Block18Data* _data18_);
550 static void block18_data_unref (void * _userdata_);
551 static GeeTraversableStream __lambda14_ (Block18Data* _data18_,
552 GeeTraversableStream state,
553 GeeLazy* item,
554 GeeLazy* * val);
555 static Block19Data* block19_data_ref (Block19Data* _data19_);
556 static void block19_data_unref (void * _userdata_);
557 GeeLazy* gee_lazy_new_from_value (GType g_type,
558 GBoxedCopyFunc g_dup_func,
559 GDestroyNotify g_destroy_func,
560 gconstpointer item);
561 GeeLazy* gee_lazy_construct_from_value (GType object_type,
562 GType g_type,
563 GBoxedCopyFunc g_dup_func,
564 GDestroyNotify g_destroy_func,
565 gconstpointer item);
566 static gpointer ___lambda15_ (Block19Data* _data19_);
567 static gpointer ____lambda15__gee_lazy_func (gpointer self);
568 static GeeTraversableStream ___lambda14__gee_stream_func (GeeTraversableStream state,
569 GeeLazy* g,
570 GeeLazy* * lazy,
571 gpointer self);
572 GeeIterator* gee_traversable_filter (GeeTraversable* self,
573 GeePredicate pred,
574 gpointer pred_target,
575 GDestroyNotify pred_target_destroy_notify);
576 static GeeIterator* gee_traversable_real_filter (GeeTraversable* self,
577 GeePredicate pred,
578 gpointer pred_target,
579 GDestroyNotify pred_target_destroy_notify);
580 static Block20Data* block20_data_ref (Block20Data* _data20_);
581 static void block20_data_unref (void * _userdata_);
582 static GeeTraversableStream __lambda16_ (Block20Data* _data20_,
583 GeeTraversableStream state,
584 GeeLazy* item,
585 GeeLazy* * val);
586 static GeeTraversableStream ___lambda16__gee_stream_func (GeeTraversableStream state,
587 GeeLazy* g,
588 GeeLazy* * lazy,
589 gpointer self);
590 GeeIterator* gee_traversable_chop (GeeTraversable* self,
591 gint offset,
592 gint length);
593 static GeeIterator* gee_traversable_real_chop (GeeTraversable* self,
594 gint offset,
595 gint length);
596 static Block21Data* block21_data_ref (Block21Data* _data21_);
597 static void block21_data_unref (void * _userdata_);
598 static GeeTraversableStream __lambda17_ (Block21Data* _data21_,
599 GeeTraversableStream state,
600 GeeLazy* item,
601 GeeLazy* * val);
602 static GeeTraversableStream ___lambda17__gee_stream_func (GeeTraversableStream state,
603 GeeLazy* g,
604 GeeLazy* * lazy,
605 gpointer self);
606 GeeIterator* gee_traversable_flat_map (GeeTraversable* self,
607 GType a_type,
608 GBoxedCopyFunc a_dup_func,
609 GDestroyNotify a_destroy_func,
610 GeeFlatMapFunc f,
611 gpointer f_target,
612 GDestroyNotify f_target_destroy_notify);
613 static GeeIterator* gee_traversable_real_flat_map (GeeTraversable* self,
614 GType a_type,
615 GBoxedCopyFunc a_dup_func,
616 GDestroyNotify a_destroy_func,
617 GeeFlatMapFunc f,
618 gpointer f_target,
619 GDestroyNotify f_target_destroy_notify);
620 static Block22Data* block22_data_ref (Block22Data* _data22_);
621 static void block22_data_unref (void * _userdata_);
622 static GeeTraversableStream __lambda18_ (Block22Data* _data22_,
623 GeeTraversableStream state,
624 GeeLazy* item,
625 GeeLazy* * val);
626 static Block23Data* block23_data_ref (Block23Data* _data23_);
627 static void block23_data_unref (void * _userdata_);
628 gboolean gee_iterator_next (GeeIterator* self);
629 static gpointer ____lambda19_ (Block23Data* _data23_);
630 gpointer gee_iterator_get (GeeIterator* self);
631 static gpointer _____lambda19__gee_lazy_func (gpointer self);
632 gboolean gee_iterator_get_valid (GeeIterator* self);
633 static gpointer ____lambda20_ (Block23Data* _data23_);
634 static gpointer _____lambda20__gee_lazy_func (gpointer self);
635 static gpointer ____lambda21_ (Block23Data* _data23_);
636 static gpointer _____lambda21__gee_lazy_func (gpointer self);
637 static GeeTraversableStream ___lambda18__gee_stream_func (GeeTraversableStream state,
638 GeeLazy* g,
639 GeeLazy* * lazy,
640 gpointer self);
641 GeeIterator** gee_traversable_tee (GeeTraversable* self,
642 guint forks,
643 gint* result_length1);
644 static GeeIterator** gee_traversable_real_tee (GeeTraversable* self,
645 guint forks,
646 gint* result_length1);
647 static Block24Data* block24_data_ref (Block24Data* _data24_);
648 static void block24_data_unref (void * _userdata_);
649 static gpointer ______lambda22_ (Block24Data* _data24_);
650 static gpointer _______lambda22__gee_lazy_func (gpointer self);
651 G_GNUC_INTERNAL gpointer gee_tee_iterator_node_ref (gpointer instance);
652 G_GNUC_INTERNAL void gee_tee_iterator_node_unref (gpointer instance);
653 G_GNUC_INTERNAL GParamSpec* gee_tee_iterator_param_spec_node (const gchar* name,
654 const gchar* nick,
655 const gchar* blurb,
656 GType object_type,
657 GParamFlags flags);
658 G_GNUC_INTERNAL void gee_tee_iterator_value_set_node (GValue* value,
659 gpointer v_object) G_GNUC_UNUSED;
660 G_GNUC_INTERNAL void gee_tee_iterator_value_take_node (GValue* value,
661 gpointer v_object);
662 G_GNUC_INTERNAL gpointer gee_tee_iterator_value_get_node (const GValue* value) G_GNUC_UNUSED;
663 G_GNUC_INTERNAL GType gee_tee_iterator_node_get_type (void) G_GNUC_CONST G_GNUC_UNUSED;
664 G_DEFINE_AUTOPTR_CLEANUP_FUNC (GeeTeeIteratorNode, gee_tee_iterator_node_unref)
665 G_GNUC_INTERNAL GeeLazy* gee_tee_iterator_create_nodes (GType g_type,
666 GBoxedCopyFunc g_dup_func,
667 GDestroyNotify g_destroy_func,
668 GeeIterator* iterator,
669 GeeLazy* dependent);
670 G_GNUC_INTERNAL GeeTeeIteratorNode* gee_tee_iterator_node_new (GType g_type,
671 GBoxedCopyFunc g_dup_func,
672 GDestroyNotify g_destroy_func,
673 GeeLazy* data,
674 GeeLazy* next);
675 G_GNUC_INTERNAL GeeTeeIteratorNode* gee_tee_iterator_node_construct (GType object_type,
676 GType g_type,
677 GBoxedCopyFunc g_dup_func,
678 GDestroyNotify g_destroy_func,
679 GeeLazy* data,
680 GeeLazy* next);
681 G_GNUC_INTERNAL GeeTeeIterator* gee_tee_iterator_new (GType g_type,
682 GBoxedCopyFunc g_dup_func,
683 GDestroyNotify g_destroy_func,
684 GeeTeeIteratorNode* head,
685 gboolean valid);
686 G_GNUC_INTERNAL GeeTeeIterator* gee_tee_iterator_construct (GType object_type,
687 GType g_type,
688 GBoxedCopyFunc g_dup_func,
689 GDestroyNotify g_destroy_func,
690 GeeTeeIteratorNode* head,
691 gboolean valid);
692 G_GNUC_INTERNAL GType gee_tee_iterator_get_type (void) G_GNUC_CONST G_GNUC_UNUSED;
693 G_DEFINE_AUTOPTR_CLEANUP_FUNC (GeeTeeIterator, g_object_unref)
694 gpointer gee_traversable_first_match (GeeTraversable* self,
695 GeePredicate pred,
696 gpointer pred_target,
697 GDestroyNotify pred_target_destroy_notify);
698 static gpointer gee_traversable_real_first_match (GeeTraversable* self,
699 GeePredicate pred,
700 gpointer pred_target,
701 GDestroyNotify pred_target_destroy_notify);
702 static Block25Data* block25_data_ref (Block25Data* _data25_);
703 static void block25_data_unref (void * _userdata_);
704 static gboolean __lambda25_ (Block25Data* _data25_,
705 gpointer item);
706 static gboolean ___lambda25__gee_forall_func (gpointer g,
707 gpointer self);
708 gboolean gee_traversable_any_match (GeeTraversable* self,
709 GeePredicate pred,
710 gpointer pred_target,
711 GDestroyNotify pred_target_destroy_notify);
712 static gboolean gee_traversable_real_any_match (GeeTraversable* self,
713 GeePredicate pred,
714 gpointer pred_target,
715 GDestroyNotify pred_target_destroy_notify);
716 gboolean gee_traversable_all_match (GeeTraversable* self,
717 GeePredicate pred,
718 gpointer pred_target,
719 GDestroyNotify pred_target_destroy_notify);
720 static gboolean gee_traversable_real_all_match (GeeTraversable* self,
721 GeePredicate pred,
722 gpointer pred_target,
723 GDestroyNotify pred_target_destroy_notify);
724 static Block26Data* block26_data_ref (Block26Data* _data26_);
725 static void block26_data_unref (void * _userdata_);
726 static gboolean __lambda26_ (Block26Data* _data26_,
727 gpointer item);
728 static gboolean ___lambda26__gee_forall_func (gpointer g,
729 gpointer self);
730 gpointer gee_traversable_max (GeeTraversable* self,
731 GCompareDataFunc compare,
732 gpointer compare_target,
733 GDestroyNotify compare_target_destroy_notify);
734 static gpointer gee_traversable_real_max (GeeTraversable* self,
735 GCompareDataFunc compare,
736 gpointer compare_target,
737 GDestroyNotify compare_target_destroy_notify);
738 static Block27Data* block27_data_ref (Block27Data* _data27_);
739 static void block27_data_unref (void * _userdata_);
740 static gboolean __lambda27_ (Block27Data* _data27_,
741 gpointer item);
742 static gboolean ___lambda27__gee_forall_func (gpointer g,
743 gpointer self);
744 gpointer gee_traversable_min (GeeTraversable* self,
745 GCompareDataFunc compare,
746 gpointer compare_target,
747 GDestroyNotify compare_target_destroy_notify);
748 static gpointer gee_traversable_real_min (GeeTraversable* self,
749 GCompareDataFunc compare,
750 gpointer compare_target,
751 GDestroyNotify compare_target_destroy_notify);
752 static Block28Data* block28_data_ref (Block28Data* _data28_);
753 static void block28_data_unref (void * _userdata_);
754 static gboolean __lambda28_ (Block28Data* _data28_,
755 gpointer item);
756 static gboolean ___lambda28__gee_forall_func (gpointer g,
757 gpointer self);
758 GeeIterator* gee_traversable_order_by (GeeTraversable* self,
759 GCompareDataFunc compare,
760 gpointer compare_target,
761 GDestroyNotify compare_target_destroy_notify);
762 static GeeIterator* gee_traversable_real_order_by (GeeTraversable* self,
763 GCompareDataFunc compare,
764 gpointer compare_target,
765 GDestroyNotify compare_target_destroy_notify);
766 GType gee_abstract_collection_get_type (void) G_GNUC_CONST;
767 G_DEFINE_AUTOPTR_CLEANUP_FUNC (GeeAbstractCollection, g_object_unref)
768 GType gee_abstract_list_get_type (void) G_GNUC_CONST;
769 G_DEFINE_AUTOPTR_CLEANUP_FUNC (GeeAbstractList, g_object_unref)
770 GType gee_abstract_bidir_list_get_type (void) G_GNUC_CONST;
771 G_DEFINE_AUTOPTR_CLEANUP_FUNC (GeeAbstractBidirList, g_object_unref)
772 GType gee_array_list_get_type (void) G_GNUC_CONST;
773 G_DEFINE_AUTOPTR_CLEANUP_FUNC (GeeArrayList, g_object_unref)
774 static Block29Data* block29_data_ref (Block29Data* _data29_);
775 static void block29_data_unref (void * _userdata_);
776 GeeArrayList* gee_array_list_new (GType g_type,
777 GBoxedCopyFunc g_dup_func,
778 GDestroyNotify g_destroy_func,
779 GeeEqualDataFunc equal_func,
780 gpointer equal_func_target,
781 GDestroyNotify equal_func_target_destroy_notify);
782 GeeArrayList* gee_array_list_construct (GType object_type,
783 GType g_type,
784 GBoxedCopyFunc g_dup_func,
785 GDestroyNotify g_destroy_func,
786 GeeEqualDataFunc equal_func,
787 gpointer equal_func_target,
788 GDestroyNotify equal_func_target_destroy_notify);
789 static gboolean __lambda48_ (Block29Data* _data29_,
790 gpointer item);
791 gboolean gee_abstract_collection_add (GeeAbstractCollection* self,
792 gconstpointer item);
793 static gboolean ___lambda48__gee_forall_func (gpointer g,
794 gpointer self);
795 GType gee_collection_get_type (void) G_GNUC_CONST;
796 GType gee_list_iterator_get_type (void) G_GNUC_CONST;
797 GType gee_list_get_type (void) G_GNUC_CONST;
798 void gee_list_sort (GeeList* self,
799 GCompareDataFunc compare_func,
800 gpointer compare_func_target,
801 GDestroyNotify compare_func_target_destroy_notify);
802 GeeIterator* gee_abstract_collection_iterator (GeeAbstractCollection* self);
803 GType gee_traversable_get_element_type (GeeTraversable* self);
804 static void _vala_array_destroy (gpointer array,
805 gint array_length,
806 GDestroyNotify destroy_func);
807 static void _vala_array_free (gpointer array,
808 gint array_length,
809 GDestroyNotify destroy_func);
810
811 GType
gee_traversable_stream_get_type(void)812 gee_traversable_stream_get_type (void)
813 {
814 static volatile gsize gee_traversable_stream_type_id__volatile = 0;
815 if (g_once_init_enter (&gee_traversable_stream_type_id__volatile)) {
816 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"}, {GEE_TRAVERSABLE_STREAM_WAIT, "GEE_TRAVERSABLE_STREAM_WAIT", "wait"}, {0, NULL, NULL}};
817 GType gee_traversable_stream_type_id;
818 gee_traversable_stream_type_id = g_enum_register_static ("GeeTraversableStream", values);
819 g_once_init_leave (&gee_traversable_stream_type_id__volatile, gee_traversable_stream_type_id);
820 }
821 return gee_traversable_stream_type_id__volatile;
822 }
823
824 /**
825 * Apply function to each element returned by iterator untill last element
826 * or function return ''false''.
827 *
828 * ''{@link Iterator} implementation:'' Operation moves the iterator
829 * to last element in iteration or the first element that returned ''false''.
830 * If iterator points at some element it will be included in iteration.
831 *
832 * @param f function applied to every element of the collection
833 *
834 * @return ''false'' if the argument returned ''false'' at last invocation and
835 * ''true'' otherwise.
836 */
837 gboolean
gee_traversable_foreach(GeeTraversable * self,GeeForallFunc f,gpointer f_target)838 gee_traversable_foreach (GeeTraversable* self,
839 GeeForallFunc f,
840 gpointer f_target)
841 {
842 g_return_val_if_fail (self != NULL, FALSE);
843 return GEE_TRAVERSABLE_GET_INTERFACE (self)->foreach (self, f, f_target);
844 }
845
846 /**
847 * Stream function is an abstract function allowing writing many
848 * operations.
849 *
850 * The stream function accepts three parameter:
851 *
852 * 1. state. It is usually the last returned value from function but
853 * it may be {@link Stream.END} when {@link Stream.CONTINUE} was
854 * returned and there was no more elements.
855 * 1. input. It is valid only if first argument is
856 * {@link Stream.CONTINUE}
857 * 1. output. It is valid only if result is Stream.YIELD
858 *
859 * It may return one of 3 results:
860 *
861 * 1. {@link Stream.YIELD}. It means that value was yielded and can
862 * be passed to outgoing iterator.
863 * 1. {@link Stream.CONTINUE}. It means that the function needs to be
864 * called with next element or with {@link Stream.END} if it is
865 * end of stream). If the state element was Stream.END during the
866 * current iteration function ''must not'' return {@link Stream.CONTINUE}.
867 * 1. {@link Stream.WAIT}. Simply denotes that iterator should skip an element.
868 * Usually the function is called once again with {@link Stream.WAIT} as
869 * state however it do affect the initial validity of iterator.
870 * 1. {@link Stream.END}. It means that the last argument was yielded.
871 *
872 * If the function yields the value immediately then the returning iterator
873 * is {@link Iterator.valid} and points to this value as well as in case when the
874 * parent iterator is {@link Iterator.valid} and function yields
875 * after consuming 1 input. In other case returned iterator is invalid including
876 * when the first value returned is {@link Stream.WAIT}.
877 *
878 * Note: In {@link Iterator} implementation: if iterator is
879 * {@link Iterator.valid} the current value should be fed
880 * immediately to function if during initial call function returns
881 * {@link Stream.CONTINUE}. The parent iterator cannot be used before
882 * the functions return {@link Stream.END} afterwards it points on the
883 * last element consumed.
884 *
885 * @param f function generating stream
886 * @return iterator containing values yielded by stream
887 */
888 static GeeIterator*
gee_traversable_real_stream(GeeTraversable * self,GType a_type,GBoxedCopyFunc a_dup_func,GDestroyNotify a_destroy_func,GeeStreamFunc f,gpointer f_target,GDestroyNotify f_target_destroy_notify)889 gee_traversable_real_stream (GeeTraversable* self,
890 GType a_type,
891 GBoxedCopyFunc a_dup_func,
892 GDestroyNotify a_destroy_func,
893 GeeStreamFunc f,
894 gpointer f_target,
895 GDestroyNotify f_target_destroy_notify)
896 {
897 GeeIterator* _self_ = NULL;
898 GeeIterable* iself = NULL;
899 GeeIterator* _tmp0_;
900 GeeIterator* result = NULL;
901 _self_ = GEE_IS_ITERATOR (self) ? ((GeeIterator*) self) : NULL;
902 _tmp0_ = _self_;
903 if (_tmp0_ != NULL) {
904 GeeIterator* _tmp1_;
905 GeeStreamFunc _tmp2_;
906 gpointer _tmp2__target;
907 GDestroyNotify _tmp2__target_destroy_notify;
908 GeeStreamIterator* _tmp3_;
909 _tmp1_ = _self_;
910 _tmp2_ = f;
911 _tmp2__target = f_target;
912 _tmp2__target_destroy_notify = f_target_destroy_notify;
913 f = NULL;
914 f_target = NULL;
915 f_target_destroy_notify = NULL;
916 _tmp3_ = gee_stream_iterator_new (a_type, (GBoxedCopyFunc) a_dup_func, (GDestroyNotify) a_destroy_func, GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_type (self), (GBoxedCopyFunc) GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_dup_func (self), (GDestroyNotify) GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_destroy_func (self), _tmp1_, _tmp2_, _tmp2__target, _tmp2__target_destroy_notify);
917 result = (GeeIterator*) _tmp3_;
918 (f_target_destroy_notify == NULL) ? NULL : (f_target_destroy_notify (f_target), NULL);
919 f = NULL;
920 f_target = NULL;
921 f_target_destroy_notify = NULL;
922 return result;
923 } else {
924 GeeIterable* _tmp4_;
925 iself = GEE_IS_ITERABLE (self) ? ((GeeIterable*) self) : NULL;
926 _tmp4_ = iself;
927 if (_tmp4_ != NULL) {
928 GeeIterable* _tmp5_;
929 GeeIterator* _tmp6_;
930 GeeIterator* _tmp7_;
931 GeeStreamFunc _tmp8_;
932 gpointer _tmp8__target;
933 GDestroyNotify _tmp8__target_destroy_notify;
934 GeeIterator* _tmp9_;
935 GeeIterator* _tmp10_;
936 _tmp5_ = iself;
937 _tmp6_ = gee_iterable_iterator (_tmp5_);
938 _tmp7_ = _tmp6_;
939 _tmp8_ = f;
940 _tmp8__target = f_target;
941 _tmp8__target_destroy_notify = f_target_destroy_notify;
942 f = NULL;
943 f_target = NULL;
944 f_target_destroy_notify = NULL;
945 _tmp9_ = gee_traversable_stream ((GeeTraversable*) _tmp7_, a_type, (GBoxedCopyFunc) a_dup_func, (GDestroyNotify) a_destroy_func, _tmp8_, _tmp8__target, _tmp8__target_destroy_notify);
946 _tmp10_ = _tmp9_;
947 _g_object_unref0 (_tmp7_);
948 result = _tmp10_;
949 (f_target_destroy_notify == NULL) ? NULL : (f_target_destroy_notify (f_target), NULL);
950 f = NULL;
951 f_target = NULL;
952 f_target_destroy_notify = NULL;
953 return result;
954 } else {
955 g_assert_not_reached ();
956 }
957 }
958 (f_target_destroy_notify == NULL) ? NULL : (f_target_destroy_notify (f_target), NULL);
959 f = NULL;
960 f_target = NULL;
961 f_target_destroy_notify = NULL;
962 }
963
964 GeeIterator*
gee_traversable_stream(GeeTraversable * self,GType a_type,GBoxedCopyFunc a_dup_func,GDestroyNotify a_destroy_func,GeeStreamFunc f,gpointer f_target,GDestroyNotify f_target_destroy_notify)965 gee_traversable_stream (GeeTraversable* self,
966 GType a_type,
967 GBoxedCopyFunc a_dup_func,
968 GDestroyNotify a_destroy_func,
969 GeeStreamFunc f,
970 gpointer f_target,
971 GDestroyNotify f_target_destroy_notify)
972 {
973 g_return_val_if_fail (self != NULL, NULL);
974 return GEE_TRAVERSABLE_GET_INTERFACE (self)->stream (self, a_type, a_dup_func, a_destroy_func, f, f_target, f_target_destroy_notify);
975 }
976
977 /**
978 * Standard aggregation function.
979 *
980 * It takes a function, seed and first element, returns the new seed and
981 * progress to next element when the operation repeats.
982 *
983 * Note: Default implementation uses {@link foreach}.
984 *
985 * Note: In {@link Iterator} implementation operation moves the
986 * iterator to last element in iteration. If iterator is
987 * {@link Iterator.valid} the current element will be considered
988 * as well.
989 *
990 */
991 static Block15Data*
block15_data_ref(Block15Data * _data15_)992 block15_data_ref (Block15Data* _data15_)
993 {
994 g_atomic_int_inc (&_data15_->_ref_count_);
995 return _data15_;
996 }
997
998 static void
block15_data_unref(void * _userdata_)999 block15_data_unref (void * _userdata_)
1000 {
1001 Block15Data* _data15_;
1002 _data15_ = (Block15Data*) _userdata_;
1003 if (g_atomic_int_dec_and_test (&_data15_->_ref_count_)) {
1004 GeeTraversable* self;
1005 GType a_type;
1006 GBoxedCopyFunc a_dup_func;
1007 GDestroyNotify a_destroy_func;
1008 self = _data15_->self;
1009 a_type = _data15_->a_type;
1010 a_dup_func = _data15_->a_dup_func;
1011 a_destroy_func = _data15_->a_destroy_func;
1012 _a_destroy_func0 (_data15_->seed);
1013 _g_object_unref0 (self);
1014 g_slice_free (Block15Data, _data15_);
1015 }
1016 }
1017
1018 static gboolean
__lambda11_(Block15Data * _data15_,gpointer item)1019 __lambda11_ (Block15Data* _data15_,
1020 gpointer item)
1021 {
1022 GeeTraversable* self;
1023 GType a_type;
1024 GBoxedCopyFunc a_dup_func;
1025 GDestroyNotify a_destroy_func;
1026 gpointer _tmp0_;
1027 gpointer _tmp1_;
1028 gpointer _tmp2_;
1029 gboolean result = FALSE;
1030 self = _data15_->self;
1031 a_type = _data15_->a_type;
1032 a_dup_func = _data15_->a_dup_func;
1033 a_destroy_func = _data15_->a_destroy_func;
1034 _tmp0_ = item;
1035 item = NULL;
1036 _tmp1_ = _data15_->seed;
1037 _data15_->seed = NULL;
1038 _tmp2_ = _data15_->f (_tmp0_, _tmp1_, _data15_->f_target);
1039 _a_destroy_func0 (_data15_->seed);
1040 _data15_->seed = _tmp2_;
1041 result = TRUE;
1042 ((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));
1043 return result;
1044 }
1045
1046 static gboolean
___lambda11__gee_forall_func(gpointer g,gpointer self)1047 ___lambda11__gee_forall_func (gpointer g,
1048 gpointer self)
1049 {
1050 gboolean result;
1051 result = __lambda11_ (self, g);
1052 return result;
1053 }
1054
1055 static gpointer
gee_traversable_real_fold(GeeTraversable * self,GType a_type,GBoxedCopyFunc a_dup_func,GDestroyNotify a_destroy_func,GeeFoldFunc f,gpointer f_target,gpointer seed)1056 gee_traversable_real_fold (GeeTraversable* self,
1057 GType a_type,
1058 GBoxedCopyFunc a_dup_func,
1059 GDestroyNotify a_destroy_func,
1060 GeeFoldFunc f,
1061 gpointer f_target,
1062 gpointer seed)
1063 {
1064 Block15Data* _data15_;
1065 gpointer _tmp0_;
1066 gpointer result = NULL;
1067 _data15_ = g_slice_new0 (Block15Data);
1068 _data15_->_ref_count_ = 1;
1069 _data15_->self = g_object_ref (self);
1070 _data15_->a_type = a_type;
1071 _data15_->a_dup_func = a_dup_func;
1072 _data15_->a_destroy_func = a_destroy_func;
1073 _data15_->f = f;
1074 _data15_->f_target = f_target;
1075 _a_destroy_func0 (_data15_->seed);
1076 _data15_->seed = seed;
1077 gee_traversable_foreach (self, ___lambda11__gee_forall_func, _data15_);
1078 _tmp0_ = _data15_->seed;
1079 _data15_->seed = NULL;
1080 result = _tmp0_;
1081 block15_data_unref (_data15_);
1082 _data15_ = NULL;
1083 return result;
1084 }
1085
1086 gpointer
gee_traversable_fold(GeeTraversable * self,GType a_type,GBoxedCopyFunc a_dup_func,GDestroyNotify a_destroy_func,GeeFoldFunc f,gpointer f_target,gpointer seed)1087 gee_traversable_fold (GeeTraversable* self,
1088 GType a_type,
1089 GBoxedCopyFunc a_dup_func,
1090 GDestroyNotify a_destroy_func,
1091 GeeFoldFunc f,
1092 gpointer f_target,
1093 gpointer seed)
1094 {
1095 g_return_val_if_fail (self != NULL, NULL);
1096 return GEE_TRAVERSABLE_GET_INTERFACE (self)->fold (self, a_type, a_dup_func, a_destroy_func, f, f_target, seed);
1097 }
1098
1099 /**
1100 * Produces an iterator pointing at elements generated by function passed.
1101 *
1102 * Iterator is lazy evaluated but value is force-evaluated when
1103 * iterator moves to next element. ({@link Iterator.next})
1104 *
1105 * Note: Default implementation uses {@link stream}.
1106 *
1107 * Note: In {@link Iterator} implementation if the parent iterator is
1108 * {@link Iterator.valid} so is the returned one. Using the parent
1109 * iterator is not allowed before the inner iterator {@link Iterator.next}
1110 * return false and then it points on its last element.
1111 * The resulting iterator is {@link Iterator.valid} if the parent
1112 * iterator is.
1113 *
1114 * @param f Mapping function
1115 * @return Iterator listing mapped value
1116 */
1117 static Block16Data*
block16_data_ref(Block16Data * _data16_)1118 block16_data_ref (Block16Data* _data16_)
1119 {
1120 g_atomic_int_inc (&_data16_->_ref_count_);
1121 return _data16_;
1122 }
1123
1124 static void
block16_data_unref(void * _userdata_)1125 block16_data_unref (void * _userdata_)
1126 {
1127 Block16Data* _data16_;
1128 _data16_ = (Block16Data*) _userdata_;
1129 if (g_atomic_int_dec_and_test (&_data16_->_ref_count_)) {
1130 GeeTraversable* self;
1131 GType a_type;
1132 GBoxedCopyFunc a_dup_func;
1133 GDestroyNotify a_destroy_func;
1134 self = _data16_->self;
1135 a_type = _data16_->a_type;
1136 a_dup_func = _data16_->a_dup_func;
1137 a_destroy_func = _data16_->a_destroy_func;
1138 _g_object_unref0 (self);
1139 g_slice_free (Block16Data, _data16_);
1140 }
1141 }
1142
1143 static Block17Data*
block17_data_ref(Block17Data * _data17_)1144 block17_data_ref (Block17Data* _data17_)
1145 {
1146 g_atomic_int_inc (&_data17_->_ref_count_);
1147 return _data17_;
1148 }
1149
1150 static void
block17_data_unref(void * _userdata_)1151 block17_data_unref (void * _userdata_)
1152 {
1153 Block17Data* _data17_;
1154 _data17_ = (Block17Data*) _userdata_;
1155 if (g_atomic_int_dec_and_test (&_data17_->_ref_count_)) {
1156 GeeTraversable* self;
1157 GType a_type;
1158 GBoxedCopyFunc a_dup_func;
1159 GDestroyNotify a_destroy_func;
1160 self = _data17_->_data16_->self;
1161 a_type = _data17_->_data16_->a_type;
1162 a_dup_func = _data17_->_data16_->a_dup_func;
1163 a_destroy_func = _data17_->_data16_->a_destroy_func;
1164 _gee_lazy_unref0 (_data17_->item);
1165 block16_data_unref (_data17_->_data16_);
1166 _data17_->_data16_ = NULL;
1167 g_slice_free (Block17Data, _data17_);
1168 }
1169 }
1170
1171 static gpointer
___lambda13_(Block17Data * _data17_)1172 ___lambda13_ (Block17Data* _data17_)
1173 {
1174 Block16Data* _data16_;
1175 GeeTraversable* self;
1176 GType a_type;
1177 GBoxedCopyFunc a_dup_func;
1178 GDestroyNotify a_destroy_func;
1179 gpointer tmp = NULL;
1180 gpointer _tmp0_;
1181 gpointer _tmp1_;
1182 gpointer _tmp2_;
1183 gpointer result = NULL;
1184 _data16_ = _data17_->_data16_;
1185 self = _data16_->self;
1186 a_type = _data16_->a_type;
1187 a_dup_func = _data16_->a_dup_func;
1188 a_destroy_func = _data16_->a_destroy_func;
1189 _tmp0_ = gee_lazy_get (_data17_->item);
1190 tmp = _tmp0_;
1191 _gee_lazy_unref0 (_data17_->item);
1192 _data17_->item = NULL;
1193 _tmp1_ = tmp;
1194 tmp = NULL;
1195 _tmp2_ = _data16_->f (_tmp1_, _data16_->f_target);
1196 result = _tmp2_;
1197 _a_destroy_func0 (tmp);
1198 return result;
1199 }
1200
1201 static gpointer
____lambda13__gee_lazy_func(gpointer self)1202 ____lambda13__gee_lazy_func (gpointer self)
1203 {
1204 gpointer result;
1205 result = ___lambda13_ (self);
1206 return result;
1207 }
1208
1209 static GeeTraversableStream
__lambda12_(Block16Data * _data16_,GeeTraversableStream state,GeeLazy * item,GeeLazy ** val)1210 __lambda12_ (Block16Data* _data16_,
1211 GeeTraversableStream state,
1212 GeeLazy* item,
1213 GeeLazy* * val)
1214 {
1215 GeeTraversable* self;
1216 GType a_type;
1217 GBoxedCopyFunc a_dup_func;
1218 GDestroyNotify a_destroy_func;
1219 GeeLazy* _vala_val = NULL;
1220 Block17Data* _data17_;
1221 GeeTraversableStream result = 0;
1222 self = _data16_->self;
1223 a_type = _data16_->a_type;
1224 a_dup_func = _data16_->a_dup_func;
1225 a_destroy_func = _data16_->a_destroy_func;
1226 _data17_ = g_slice_new0 (Block17Data);
1227 _data17_->_ref_count_ = 1;
1228 _data17_->_data16_ = block16_data_ref (_data16_);
1229 _gee_lazy_unref0 (_data17_->item);
1230 _data17_->item = item;
1231 switch (state) {
1232 case GEE_TRAVERSABLE_STREAM_YIELD:
1233 {
1234 _gee_lazy_unref0 (_vala_val);
1235 _vala_val = NULL;
1236 result = GEE_TRAVERSABLE_STREAM_CONTINUE;
1237 block17_data_unref (_data17_);
1238 _data17_ = NULL;
1239 if (val) {
1240 *val = _vala_val;
1241 } else {
1242 _gee_lazy_unref0 (_vala_val);
1243 }
1244 return result;
1245 }
1246 case GEE_TRAVERSABLE_STREAM_CONTINUE:
1247 {
1248 GeeLazy* _tmp0_;
1249 _tmp0_ = gee_lazy_new (a_type, (GBoxedCopyFunc) a_dup_func, (GDestroyNotify) a_destroy_func, ____lambda13__gee_lazy_func, block17_data_ref (_data17_), block17_data_unref);
1250 _gee_lazy_unref0 (_vala_val);
1251 _vala_val = _tmp0_;
1252 result = GEE_TRAVERSABLE_STREAM_YIELD;
1253 block17_data_unref (_data17_);
1254 _data17_ = NULL;
1255 if (val) {
1256 *val = _vala_val;
1257 } else {
1258 _gee_lazy_unref0 (_vala_val);
1259 }
1260 return result;
1261 }
1262 case GEE_TRAVERSABLE_STREAM_END:
1263 {
1264 _gee_lazy_unref0 (_vala_val);
1265 _vala_val = NULL;
1266 result = GEE_TRAVERSABLE_STREAM_END;
1267 block17_data_unref (_data17_);
1268 _data17_ = NULL;
1269 if (val) {
1270 *val = _vala_val;
1271 } else {
1272 _gee_lazy_unref0 (_vala_val);
1273 }
1274 return result;
1275 }
1276 default:
1277 {
1278 g_assert_not_reached ();
1279 }
1280 }
1281 if (val) {
1282 *val = _vala_val;
1283 } else {
1284 _gee_lazy_unref0 (_vala_val);
1285 }
1286 block17_data_unref (_data17_);
1287 _data17_ = NULL;
1288 }
1289
1290 static GeeTraversableStream
___lambda12__gee_stream_func(GeeTraversableStream state,GeeLazy * g,GeeLazy ** lazy,gpointer self)1291 ___lambda12__gee_stream_func (GeeTraversableStream state,
1292 GeeLazy* g,
1293 GeeLazy* * lazy,
1294 gpointer self)
1295 {
1296 GeeTraversableStream result;
1297 result = __lambda12_ (self, state, g, lazy);
1298 return result;
1299 }
1300
1301 static GeeIterator*
gee_traversable_real_map(GeeTraversable * self,GType a_type,GBoxedCopyFunc a_dup_func,GDestroyNotify a_destroy_func,GeeMapFunc f,gpointer f_target)1302 gee_traversable_real_map (GeeTraversable* self,
1303 GType a_type,
1304 GBoxedCopyFunc a_dup_func,
1305 GDestroyNotify a_destroy_func,
1306 GeeMapFunc f,
1307 gpointer f_target)
1308 {
1309 Block16Data* _data16_;
1310 GeeIterator* _tmp0_;
1311 GeeIterator* result = NULL;
1312 _data16_ = g_slice_new0 (Block16Data);
1313 _data16_->_ref_count_ = 1;
1314 _data16_->self = g_object_ref (self);
1315 _data16_->a_type = a_type;
1316 _data16_->a_dup_func = a_dup_func;
1317 _data16_->a_destroy_func = a_destroy_func;
1318 _data16_->f = f;
1319 _data16_->f_target = f_target;
1320 _tmp0_ = gee_traversable_stream (self, a_type, (GBoxedCopyFunc) a_dup_func, (GDestroyNotify) a_destroy_func, ___lambda12__gee_stream_func, block16_data_ref (_data16_), block16_data_unref);
1321 result = _tmp0_;
1322 block16_data_unref (_data16_);
1323 _data16_ = NULL;
1324 return result;
1325 }
1326
1327 GeeIterator*
gee_traversable_map(GeeTraversable * self,GType a_type,GBoxedCopyFunc a_dup_func,GDestroyNotify a_destroy_func,GeeMapFunc f,gpointer f_target)1328 gee_traversable_map (GeeTraversable* self,
1329 GType a_type,
1330 GBoxedCopyFunc a_dup_func,
1331 GDestroyNotify a_destroy_func,
1332 GeeMapFunc f,
1333 gpointer f_target)
1334 {
1335 g_return_val_if_fail (self != NULL, NULL);
1336 return GEE_TRAVERSABLE_GET_INTERFACE (self)->map (self, a_type, a_dup_func, a_destroy_func, f, f_target);
1337 }
1338
1339 /**
1340 * Creates a new iterator that is initially pointing to seed. Then
1341 * subsequent values are obtained after applying the function to previous
1342 * value and the subsequent items.
1343 *
1344 * The resulting iterator is always valid and it contains the seed value.
1345 *
1346 * Note: Default implementation uses {@link stream}.
1347 *
1348 * Note: When the method is called on {@link Iterator} using the parent
1349 * iterator is not allowed befor the inner iterator
1350 * {@link Iterator.next} return false and then it points on its last
1351 * element. The resulting iterator is {@link Iterator.valid}.
1352 *
1353 * @param f Folding function
1354 * @param seed original seed value
1355 * @return Iterator containing values of subsequent values of seed
1356 */
1357 static Block18Data*
block18_data_ref(Block18Data * _data18_)1358 block18_data_ref (Block18Data* _data18_)
1359 {
1360 g_atomic_int_inc (&_data18_->_ref_count_);
1361 return _data18_;
1362 }
1363
1364 static void
block18_data_unref(void * _userdata_)1365 block18_data_unref (void * _userdata_)
1366 {
1367 Block18Data* _data18_;
1368 _data18_ = (Block18Data*) _userdata_;
1369 if (g_atomic_int_dec_and_test (&_data18_->_ref_count_)) {
1370 GeeTraversable* self;
1371 GType a_type;
1372 GBoxedCopyFunc a_dup_func;
1373 GDestroyNotify a_destroy_func;
1374 self = _data18_->self;
1375 a_type = _data18_->a_type;
1376 a_dup_func = _data18_->a_dup_func;
1377 a_destroy_func = _data18_->a_destroy_func;
1378 _a_destroy_func0 (_data18_->seed);
1379 _g_object_unref0 (self);
1380 g_slice_free (Block18Data, _data18_);
1381 }
1382 }
1383
1384 static Block19Data*
block19_data_ref(Block19Data * _data19_)1385 block19_data_ref (Block19Data* _data19_)
1386 {
1387 g_atomic_int_inc (&_data19_->_ref_count_);
1388 return _data19_;
1389 }
1390
1391 static void
block19_data_unref(void * _userdata_)1392 block19_data_unref (void * _userdata_)
1393 {
1394 Block19Data* _data19_;
1395 _data19_ = (Block19Data*) _userdata_;
1396 if (g_atomic_int_dec_and_test (&_data19_->_ref_count_)) {
1397 GeeTraversable* self;
1398 GType a_type;
1399 GBoxedCopyFunc a_dup_func;
1400 GDestroyNotify a_destroy_func;
1401 self = _data19_->_data18_->self;
1402 a_type = _data19_->_data18_->a_type;
1403 a_dup_func = _data19_->_data18_->a_dup_func;
1404 a_destroy_func = _data19_->_data18_->a_destroy_func;
1405 _gee_lazy_unref0 (_data19_->item);
1406 block18_data_unref (_data19_->_data18_);
1407 _data19_->_data18_ = NULL;
1408 g_slice_free (Block19Data, _data19_);
1409 }
1410 }
1411
1412 static gpointer
___lambda15_(Block19Data * _data19_)1413 ___lambda15_ (Block19Data* _data19_)
1414 {
1415 Block18Data* _data18_;
1416 GeeTraversable* self;
1417 GType a_type;
1418 GBoxedCopyFunc a_dup_func;
1419 GDestroyNotify a_destroy_func;
1420 gpointer tmp = NULL;
1421 gpointer _tmp0_;
1422 gpointer _tmp1_;
1423 gpointer _tmp2_;
1424 gpointer _tmp3_;
1425 gpointer _tmp4_;
1426 gpointer result = NULL;
1427 _data18_ = _data19_->_data18_;
1428 self = _data18_->self;
1429 a_type = _data18_->a_type;
1430 a_dup_func = _data18_->a_dup_func;
1431 a_destroy_func = _data18_->a_destroy_func;
1432 _tmp0_ = gee_lazy_get (_data19_->item);
1433 tmp = _tmp0_;
1434 _gee_lazy_unref0 (_data19_->item);
1435 _data19_->item = NULL;
1436 _tmp1_ = tmp;
1437 tmp = NULL;
1438 _tmp2_ = _data18_->seed;
1439 _data18_->seed = NULL;
1440 _tmp3_ = _data18_->f (_tmp1_, _tmp2_, _data18_->f_target);
1441 _a_destroy_func0 (_data18_->seed);
1442 _data18_->seed = _tmp3_;
1443 _tmp4_ = ((_data18_->seed != NULL) && (a_dup_func != NULL)) ? a_dup_func ((gpointer) _data18_->seed) : ((gpointer) _data18_->seed);
1444 result = _tmp4_;
1445 _a_destroy_func0 (tmp);
1446 return result;
1447 }
1448
1449 static gpointer
____lambda15__gee_lazy_func(gpointer self)1450 ____lambda15__gee_lazy_func (gpointer self)
1451 {
1452 gpointer result;
1453 result = ___lambda15_ (self);
1454 return result;
1455 }
1456
1457 static GeeTraversableStream
__lambda14_(Block18Data * _data18_,GeeTraversableStream state,GeeLazy * item,GeeLazy ** val)1458 __lambda14_ (Block18Data* _data18_,
1459 GeeTraversableStream state,
1460 GeeLazy* item,
1461 GeeLazy* * val)
1462 {
1463 GeeTraversable* self;
1464 GType a_type;
1465 GBoxedCopyFunc a_dup_func;
1466 GDestroyNotify a_destroy_func;
1467 GeeLazy* _vala_val = NULL;
1468 Block19Data* _data19_;
1469 GeeTraversableStream result = 0;
1470 self = _data18_->self;
1471 a_type = _data18_->a_type;
1472 a_dup_func = _data18_->a_dup_func;
1473 a_destroy_func = _data18_->a_destroy_func;
1474 _data19_ = g_slice_new0 (Block19Data);
1475 _data19_->_ref_count_ = 1;
1476 _data19_->_data18_ = block18_data_ref (_data18_);
1477 _gee_lazy_unref0 (_data19_->item);
1478 _data19_->item = item;
1479 switch (state) {
1480 case GEE_TRAVERSABLE_STREAM_YIELD:
1481 {
1482 if (_data18_->seed_emitted) {
1483 _gee_lazy_unref0 (_vala_val);
1484 _vala_val = NULL;
1485 result = GEE_TRAVERSABLE_STREAM_CONTINUE;
1486 block19_data_unref (_data19_);
1487 _data19_ = NULL;
1488 if (val) {
1489 *val = _vala_val;
1490 } else {
1491 _gee_lazy_unref0 (_vala_val);
1492 }
1493 return result;
1494 } else {
1495 GeeLazy* _tmp0_;
1496 _tmp0_ = gee_lazy_new_from_value (a_type, (GBoxedCopyFunc) a_dup_func, (GDestroyNotify) a_destroy_func, _data18_->seed);
1497 _gee_lazy_unref0 (_vala_val);
1498 _vala_val = _tmp0_;
1499 _data18_->seed_emitted = TRUE;
1500 result = GEE_TRAVERSABLE_STREAM_YIELD;
1501 block19_data_unref (_data19_);
1502 _data19_ = NULL;
1503 if (val) {
1504 *val = _vala_val;
1505 } else {
1506 _gee_lazy_unref0 (_vala_val);
1507 }
1508 return result;
1509 }
1510 }
1511 case GEE_TRAVERSABLE_STREAM_CONTINUE:
1512 {
1513 GeeLazy* _tmp1_;
1514 _tmp1_ = gee_lazy_new (a_type, (GBoxedCopyFunc) a_dup_func, (GDestroyNotify) a_destroy_func, ____lambda15__gee_lazy_func, block19_data_ref (_data19_), block19_data_unref);
1515 _gee_lazy_unref0 (_vala_val);
1516 _vala_val = _tmp1_;
1517 result = GEE_TRAVERSABLE_STREAM_YIELD;
1518 block19_data_unref (_data19_);
1519 _data19_ = NULL;
1520 if (val) {
1521 *val = _vala_val;
1522 } else {
1523 _gee_lazy_unref0 (_vala_val);
1524 }
1525 return result;
1526 }
1527 case GEE_TRAVERSABLE_STREAM_END:
1528 {
1529 _gee_lazy_unref0 (_vala_val);
1530 _vala_val = NULL;
1531 result = GEE_TRAVERSABLE_STREAM_END;
1532 block19_data_unref (_data19_);
1533 _data19_ = NULL;
1534 if (val) {
1535 *val = _vala_val;
1536 } else {
1537 _gee_lazy_unref0 (_vala_val);
1538 }
1539 return result;
1540 }
1541 default:
1542 {
1543 g_assert_not_reached ();
1544 }
1545 }
1546 if (val) {
1547 *val = _vala_val;
1548 } else {
1549 _gee_lazy_unref0 (_vala_val);
1550 }
1551 block19_data_unref (_data19_);
1552 _data19_ = NULL;
1553 }
1554
1555 static GeeTraversableStream
___lambda14__gee_stream_func(GeeTraversableStream state,GeeLazy * g,GeeLazy ** lazy,gpointer self)1556 ___lambda14__gee_stream_func (GeeTraversableStream state,
1557 GeeLazy* g,
1558 GeeLazy* * lazy,
1559 gpointer self)
1560 {
1561 GeeTraversableStream result;
1562 result = __lambda14_ (self, state, g, lazy);
1563 return result;
1564 }
1565
1566 static GeeIterator*
gee_traversable_real_scan(GeeTraversable * self,GType a_type,GBoxedCopyFunc a_dup_func,GDestroyNotify a_destroy_func,GeeFoldFunc f,gpointer f_target,gpointer seed)1567 gee_traversable_real_scan (GeeTraversable* self,
1568 GType a_type,
1569 GBoxedCopyFunc a_dup_func,
1570 GDestroyNotify a_destroy_func,
1571 GeeFoldFunc f,
1572 gpointer f_target,
1573 gpointer seed)
1574 {
1575 Block18Data* _data18_;
1576 GeeIterator* _tmp0_;
1577 GeeIterator* result = NULL;
1578 _data18_ = g_slice_new0 (Block18Data);
1579 _data18_->_ref_count_ = 1;
1580 _data18_->self = g_object_ref (self);
1581 _data18_->a_type = a_type;
1582 _data18_->a_dup_func = a_dup_func;
1583 _data18_->a_destroy_func = a_destroy_func;
1584 _data18_->f = f;
1585 _data18_->f_target = f_target;
1586 _a_destroy_func0 (_data18_->seed);
1587 _data18_->seed = seed;
1588 _data18_->seed_emitted = FALSE;
1589 _tmp0_ = gee_traversable_stream (self, a_type, (GBoxedCopyFunc) a_dup_func, (GDestroyNotify) a_destroy_func, ___lambda14__gee_stream_func, block18_data_ref (_data18_), block18_data_unref);
1590 result = _tmp0_;
1591 block18_data_unref (_data18_);
1592 _data18_ = NULL;
1593 return result;
1594 }
1595
1596 GeeIterator*
gee_traversable_scan(GeeTraversable * self,GType a_type,GBoxedCopyFunc a_dup_func,GDestroyNotify a_destroy_func,GeeFoldFunc f,gpointer f_target,gpointer seed)1597 gee_traversable_scan (GeeTraversable* self,
1598 GType a_type,
1599 GBoxedCopyFunc a_dup_func,
1600 GDestroyNotify a_destroy_func,
1601 GeeFoldFunc f,
1602 gpointer f_target,
1603 gpointer seed)
1604 {
1605 g_return_val_if_fail (self != NULL, NULL);
1606 return GEE_TRAVERSABLE_GET_INTERFACE (self)->scan (self, a_type, a_dup_func, a_destroy_func, f, f_target, seed);
1607 }
1608
1609 /**
1610 * Creates a new iterator that contains only values that fullfills the
1611 * predicate.
1612 *
1613 * Note: When the method is called on {@link Iterator} using the parent
1614 * iterator is not allowed befor the inner iterator
1615 * {@link Iterator.next} return false and then it points on its last
1616 * element. The resulting iterator is {@link Iterator.valid} if parent
1617 * iterator is {@link Iterator.valid} and value it is pointing on
1618 * fullfills the predicate.
1619 *
1620 * @param pred predicate to check should the value be retained
1621 * @return Iterator containing values of subsequent values of seed
1622 */
1623 static Block20Data*
block20_data_ref(Block20Data * _data20_)1624 block20_data_ref (Block20Data* _data20_)
1625 {
1626 g_atomic_int_inc (&_data20_->_ref_count_);
1627 return _data20_;
1628 }
1629
1630 static void
block20_data_unref(void * _userdata_)1631 block20_data_unref (void * _userdata_)
1632 {
1633 Block20Data* _data20_;
1634 _data20_ = (Block20Data*) _userdata_;
1635 if (g_atomic_int_dec_and_test (&_data20_->_ref_count_)) {
1636 GeeTraversable* self;
1637 self = _data20_->self;
1638 (_data20_->pred_target_destroy_notify == NULL) ? NULL : (_data20_->pred_target_destroy_notify (_data20_->pred_target), NULL);
1639 _data20_->pred = NULL;
1640 _data20_->pred_target = NULL;
1641 _data20_->pred_target_destroy_notify = NULL;
1642 _g_object_unref0 (self);
1643 g_slice_free (Block20Data, _data20_);
1644 }
1645 }
1646
1647 static gpointer
_gee_lazy_ref0(gpointer self)1648 _gee_lazy_ref0 (gpointer self)
1649 {
1650 return self ? gee_lazy_ref (self) : NULL;
1651 }
1652
1653 static GeeTraversableStream
__lambda16_(Block20Data * _data20_,GeeTraversableStream state,GeeLazy * item,GeeLazy ** val)1654 __lambda16_ (Block20Data* _data20_,
1655 GeeTraversableStream state,
1656 GeeLazy* item,
1657 GeeLazy* * val)
1658 {
1659 GeeTraversable* self;
1660 GeeLazy* _vala_val = NULL;
1661 GeeTraversableStream result = 0;
1662 self = _data20_->self;
1663 switch (state) {
1664 case GEE_TRAVERSABLE_STREAM_YIELD:
1665 {
1666 _gee_lazy_unref0 (_vala_val);
1667 _vala_val = NULL;
1668 result = GEE_TRAVERSABLE_STREAM_CONTINUE;
1669 _gee_lazy_unref0 (item);
1670 if (val) {
1671 *val = _vala_val;
1672 } else {
1673 _gee_lazy_unref0 (_vala_val);
1674 }
1675 return result;
1676 }
1677 case GEE_TRAVERSABLE_STREAM_CONTINUE:
1678 {
1679 gpointer g = NULL;
1680 gpointer _tmp0_;
1681 gconstpointer _tmp1_;
1682 _tmp0_ = gee_lazy_get (item);
1683 g = _tmp0_;
1684 _tmp1_ = g;
1685 if (_data20_->pred (_tmp1_, _data20_->pred_target)) {
1686 GeeLazy* _tmp2_;
1687 _tmp2_ = _gee_lazy_ref0 (item);
1688 _gee_lazy_unref0 (_vala_val);
1689 _vala_val = _tmp2_;
1690 result = GEE_TRAVERSABLE_STREAM_YIELD;
1691 ((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));
1692 _gee_lazy_unref0 (item);
1693 if (val) {
1694 *val = _vala_val;
1695 } else {
1696 _gee_lazy_unref0 (_vala_val);
1697 }
1698 return result;
1699 } else {
1700 _gee_lazy_unref0 (_vala_val);
1701 _vala_val = NULL;
1702 result = GEE_TRAVERSABLE_STREAM_CONTINUE;
1703 ((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));
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 }
1712 ((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));
1713 }
1714 case GEE_TRAVERSABLE_STREAM_END:
1715 {
1716 _gee_lazy_unref0 (_vala_val);
1717 _vala_val = NULL;
1718 result = GEE_TRAVERSABLE_STREAM_END;
1719 _gee_lazy_unref0 (item);
1720 if (val) {
1721 *val = _vala_val;
1722 } else {
1723 _gee_lazy_unref0 (_vala_val);
1724 }
1725 return result;
1726 }
1727 default:
1728 {
1729 g_assert_not_reached ();
1730 }
1731 }
1732 _gee_lazy_unref0 (item);
1733 if (val) {
1734 *val = _vala_val;
1735 } else {
1736 _gee_lazy_unref0 (_vala_val);
1737 }
1738 }
1739
1740 static GeeTraversableStream
___lambda16__gee_stream_func(GeeTraversableStream state,GeeLazy * g,GeeLazy ** lazy,gpointer self)1741 ___lambda16__gee_stream_func (GeeTraversableStream state,
1742 GeeLazy* g,
1743 GeeLazy* * lazy,
1744 gpointer self)
1745 {
1746 GeeTraversableStream result;
1747 result = __lambda16_ (self, state, g, lazy);
1748 return result;
1749 }
1750
1751 static GeeIterator*
gee_traversable_real_filter(GeeTraversable * self,GeePredicate pred,gpointer pred_target,GDestroyNotify pred_target_destroy_notify)1752 gee_traversable_real_filter (GeeTraversable* self,
1753 GeePredicate pred,
1754 gpointer pred_target,
1755 GDestroyNotify pred_target_destroy_notify)
1756 {
1757 Block20Data* _data20_;
1758 GeeIterator* _tmp0_;
1759 GeeIterator* result = NULL;
1760 _data20_ = g_slice_new0 (Block20Data);
1761 _data20_->_ref_count_ = 1;
1762 _data20_->self = g_object_ref (self);
1763 (_data20_->pred_target_destroy_notify == NULL) ? NULL : (_data20_->pred_target_destroy_notify (_data20_->pred_target), NULL);
1764 _data20_->pred = NULL;
1765 _data20_->pred_target = NULL;
1766 _data20_->pred_target_destroy_notify = NULL;
1767 _data20_->pred = pred;
1768 _data20_->pred_target = pred_target;
1769 _data20_->pred_target_destroy_notify = pred_target_destroy_notify;
1770 _tmp0_ = gee_traversable_stream (self, GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_type (self), (GBoxedCopyFunc) GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_dup_func (self), (GDestroyNotify) GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_destroy_func (self), ___lambda16__gee_stream_func, block20_data_ref (_data20_), block20_data_unref);
1771 result = _tmp0_;
1772 block20_data_unref (_data20_);
1773 _data20_ = NULL;
1774 return result;
1775 }
1776
1777 GeeIterator*
gee_traversable_filter(GeeTraversable * self,GeePredicate pred,gpointer pred_target,GDestroyNotify pred_target_destroy_notify)1778 gee_traversable_filter (GeeTraversable* self,
1779 GeePredicate pred,
1780 gpointer pred_target,
1781 GDestroyNotify pred_target_destroy_notify)
1782 {
1783 g_return_val_if_fail (self != NULL, NULL);
1784 return GEE_TRAVERSABLE_GET_INTERFACE (self)->filter (self, pred, pred_target, pred_target_destroy_notify);
1785 }
1786
1787 /**
1788 * Creates a new iterator which contains elements from iterable. The
1789 * first argument states the offset i.e. number of elements the iterator
1790 * skips by default.
1791 *
1792 * Note: In {@link Iterator} implementation resulting iterator is
1793 * {@link Iterator.valid} when parent iterator is
1794 * {@link Iterator.valid} and the offset is 0. Using the parent
1795 * iterator is not allowed before the inner iterator
1796 * {@link Iterator.next} return false and then it points on its last
1797 * element.
1798 *
1799 * @param offset the offset to first element the iterator is pointing to
1800 * @param length maximum number of elements iterator may return. Negative
1801 * value means that the number is unbounded
1802 */
1803 static Block21Data*
block21_data_ref(Block21Data * _data21_)1804 block21_data_ref (Block21Data* _data21_)
1805 {
1806 g_atomic_int_inc (&_data21_->_ref_count_);
1807 return _data21_;
1808 }
1809
1810 static void
block21_data_unref(void * _userdata_)1811 block21_data_unref (void * _userdata_)
1812 {
1813 Block21Data* _data21_;
1814 _data21_ = (Block21Data*) _userdata_;
1815 if (g_atomic_int_dec_and_test (&_data21_->_ref_count_)) {
1816 GeeTraversable* self;
1817 self = _data21_->self;
1818 _g_object_unref0 (self);
1819 g_slice_free (Block21Data, _data21_);
1820 }
1821 }
1822
1823 static GeeTraversableStream
__lambda17_(Block21Data * _data21_,GeeTraversableStream state,GeeLazy * item,GeeLazy ** val)1824 __lambda17_ (Block21Data* _data21_,
1825 GeeTraversableStream state,
1826 GeeLazy* item,
1827 GeeLazy* * val)
1828 {
1829 GeeTraversable* self;
1830 GeeLazy* _vala_val = NULL;
1831 GeeTraversableStream result = 0;
1832 self = _data21_->self;
1833 switch (state) {
1834 case GEE_TRAVERSABLE_STREAM_YIELD:
1835 {
1836 _gee_lazy_unref0 (_vala_val);
1837 _vala_val = NULL;
1838 if (_data21_->offset > 0) {
1839 result = GEE_TRAVERSABLE_STREAM_CONTINUE;
1840 _gee_lazy_unref0 (item);
1841 if (val) {
1842 *val = _vala_val;
1843 } else {
1844 _gee_lazy_unref0 (_vala_val);
1845 }
1846 return result;
1847 } else {
1848 if (_data21_->length > 0) {
1849 GeeTraversableStream _tmp0_ = 0;
1850 if (_data21_->length != 0) {
1851 _tmp0_ = GEE_TRAVERSABLE_STREAM_CONTINUE;
1852 } else {
1853 _tmp0_ = GEE_TRAVERSABLE_STREAM_END;
1854 }
1855 result = _tmp0_;
1856 _gee_lazy_unref0 (item);
1857 if (val) {
1858 *val = _vala_val;
1859 } else {
1860 _gee_lazy_unref0 (_vala_val);
1861 }
1862 return result;
1863 } else {
1864 if (_data21_->length == 0) {
1865 result = GEE_TRAVERSABLE_STREAM_END;
1866 _gee_lazy_unref0 (item);
1867 if (val) {
1868 *val = _vala_val;
1869 } else {
1870 _gee_lazy_unref0 (_vala_val);
1871 }
1872 return result;
1873 } else {
1874 result = GEE_TRAVERSABLE_STREAM_CONTINUE;
1875 _gee_lazy_unref0 (item);
1876 if (val) {
1877 *val = _vala_val;
1878 } else {
1879 _gee_lazy_unref0 (_vala_val);
1880 }
1881 return result;
1882 }
1883 }
1884 }
1885 }
1886 case GEE_TRAVERSABLE_STREAM_CONTINUE:
1887 {
1888 if (_data21_->offset == 0) {
1889 GeeLazy* _tmp1_;
1890 gint _tmp2_;
1891 _tmp1_ = _gee_lazy_ref0 (item);
1892 _gee_lazy_unref0 (_vala_val);
1893 _vala_val = _tmp1_;
1894 _tmp2_ = _data21_->length;
1895 _data21_->length = _tmp2_ - 1;
1896 result = GEE_TRAVERSABLE_STREAM_YIELD;
1897 _gee_lazy_unref0 (item);
1898 if (val) {
1899 *val = _vala_val;
1900 } else {
1901 _gee_lazy_unref0 (_vala_val);
1902 }
1903 return result;
1904 } else {
1905 gint _tmp3_;
1906 _gee_lazy_unref0 (_vala_val);
1907 _vala_val = NULL;
1908 _tmp3_ = _data21_->offset;
1909 _data21_->offset = _tmp3_ - 1;
1910 result = GEE_TRAVERSABLE_STREAM_CONTINUE;
1911 _gee_lazy_unref0 (item);
1912 if (val) {
1913 *val = _vala_val;
1914 } else {
1915 _gee_lazy_unref0 (_vala_val);
1916 }
1917 return result;
1918 }
1919 }
1920 case GEE_TRAVERSABLE_STREAM_END:
1921 {
1922 _gee_lazy_unref0 (_vala_val);
1923 _vala_val = NULL;
1924 result = GEE_TRAVERSABLE_STREAM_END;
1925 _gee_lazy_unref0 (item);
1926 if (val) {
1927 *val = _vala_val;
1928 } else {
1929 _gee_lazy_unref0 (_vala_val);
1930 }
1931 return result;
1932 }
1933 default:
1934 {
1935 g_assert_not_reached ();
1936 }
1937 }
1938 _gee_lazy_unref0 (item);
1939 if (val) {
1940 *val = _vala_val;
1941 } else {
1942 _gee_lazy_unref0 (_vala_val);
1943 }
1944 }
1945
1946 static GeeTraversableStream
___lambda17__gee_stream_func(GeeTraversableStream state,GeeLazy * g,GeeLazy ** lazy,gpointer self)1947 ___lambda17__gee_stream_func (GeeTraversableStream state,
1948 GeeLazy* g,
1949 GeeLazy* * lazy,
1950 gpointer self)
1951 {
1952 GeeTraversableStream result;
1953 result = __lambda17_ (self, state, g, lazy);
1954 return result;
1955 }
1956
1957 static GeeIterator*
gee_traversable_real_chop(GeeTraversable * self,gint offset,gint length)1958 gee_traversable_real_chop (GeeTraversable* self,
1959 gint offset,
1960 gint length)
1961 {
1962 Block21Data* _data21_;
1963 GeeIterator* _tmp0_;
1964 GeeIterator* result = NULL;
1965 _data21_ = g_slice_new0 (Block21Data);
1966 _data21_->_ref_count_ = 1;
1967 _data21_->self = g_object_ref (self);
1968 _data21_->offset = offset;
1969 _data21_->length = length;
1970 _vala_assert (_data21_->offset >= 0, "offset >= 0");
1971 _tmp0_ = gee_traversable_stream (self, GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_type (self), (GBoxedCopyFunc) GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_dup_func (self), (GDestroyNotify) GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_destroy_func (self), ___lambda17__gee_stream_func, block21_data_ref (_data21_), block21_data_unref);
1972 result = _tmp0_;
1973 block21_data_unref (_data21_);
1974 _data21_ = NULL;
1975 return result;
1976 }
1977
1978 GeeIterator*
gee_traversable_chop(GeeTraversable * self,gint offset,gint length)1979 gee_traversable_chop (GeeTraversable* self,
1980 gint offset,
1981 gint length)
1982 {
1983 g_return_val_if_fail (self != NULL, NULL);
1984 return GEE_TRAVERSABLE_GET_INTERFACE (self)->chop (self, offset, length);
1985 }
1986
1987 /**
1988 * A fused concatinate and map. The function is applied to each element
1989 * of iteration and the resulting values are concatinated.
1990 *
1991 * The iterator is lazy evaluated but value is force-evaluated when
1992 * iterator is moved to next value.
1993 *
1994 * Note: Default implementation uses {@link stream}.
1995 *
1996 * Note: In {@link Iterator} implementation if the parent iterator is
1997 * {@link Iterator.valid} and function returns a valid iterator the
1998 * resulting iterator is also valid. Using the parent iterator is not
1999 * allowed before the inner iterator {@link Iterator.next}
2000 * return false and then it points on its last element.
2001 *
2002 * @since 0.11.1
2003 * @param f mapping function
2004 * @return Iterator over returned values
2005 */
2006 static Block22Data*
block22_data_ref(Block22Data * _data22_)2007 block22_data_ref (Block22Data* _data22_)
2008 {
2009 g_atomic_int_inc (&_data22_->_ref_count_);
2010 return _data22_;
2011 }
2012
2013 static void
block22_data_unref(void * _userdata_)2014 block22_data_unref (void * _userdata_)
2015 {
2016 Block22Data* _data22_;
2017 _data22_ = (Block22Data*) _userdata_;
2018 if (g_atomic_int_dec_and_test (&_data22_->_ref_count_)) {
2019 GeeTraversable* self;
2020 GType a_type;
2021 GBoxedCopyFunc a_dup_func;
2022 GDestroyNotify a_destroy_func;
2023 self = _data22_->self;
2024 a_type = _data22_->a_type;
2025 a_dup_func = _data22_->a_dup_func;
2026 a_destroy_func = _data22_->a_destroy_func;
2027 _g_object_unref0 (_data22_->current);
2028 (_data22_->f_target_destroy_notify == NULL) ? NULL : (_data22_->f_target_destroy_notify (_data22_->f_target), NULL);
2029 _data22_->f = NULL;
2030 _data22_->f_target = NULL;
2031 _data22_->f_target_destroy_notify = NULL;
2032 _g_object_unref0 (self);
2033 g_slice_free (Block22Data, _data22_);
2034 }
2035 }
2036
2037 static Block23Data*
block23_data_ref(Block23Data * _data23_)2038 block23_data_ref (Block23Data* _data23_)
2039 {
2040 g_atomic_int_inc (&_data23_->_ref_count_);
2041 return _data23_;
2042 }
2043
2044 static void
block23_data_unref(void * _userdata_)2045 block23_data_unref (void * _userdata_)
2046 {
2047 Block23Data* _data23_;
2048 _data23_ = (Block23Data*) _userdata_;
2049 if (g_atomic_int_dec_and_test (&_data23_->_ref_count_)) {
2050 GeeTraversable* self;
2051 GType a_type;
2052 GBoxedCopyFunc a_dup_func;
2053 GDestroyNotify a_destroy_func;
2054 self = _data23_->_data22_->self;
2055 a_type = _data23_->_data22_->a_type;
2056 a_dup_func = _data23_->_data22_->a_dup_func;
2057 a_destroy_func = _data23_->_data22_->a_destroy_func;
2058 block22_data_unref (_data23_->_data22_);
2059 _data23_->_data22_ = NULL;
2060 g_slice_free (Block23Data, _data23_);
2061 }
2062 }
2063
2064 static gpointer
____lambda19_(Block23Data * _data23_)2065 ____lambda19_ (Block23Data* _data23_)
2066 {
2067 Block22Data* _data22_;
2068 GeeTraversable* self;
2069 GType a_type;
2070 GBoxedCopyFunc a_dup_func;
2071 GDestroyNotify a_destroy_func;
2072 gpointer _tmp0_;
2073 gpointer result = NULL;
2074 _data22_ = _data23_->_data22_;
2075 self = _data22_->self;
2076 a_type = _data22_->a_type;
2077 a_dup_func = _data22_->a_dup_func;
2078 a_destroy_func = _data22_->a_destroy_func;
2079 _tmp0_ = gee_iterator_get (_data22_->current);
2080 result = _tmp0_;
2081 return result;
2082 }
2083
2084 static gpointer
_____lambda19__gee_lazy_func(gpointer self)2085 _____lambda19__gee_lazy_func (gpointer self)
2086 {
2087 gpointer result;
2088 result = ____lambda19_ (self);
2089 return result;
2090 }
2091
2092 static gpointer
____lambda20_(Block23Data * _data23_)2093 ____lambda20_ (Block23Data* _data23_)
2094 {
2095 Block22Data* _data22_;
2096 GeeTraversable* self;
2097 GType a_type;
2098 GBoxedCopyFunc a_dup_func;
2099 GDestroyNotify a_destroy_func;
2100 gpointer _tmp0_;
2101 gpointer result = NULL;
2102 _data22_ = _data23_->_data22_;
2103 self = _data22_->self;
2104 a_type = _data22_->a_type;
2105 a_dup_func = _data22_->a_dup_func;
2106 a_destroy_func = _data22_->a_destroy_func;
2107 _tmp0_ = gee_iterator_get (_data22_->current);
2108 result = _tmp0_;
2109 return result;
2110 }
2111
2112 static gpointer
_____lambda20__gee_lazy_func(gpointer self)2113 _____lambda20__gee_lazy_func (gpointer self)
2114 {
2115 gpointer result;
2116 result = ____lambda20_ (self);
2117 return result;
2118 }
2119
2120 static gpointer
____lambda21_(Block23Data * _data23_)2121 ____lambda21_ (Block23Data* _data23_)
2122 {
2123 Block22Data* _data22_;
2124 GeeTraversable* self;
2125 GType a_type;
2126 GBoxedCopyFunc a_dup_func;
2127 GDestroyNotify a_destroy_func;
2128 gpointer _tmp0_;
2129 gpointer result = NULL;
2130 _data22_ = _data23_->_data22_;
2131 self = _data22_->self;
2132 a_type = _data22_->a_type;
2133 a_dup_func = _data22_->a_dup_func;
2134 a_destroy_func = _data22_->a_destroy_func;
2135 _tmp0_ = gee_iterator_get (_data22_->current);
2136 result = _tmp0_;
2137 return result;
2138 }
2139
2140 static gpointer
_____lambda21__gee_lazy_func(gpointer self)2141 _____lambda21__gee_lazy_func (gpointer self)
2142 {
2143 gpointer result;
2144 result = ____lambda21_ (self);
2145 return result;
2146 }
2147
2148 static GeeTraversableStream
__lambda18_(Block22Data * _data22_,GeeTraversableStream state,GeeLazy * item,GeeLazy ** val)2149 __lambda18_ (Block22Data* _data22_,
2150 GeeTraversableStream state,
2151 GeeLazy* item,
2152 GeeLazy* * val)
2153 {
2154 GeeTraversable* self;
2155 GType a_type;
2156 GBoxedCopyFunc a_dup_func;
2157 GDestroyNotify a_destroy_func;
2158 GeeLazy* _vala_val = NULL;
2159 Block23Data* _data23_;
2160 GeeTraversableStream result = 0;
2161 self = _data22_->self;
2162 a_type = _data22_->a_type;
2163 a_dup_func = _data22_->a_dup_func;
2164 a_destroy_func = _data22_->a_destroy_func;
2165 _data23_ = g_slice_new0 (Block23Data);
2166 _data23_->_ref_count_ = 1;
2167 _data23_->_data22_ = block22_data_ref (_data22_);
2168 switch (state) {
2169 case GEE_TRAVERSABLE_STREAM_YIELD:
2170 {
2171 gboolean _tmp0_ = FALSE;
2172 if (_data22_->current == NULL) {
2173 _tmp0_ = TRUE;
2174 } else {
2175 _tmp0_ = !gee_iterator_next (_data22_->current);
2176 }
2177 if (_tmp0_) {
2178 _gee_lazy_unref0 (_vala_val);
2179 _vala_val = NULL;
2180 result = GEE_TRAVERSABLE_STREAM_CONTINUE;
2181 block23_data_unref (_data23_);
2182 _data23_ = NULL;
2183 _gee_lazy_unref0 (item);
2184 if (val) {
2185 *val = _vala_val;
2186 } else {
2187 _gee_lazy_unref0 (_vala_val);
2188 }
2189 return result;
2190 } else {
2191 GeeLazy* _tmp1_;
2192 _tmp1_ = gee_lazy_new (a_type, (GBoxedCopyFunc) a_dup_func, (GDestroyNotify) a_destroy_func, _____lambda19__gee_lazy_func, block23_data_ref (_data23_), block23_data_unref);
2193 _gee_lazy_unref0 (_vala_val);
2194 _vala_val = _tmp1_;
2195 result = GEE_TRAVERSABLE_STREAM_YIELD;
2196 block23_data_unref (_data23_);
2197 _data23_ = NULL;
2198 _gee_lazy_unref0 (item);
2199 if (val) {
2200 *val = _vala_val;
2201 } else {
2202 _gee_lazy_unref0 (_vala_val);
2203 }
2204 return result;
2205 }
2206 }
2207 case GEE_TRAVERSABLE_STREAM_CONTINUE:
2208 {
2209 gpointer _tmp2_;
2210 GeeIterator* _tmp3_;
2211 gboolean _tmp4_;
2212 gboolean _tmp5_;
2213 _tmp2_ = gee_lazy_get (item);
2214 _tmp3_ = _data22_->f (_tmp2_, _data22_->f_target);
2215 _g_object_unref0 (_data22_->current);
2216 _data22_->current = _tmp3_;
2217 _tmp4_ = gee_iterator_get_valid (_data22_->current);
2218 _tmp5_ = _tmp4_;
2219 if (_tmp5_) {
2220 GeeLazy* _tmp6_;
2221 _tmp6_ = gee_lazy_new (a_type, (GBoxedCopyFunc) a_dup_func, (GDestroyNotify) a_destroy_func, _____lambda20__gee_lazy_func, block23_data_ref (_data23_), block23_data_unref);
2222 _gee_lazy_unref0 (_vala_val);
2223 _vala_val = _tmp6_;
2224 result = GEE_TRAVERSABLE_STREAM_YIELD;
2225 block23_data_unref (_data23_);
2226 _data23_ = NULL;
2227 _gee_lazy_unref0 (item);
2228 if (val) {
2229 *val = _vala_val;
2230 } else {
2231 _gee_lazy_unref0 (_vala_val);
2232 }
2233 return result;
2234 } else {
2235 _gee_lazy_unref0 (_vala_val);
2236 _vala_val = NULL;
2237 result = GEE_TRAVERSABLE_STREAM_WAIT;
2238 block23_data_unref (_data23_);
2239 _data23_ = NULL;
2240 _gee_lazy_unref0 (item);
2241 if (val) {
2242 *val = _vala_val;
2243 } else {
2244 _gee_lazy_unref0 (_vala_val);
2245 }
2246 return result;
2247 }
2248 }
2249 case GEE_TRAVERSABLE_STREAM_WAIT:
2250 {
2251 if (gee_iterator_next (_data22_->current)) {
2252 GeeLazy* _tmp7_;
2253 _tmp7_ = gee_lazy_new (a_type, (GBoxedCopyFunc) a_dup_func, (GDestroyNotify) a_destroy_func, _____lambda21__gee_lazy_func, block23_data_ref (_data23_), block23_data_unref);
2254 _gee_lazy_unref0 (_vala_val);
2255 _vala_val = _tmp7_;
2256 result = GEE_TRAVERSABLE_STREAM_YIELD;
2257 block23_data_unref (_data23_);
2258 _data23_ = NULL;
2259 _gee_lazy_unref0 (item);
2260 if (val) {
2261 *val = _vala_val;
2262 } else {
2263 _gee_lazy_unref0 (_vala_val);
2264 }
2265 return result;
2266 } else {
2267 _gee_lazy_unref0 (_vala_val);
2268 _vala_val = NULL;
2269 result = GEE_TRAVERSABLE_STREAM_CONTINUE;
2270 block23_data_unref (_data23_);
2271 _data23_ = NULL;
2272 _gee_lazy_unref0 (item);
2273 if (val) {
2274 *val = _vala_val;
2275 } else {
2276 _gee_lazy_unref0 (_vala_val);
2277 }
2278 return result;
2279 }
2280 }
2281 case GEE_TRAVERSABLE_STREAM_END:
2282 {
2283 _gee_lazy_unref0 (_vala_val);
2284 _vala_val = NULL;
2285 result = GEE_TRAVERSABLE_STREAM_END;
2286 block23_data_unref (_data23_);
2287 _data23_ = NULL;
2288 _gee_lazy_unref0 (item);
2289 if (val) {
2290 *val = _vala_val;
2291 } else {
2292 _gee_lazy_unref0 (_vala_val);
2293 }
2294 return result;
2295 }
2296 default:
2297 {
2298 g_assert_not_reached ();
2299 }
2300 }
2301 _gee_lazy_unref0 (item);
2302 if (val) {
2303 *val = _vala_val;
2304 } else {
2305 _gee_lazy_unref0 (_vala_val);
2306 }
2307 block23_data_unref (_data23_);
2308 _data23_ = NULL;
2309 }
2310
2311 static GeeTraversableStream
___lambda18__gee_stream_func(GeeTraversableStream state,GeeLazy * g,GeeLazy ** lazy,gpointer self)2312 ___lambda18__gee_stream_func (GeeTraversableStream state,
2313 GeeLazy* g,
2314 GeeLazy* * lazy,
2315 gpointer self)
2316 {
2317 GeeTraversableStream result;
2318 result = __lambda18_ (self, state, g, lazy);
2319 return result;
2320 }
2321
2322 static GeeIterator*
gee_traversable_real_flat_map(GeeTraversable * self,GType a_type,GBoxedCopyFunc a_dup_func,GDestroyNotify a_destroy_func,GeeFlatMapFunc f,gpointer f_target,GDestroyNotify f_target_destroy_notify)2323 gee_traversable_real_flat_map (GeeTraversable* self,
2324 GType a_type,
2325 GBoxedCopyFunc a_dup_func,
2326 GDestroyNotify a_destroy_func,
2327 GeeFlatMapFunc f,
2328 gpointer f_target,
2329 GDestroyNotify f_target_destroy_notify)
2330 {
2331 Block22Data* _data22_;
2332 GeeIterator* _tmp0_;
2333 GeeIterator* result = NULL;
2334 _data22_ = g_slice_new0 (Block22Data);
2335 _data22_->_ref_count_ = 1;
2336 _data22_->self = g_object_ref (self);
2337 _data22_->a_type = a_type;
2338 _data22_->a_dup_func = a_dup_func;
2339 _data22_->a_destroy_func = a_destroy_func;
2340 (_data22_->f_target_destroy_notify == NULL) ? NULL : (_data22_->f_target_destroy_notify (_data22_->f_target), NULL);
2341 _data22_->f = NULL;
2342 _data22_->f_target = NULL;
2343 _data22_->f_target_destroy_notify = NULL;
2344 _data22_->f = f;
2345 _data22_->f_target = f_target;
2346 _data22_->f_target_destroy_notify = f_target_destroy_notify;
2347 _data22_->current = NULL;
2348 _tmp0_ = gee_traversable_stream (self, a_type, (GBoxedCopyFunc) a_dup_func, (GDestroyNotify) a_destroy_func, ___lambda18__gee_stream_func, block22_data_ref (_data22_), block22_data_unref);
2349 result = _tmp0_;
2350 block22_data_unref (_data22_);
2351 _data22_ = NULL;
2352 return result;
2353 }
2354
2355 GeeIterator*
gee_traversable_flat_map(GeeTraversable * self,GType a_type,GBoxedCopyFunc a_dup_func,GDestroyNotify a_destroy_func,GeeFlatMapFunc f,gpointer f_target,GDestroyNotify f_target_destroy_notify)2356 gee_traversable_flat_map (GeeTraversable* self,
2357 GType a_type,
2358 GBoxedCopyFunc a_dup_func,
2359 GDestroyNotify a_destroy_func,
2360 GeeFlatMapFunc f,
2361 gpointer f_target,
2362 GDestroyNotify f_target_destroy_notify)
2363 {
2364 g_return_val_if_fail (self != NULL, NULL);
2365 return GEE_TRAVERSABLE_GET_INTERFACE (self)->flat_map (self, a_type, a_dup_func, a_destroy_func, f, f_target, f_target_destroy_notify);
2366 }
2367
2368 /**
2369 * Splits the traversable into multiple ones, caching the result if needed.
2370 *
2371 * Note: In {@link Iterator} implementation using the parent iterator is
2372 * not allowed. However if any of the forked iterators {@link Iterator.next}
2373 * return false then it is treated as if the parent iterator
2374 * {@link Iterator.next} returned false.
2375 *
2376 * Note: The returned arrey might contain parent iterator if it is allowed
2377 * by implementation. For example the iteration over collection does
2378 * not need to generate and cache the results.
2379 * In such case it is recommended to return the value as the first element
2380 * of the array. This allows the consumer to check just the first element
2381 * if it can perform optimizations for such case. However it //must// not
2382 * depend on the order (that's for optimization only).
2383 *
2384 * Note: The resulting iterators does not need to be thread safe.
2385 *
2386 * @param forks Number of iterators in array
2387 * @return An array with created iterators
2388 * @since 0.11.5
2389 */
2390 static Block24Data*
block24_data_ref(Block24Data * _data24_)2391 block24_data_ref (Block24Data* _data24_)
2392 {
2393 g_atomic_int_inc (&_data24_->_ref_count_);
2394 return _data24_;
2395 }
2396
2397 static void
block24_data_unref(void * _userdata_)2398 block24_data_unref (void * _userdata_)
2399 {
2400 Block24Data* _data24_;
2401 _data24_ = (Block24Data*) _userdata_;
2402 if (g_atomic_int_dec_and_test (&_data24_->_ref_count_)) {
2403 GeeTraversable* self;
2404 self = _data24_->self;
2405 _g_object_unref0 (self);
2406 g_slice_free (Block24Data, _data24_);
2407 }
2408 }
2409
2410 static gpointer
_g_object_ref0(gpointer self)2411 _g_object_ref0 (gpointer self)
2412 {
2413 return self ? g_object_ref (self) : NULL;
2414 }
2415
2416 static gpointer
______lambda22_(Block24Data * _data24_)2417 ______lambda22_ (Block24Data* _data24_)
2418 {
2419 GeeTraversable* self;
2420 GeeIterator* _tmp0_;
2421 gpointer _tmp1_;
2422 gpointer result = NULL;
2423 self = _data24_->self;
2424 _tmp0_ = _data24_->_self_;
2425 _tmp1_ = gee_iterator_get (_tmp0_);
2426 result = _tmp1_;
2427 return result;
2428 }
2429
2430 static gpointer
_______lambda22__gee_lazy_func(gpointer self)2431 _______lambda22__gee_lazy_func (gpointer self)
2432 {
2433 gpointer result;
2434 result = ______lambda22_ (self);
2435 return result;
2436 }
2437
2438 static GeeIterator**
gee_traversable_real_tee(GeeTraversable * self,guint forks,gint * result_length1)2439 gee_traversable_real_tee (GeeTraversable* self,
2440 guint forks,
2441 gint* result_length1)
2442 {
2443 Block24Data* _data24_;
2444 GeeIterable* iself = NULL;
2445 GeeIterator* _tmp0_;
2446 GeeIterator** result = NULL;
2447 _data24_ = g_slice_new0 (Block24Data);
2448 _data24_->_ref_count_ = 1;
2449 _data24_->self = g_object_ref (self);
2450 _data24_->_self_ = GEE_IS_ITERATOR (self) ? ((GeeIterator*) self) : NULL;
2451 _tmp0_ = _data24_->_self_;
2452 if (_tmp0_ != NULL) {
2453 if (forks == ((guint) 0)) {
2454 GeeIterator** _tmp1_;
2455 GeeIterator** _tmp2_;
2456 gint _tmp2__length1;
2457 _tmp1_ = g_new0 (GeeIterator*, 0 + 1);
2458 _tmp2_ = _tmp1_;
2459 _tmp2__length1 = 0;
2460 if (result_length1) {
2461 *result_length1 = _tmp2__length1;
2462 }
2463 result = _tmp2_;
2464 block24_data_unref (_data24_);
2465 _data24_ = NULL;
2466 return result;
2467 } else {
2468 if (forks == ((guint) 1)) {
2469 GeeIterator* _tmp3_;
2470 GeeIterator* _tmp4_;
2471 GeeIterator** _tmp5_;
2472 GeeIterator** _tmp6_;
2473 gint _tmp6__length1;
2474 _tmp3_ = _data24_->_self_;
2475 _tmp4_ = _g_object_ref0 (_tmp3_);
2476 _tmp5_ = g_new0 (GeeIterator*, 1 + 1);
2477 _tmp5_[0] = _tmp4_;
2478 _tmp6_ = _tmp5_;
2479 _tmp6__length1 = 1;
2480 if (result_length1) {
2481 *result_length1 = _tmp6__length1;
2482 }
2483 result = _tmp6_;
2484 block24_data_unref (_data24_);
2485 _data24_ = NULL;
2486 return result;
2487 } else {
2488 GeeIterator** _result_ = NULL;
2489 GeeIterator** _tmp7_;
2490 gint _result__length1;
2491 gint __result__size_;
2492 GeeLazy* data = NULL;
2493 gboolean is_valid = FALSE;
2494 GeeIterator* _tmp8_;
2495 gboolean _tmp9_;
2496 gboolean _tmp10_;
2497 GeeTeeIteratorNode* head = NULL;
2498 GeeLazy* _tmp13_;
2499 GeeLazy* _tmp14_;
2500 GeeIterator* _tmp15_;
2501 GeeLazy* _tmp16_;
2502 GeeLazy* _tmp17_;
2503 GeeTeeIteratorNode* _tmp18_;
2504 GeeIterator** _tmp24_;
2505 gint _tmp24__length1;
2506 _tmp7_ = g_new0 (GeeIterator*, forks + 1);
2507 _result_ = _tmp7_;
2508 _result__length1 = forks;
2509 __result__size_ = _result__length1;
2510 _tmp8_ = _data24_->_self_;
2511 _tmp9_ = gee_iterator_get_valid (_tmp8_);
2512 _tmp10_ = _tmp9_;
2513 is_valid = _tmp10_;
2514 if (is_valid) {
2515 GeeLazy* _tmp11_;
2516 _tmp11_ = gee_lazy_new (GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_type (self), (GBoxedCopyFunc) GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_dup_func (self), (GDestroyNotify) GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_destroy_func (self), _______lambda22__gee_lazy_func, block24_data_ref (_data24_), block24_data_unref);
2517 _gee_lazy_unref0 (data);
2518 data = _tmp11_;
2519 } else {
2520 GeeLazy* _tmp12_;
2521 _tmp12_ = gee_lazy_new_from_value (GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_type (self), (GBoxedCopyFunc) GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_dup_func (self), (GDestroyNotify) GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_destroy_func (self), NULL);
2522 _gee_lazy_unref0 (data);
2523 data = _tmp12_;
2524 }
2525 _tmp13_ = data;
2526 _tmp14_ = _gee_lazy_ref0 (_tmp13_);
2527 _tmp15_ = _data24_->_self_;
2528 _tmp16_ = data;
2529 _tmp17_ = gee_tee_iterator_create_nodes (GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_type (self), (GBoxedCopyFunc) GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_dup_func (self), (GDestroyNotify) GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_destroy_func (self), _tmp15_, _tmp16_);
2530 _tmp18_ = gee_tee_iterator_node_new (GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_type (self), (GBoxedCopyFunc) GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_dup_func (self), (GDestroyNotify) GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_destroy_func (self), _tmp14_, _tmp17_);
2531 head = _tmp18_;
2532 {
2533 guint i = 0U;
2534 i = (guint) 0;
2535 {
2536 gboolean _tmp19_ = FALSE;
2537 _tmp19_ = TRUE;
2538 while (TRUE) {
2539 GeeIterator** _tmp21_;
2540 gint _tmp21__length1;
2541 GeeTeeIteratorNode* _tmp22_;
2542 GeeTeeIterator* _tmp23_;
2543 if (!_tmp19_) {
2544 guint _tmp20_;
2545 _tmp20_ = i;
2546 i = _tmp20_ + 1;
2547 }
2548 _tmp19_ = FALSE;
2549 if (!(i < forks)) {
2550 break;
2551 }
2552 _tmp21_ = _result_;
2553 _tmp21__length1 = _result__length1;
2554 _tmp22_ = head;
2555 _tmp23_ = gee_tee_iterator_new (GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_type (self), (GBoxedCopyFunc) GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_dup_func (self), (GDestroyNotify) GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_destroy_func (self), _tmp22_, is_valid);
2556 _g_object_unref0 (_tmp21_[i]);
2557 _tmp21_[i] = (GeeIterator*) _tmp23_;
2558 }
2559 }
2560 }
2561 _tmp24_ = _result_;
2562 _tmp24__length1 = _result__length1;
2563 if (result_length1) {
2564 *result_length1 = _tmp24__length1;
2565 }
2566 result = _tmp24_;
2567 _gee_tee_iterator_node_unref0 (head);
2568 _gee_lazy_unref0 (data);
2569 block24_data_unref (_data24_);
2570 _data24_ = NULL;
2571 return result;
2572 }
2573 }
2574 } else {
2575 GeeIterable* _tmp25_;
2576 iself = GEE_IS_ITERABLE (self) ? ((GeeIterable*) self) : NULL;
2577 _tmp25_ = iself;
2578 if (_tmp25_ != NULL) {
2579 GeeIterator** _result_ = NULL;
2580 GeeIterator** _tmp26_;
2581 gint _result__length1;
2582 gint __result__size_;
2583 GeeIterator** _tmp32_;
2584 gint _tmp32__length1;
2585 _tmp26_ = g_new0 (GeeIterator*, forks + 1);
2586 _result_ = _tmp26_;
2587 _result__length1 = forks;
2588 __result__size_ = _result__length1;
2589 {
2590 guint i = 0U;
2591 i = (guint) 0;
2592 {
2593 gboolean _tmp27_ = FALSE;
2594 _tmp27_ = TRUE;
2595 while (TRUE) {
2596 GeeIterator** _tmp29_;
2597 gint _tmp29__length1;
2598 GeeIterable* _tmp30_;
2599 GeeIterator* _tmp31_;
2600 if (!_tmp27_) {
2601 guint _tmp28_;
2602 _tmp28_ = i;
2603 i = _tmp28_ + 1;
2604 }
2605 _tmp27_ = FALSE;
2606 if (!(i < forks)) {
2607 break;
2608 }
2609 _tmp29_ = _result_;
2610 _tmp29__length1 = _result__length1;
2611 _tmp30_ = iself;
2612 _tmp31_ = gee_iterable_iterator (_tmp30_);
2613 _g_object_unref0 (_tmp29_[i]);
2614 _tmp29_[i] = _tmp31_;
2615 }
2616 }
2617 }
2618 _tmp32_ = _result_;
2619 _tmp32__length1 = _result__length1;
2620 if (result_length1) {
2621 *result_length1 = _tmp32__length1;
2622 }
2623 result = _tmp32_;
2624 block24_data_unref (_data24_);
2625 _data24_ = NULL;
2626 return result;
2627 } else {
2628 g_assert_not_reached ();
2629 }
2630 }
2631 block24_data_unref (_data24_);
2632 _data24_ = NULL;
2633 }
2634
2635 GeeIterator**
gee_traversable_tee(GeeTraversable * self,guint forks,gint * result_length1)2636 gee_traversable_tee (GeeTraversable* self,
2637 guint forks,
2638 gint* result_length1)
2639 {
2640 g_return_val_if_fail (self != NULL, NULL);
2641 return GEE_TRAVERSABLE_GET_INTERFACE (self)->tee (self, forks, result_length1);
2642 }
2643
2644 /**
2645 * Returns the first element that matches a given condition
2646 *
2647 * @param pred Predicate to be called to check for matches
2648 * @return The first element that matches or null
2649 * @since 0.19.91
2650 */
2651 static Block25Data*
block25_data_ref(Block25Data * _data25_)2652 block25_data_ref (Block25Data* _data25_)
2653 {
2654 g_atomic_int_inc (&_data25_->_ref_count_);
2655 return _data25_;
2656 }
2657
2658 static void
block25_data_unref(void * _userdata_)2659 block25_data_unref (void * _userdata_)
2660 {
2661 Block25Data* _data25_;
2662 _data25_ = (Block25Data*) _userdata_;
2663 if (g_atomic_int_dec_and_test (&_data25_->_ref_count_)) {
2664 GeeTraversable* self;
2665 self = _data25_->self;
2666 ((_data25_->_result_ == NULL) || (GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_destroy_func (self) == NULL)) ? NULL : (_data25_->_result_ = (GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_destroy_func (self) (_data25_->_result_), NULL));
2667 (_data25_->pred_target_destroy_notify == NULL) ? NULL : (_data25_->pred_target_destroy_notify (_data25_->pred_target), NULL);
2668 _data25_->pred = NULL;
2669 _data25_->pred_target = NULL;
2670 _data25_->pred_target_destroy_notify = NULL;
2671 _g_object_unref0 (self);
2672 g_slice_free (Block25Data, _data25_);
2673 }
2674 }
2675
2676 static gboolean
__lambda25_(Block25Data * _data25_,gpointer item)2677 __lambda25_ (Block25Data* _data25_,
2678 gpointer item)
2679 {
2680 GeeTraversable* self;
2681 gboolean result = FALSE;
2682 self = _data25_->self;
2683 if (_data25_->pred (item, _data25_->pred_target)) {
2684 gpointer _tmp0_;
2685 _tmp0_ = ((item != NULL) && (GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_dup_func (self) != NULL)) ? GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_dup_func (self) ((gpointer) item) : ((gpointer) item);
2686 ((_data25_->_result_ == NULL) || (GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_destroy_func (self) == NULL)) ? NULL : (_data25_->_result_ = (GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_destroy_func (self) (_data25_->_result_), NULL));
2687 _data25_->_result_ = _tmp0_;
2688 result = FALSE;
2689 ((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));
2690 return result;
2691 }
2692 result = TRUE;
2693 ((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));
2694 return result;
2695 }
2696
2697 static gboolean
___lambda25__gee_forall_func(gpointer g,gpointer self)2698 ___lambda25__gee_forall_func (gpointer g,
2699 gpointer self)
2700 {
2701 gboolean result;
2702 result = __lambda25_ (self, g);
2703 return result;
2704 }
2705
2706 static gpointer
gee_traversable_real_first_match(GeeTraversable * self,GeePredicate pred,gpointer pred_target,GDestroyNotify pred_target_destroy_notify)2707 gee_traversable_real_first_match (GeeTraversable* self,
2708 GeePredicate pred,
2709 gpointer pred_target,
2710 GDestroyNotify pred_target_destroy_notify)
2711 {
2712 Block25Data* _data25_;
2713 gpointer _tmp0_;
2714 gpointer result = NULL;
2715 _data25_ = g_slice_new0 (Block25Data);
2716 _data25_->_ref_count_ = 1;
2717 _data25_->self = g_object_ref (self);
2718 (_data25_->pred_target_destroy_notify == NULL) ? NULL : (_data25_->pred_target_destroy_notify (_data25_->pred_target), NULL);
2719 _data25_->pred = NULL;
2720 _data25_->pred_target = NULL;
2721 _data25_->pred_target_destroy_notify = NULL;
2722 _data25_->pred = pred;
2723 _data25_->pred_target = pred_target;
2724 _data25_->pred_target_destroy_notify = pred_target_destroy_notify;
2725 _data25_->_result_ = NULL;
2726 gee_traversable_foreach (self, ___lambda25__gee_forall_func, _data25_);
2727 _tmp0_ = _data25_->_result_;
2728 _data25_->_result_ = NULL;
2729 result = _tmp0_;
2730 block25_data_unref (_data25_);
2731 _data25_ = NULL;
2732 return result;
2733 }
2734
2735 gpointer
gee_traversable_first_match(GeeTraversable * self,GeePredicate pred,gpointer pred_target,GDestroyNotify pred_target_destroy_notify)2736 gee_traversable_first_match (GeeTraversable* self,
2737 GeePredicate pred,
2738 gpointer pred_target,
2739 GDestroyNotify pred_target_destroy_notify)
2740 {
2741 g_return_val_if_fail (self != NULL, NULL);
2742 return GEE_TRAVERSABLE_GET_INTERFACE (self)->first_match (self, pred, pred_target, pred_target_destroy_notify);
2743 }
2744
2745 /**
2746 * Returns whether any element matches the given predicate.
2747 *
2748 * This is similar to @first_match, with the difference that it
2749 * just returns whether there is a match or not, not the value
2750 * of the match.
2751 *
2752 * @param pred Predicate to be called to check for matches
2753 * @return Whether there was a match or not
2754 * @since 0.19.91
2755 */
2756 static gboolean
gee_traversable_real_any_match(GeeTraversable * self,GeePredicate pred,gpointer pred_target,GDestroyNotify pred_target_destroy_notify)2757 gee_traversable_real_any_match (GeeTraversable* self,
2758 GeePredicate pred,
2759 gpointer pred_target,
2760 GDestroyNotify pred_target_destroy_notify)
2761 {
2762 GeePredicate _tmp0_;
2763 gpointer _tmp0__target;
2764 GDestroyNotify _tmp0__target_destroy_notify;
2765 gpointer _tmp1_;
2766 gpointer _tmp2_;
2767 gboolean _tmp3_;
2768 gboolean result = FALSE;
2769 _tmp0_ = pred;
2770 _tmp0__target = pred_target;
2771 _tmp0__target_destroy_notify = pred_target_destroy_notify;
2772 pred = NULL;
2773 pred_target = NULL;
2774 pred_target_destroy_notify = NULL;
2775 _tmp1_ = gee_traversable_first_match (self, _tmp0_, _tmp0__target, _tmp0__target_destroy_notify);
2776 _tmp2_ = _tmp1_;
2777 _tmp3_ = _tmp2_ != NULL;
2778 ((_tmp2_ == NULL) || (GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_destroy_func (self) == NULL)) ? NULL : (_tmp2_ = (GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_destroy_func (self) (_tmp2_), NULL));
2779 result = _tmp3_;
2780 (pred_target_destroy_notify == NULL) ? NULL : (pred_target_destroy_notify (pred_target), NULL);
2781 pred = NULL;
2782 pred_target = NULL;
2783 pred_target_destroy_notify = NULL;
2784 return result;
2785 }
2786
2787 gboolean
gee_traversable_any_match(GeeTraversable * self,GeePredicate pred,gpointer pred_target,GDestroyNotify pred_target_destroy_notify)2788 gee_traversable_any_match (GeeTraversable* self,
2789 GeePredicate pred,
2790 gpointer pred_target,
2791 GDestroyNotify pred_target_destroy_notify)
2792 {
2793 g_return_val_if_fail (self != NULL, FALSE);
2794 return GEE_TRAVERSABLE_GET_INTERFACE (self)->any_match (self, pred, pred_target, pred_target_destroy_notify);
2795 }
2796
2797 /**
2798 * Checks whether all elements match the given predicate.
2799 *
2800 * @param pred Predicate to be called to check for matches
2801 * @return Whether all elements match or not
2802 * @since 0.19.91
2803 */
2804 static Block26Data*
block26_data_ref(Block26Data * _data26_)2805 block26_data_ref (Block26Data* _data26_)
2806 {
2807 g_atomic_int_inc (&_data26_->_ref_count_);
2808 return _data26_;
2809 }
2810
2811 static void
block26_data_unref(void * _userdata_)2812 block26_data_unref (void * _userdata_)
2813 {
2814 Block26Data* _data26_;
2815 _data26_ = (Block26Data*) _userdata_;
2816 if (g_atomic_int_dec_and_test (&_data26_->_ref_count_)) {
2817 GeeTraversable* self;
2818 self = _data26_->self;
2819 (_data26_->pred_target_destroy_notify == NULL) ? NULL : (_data26_->pred_target_destroy_notify (_data26_->pred_target), NULL);
2820 _data26_->pred = NULL;
2821 _data26_->pred_target = NULL;
2822 _data26_->pred_target_destroy_notify = NULL;
2823 _g_object_unref0 (self);
2824 g_slice_free (Block26Data, _data26_);
2825 }
2826 }
2827
2828 static gboolean
__lambda26_(Block26Data * _data26_,gpointer item)2829 __lambda26_ (Block26Data* _data26_,
2830 gpointer item)
2831 {
2832 GeeTraversable* self;
2833 gboolean result = FALSE;
2834 self = _data26_->self;
2835 if (!_data26_->pred (item, _data26_->pred_target)) {
2836 _data26_->_result_ = FALSE;
2837 result = FALSE;
2838 ((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));
2839 return result;
2840 }
2841 result = TRUE;
2842 ((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));
2843 return result;
2844 }
2845
2846 static gboolean
___lambda26__gee_forall_func(gpointer g,gpointer self)2847 ___lambda26__gee_forall_func (gpointer g,
2848 gpointer self)
2849 {
2850 gboolean result;
2851 result = __lambda26_ (self, g);
2852 return result;
2853 }
2854
2855 static gboolean
gee_traversable_real_all_match(GeeTraversable * self,GeePredicate pred,gpointer pred_target,GDestroyNotify pred_target_destroy_notify)2856 gee_traversable_real_all_match (GeeTraversable* self,
2857 GeePredicate pred,
2858 gpointer pred_target,
2859 GDestroyNotify pred_target_destroy_notify)
2860 {
2861 Block26Data* _data26_;
2862 gboolean result = FALSE;
2863 _data26_ = g_slice_new0 (Block26Data);
2864 _data26_->_ref_count_ = 1;
2865 _data26_->self = g_object_ref (self);
2866 (_data26_->pred_target_destroy_notify == NULL) ? NULL : (_data26_->pred_target_destroy_notify (_data26_->pred_target), NULL);
2867 _data26_->pred = NULL;
2868 _data26_->pred_target = NULL;
2869 _data26_->pred_target_destroy_notify = NULL;
2870 _data26_->pred = pred;
2871 _data26_->pred_target = pred_target;
2872 _data26_->pred_target_destroy_notify = pred_target_destroy_notify;
2873 _data26_->_result_ = TRUE;
2874 gee_traversable_foreach (self, ___lambda26__gee_forall_func, _data26_);
2875 result = _data26_->_result_;
2876 block26_data_unref (_data26_);
2877 _data26_ = NULL;
2878 return result;
2879 }
2880
2881 gboolean
gee_traversable_all_match(GeeTraversable * self,GeePredicate pred,gpointer pred_target,GDestroyNotify pred_target_destroy_notify)2882 gee_traversable_all_match (GeeTraversable* self,
2883 GeePredicate pred,
2884 gpointer pred_target,
2885 GDestroyNotify pred_target_destroy_notify)
2886 {
2887 g_return_val_if_fail (self != NULL, FALSE);
2888 return GEE_TRAVERSABLE_GET_INTERFACE (self)->all_match (self, pred, pred_target, pred_target_destroy_notify);
2889 }
2890
2891 /**
2892 * Returns the item in the sequence that contains the max value
2893 * based on the given compare function.
2894 *
2895 * @param compare Function to be called for comparisons
2896 * @return The item containing the max value.
2897 * @since 0.19.91
2898 */
2899 static Block27Data*
block27_data_ref(Block27Data * _data27_)2900 block27_data_ref (Block27Data* _data27_)
2901 {
2902 g_atomic_int_inc (&_data27_->_ref_count_);
2903 return _data27_;
2904 }
2905
2906 static void
block27_data_unref(void * _userdata_)2907 block27_data_unref (void * _userdata_)
2908 {
2909 Block27Data* _data27_;
2910 _data27_ = (Block27Data*) _userdata_;
2911 if (g_atomic_int_dec_and_test (&_data27_->_ref_count_)) {
2912 GeeTraversable* self;
2913 self = _data27_->self;
2914 ((_data27_->max_value == NULL) || (GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_destroy_func (self) == NULL)) ? NULL : (_data27_->max_value = (GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_destroy_func (self) (_data27_->max_value), NULL));
2915 (_data27_->compare_target_destroy_notify == NULL) ? NULL : (_data27_->compare_target_destroy_notify (_data27_->compare_target), NULL);
2916 _data27_->compare = NULL;
2917 _data27_->compare_target = NULL;
2918 _data27_->compare_target_destroy_notify = NULL;
2919 _g_object_unref0 (self);
2920 g_slice_free (Block27Data, _data27_);
2921 }
2922 }
2923
2924 static gboolean
__lambda27_(Block27Data * _data27_,gpointer item)2925 __lambda27_ (Block27Data* _data27_,
2926 gpointer item)
2927 {
2928 GeeTraversable* self;
2929 gboolean _tmp0_ = FALSE;
2930 gboolean result = FALSE;
2931 self = _data27_->self;
2932 if (_data27_->max_value == NULL) {
2933 _tmp0_ = TRUE;
2934 } else {
2935 _tmp0_ = _data27_->compare (_data27_->max_value, item, _data27_->compare_target) > 0;
2936 }
2937 if (_tmp0_) {
2938 gpointer _tmp1_;
2939 _tmp1_ = ((item != NULL) && (GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_dup_func (self) != NULL)) ? GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_dup_func (self) ((gpointer) item) : ((gpointer) item);
2940 ((_data27_->max_value == NULL) || (GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_destroy_func (self) == NULL)) ? NULL : (_data27_->max_value = (GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_destroy_func (self) (_data27_->max_value), NULL));
2941 _data27_->max_value = _tmp1_;
2942 }
2943 result = TRUE;
2944 ((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));
2945 return result;
2946 }
2947
2948 static gboolean
___lambda27__gee_forall_func(gpointer g,gpointer self)2949 ___lambda27__gee_forall_func (gpointer g,
2950 gpointer self)
2951 {
2952 gboolean result;
2953 result = __lambda27_ (self, g);
2954 return result;
2955 }
2956
2957 static gpointer
gee_traversable_real_max(GeeTraversable * self,GCompareDataFunc compare,gpointer compare_target,GDestroyNotify compare_target_destroy_notify)2958 gee_traversable_real_max (GeeTraversable* self,
2959 GCompareDataFunc compare,
2960 gpointer compare_target,
2961 GDestroyNotify compare_target_destroy_notify)
2962 {
2963 Block27Data* _data27_;
2964 gpointer _tmp0_;
2965 gpointer result = NULL;
2966 _data27_ = g_slice_new0 (Block27Data);
2967 _data27_->_ref_count_ = 1;
2968 _data27_->self = g_object_ref (self);
2969 (_data27_->compare_target_destroy_notify == NULL) ? NULL : (_data27_->compare_target_destroy_notify (_data27_->compare_target), NULL);
2970 _data27_->compare = NULL;
2971 _data27_->compare_target = NULL;
2972 _data27_->compare_target_destroy_notify = NULL;
2973 _data27_->compare = compare;
2974 _data27_->compare_target = compare_target;
2975 _data27_->compare_target_destroy_notify = compare_target_destroy_notify;
2976 _data27_->max_value = NULL;
2977 gee_traversable_foreach (self, ___lambda27__gee_forall_func, _data27_);
2978 _tmp0_ = ((_data27_->max_value != NULL) && (GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_dup_func (self) != NULL)) ? GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_dup_func (self) ((gpointer) _data27_->max_value) : ((gpointer) _data27_->max_value);
2979 result = _tmp0_;
2980 block27_data_unref (_data27_);
2981 _data27_ = NULL;
2982 return result;
2983 }
2984
2985 gpointer
gee_traversable_max(GeeTraversable * self,GCompareDataFunc compare,gpointer compare_target,GDestroyNotify compare_target_destroy_notify)2986 gee_traversable_max (GeeTraversable* self,
2987 GCompareDataFunc compare,
2988 gpointer compare_target,
2989 GDestroyNotify compare_target_destroy_notify)
2990 {
2991 g_return_val_if_fail (self != NULL, NULL);
2992 return GEE_TRAVERSABLE_GET_INTERFACE (self)->max (self, compare, compare_target, compare_target_destroy_notify);
2993 }
2994
2995 /**
2996 * Returns the item in the sequence that contains the min value
2997 * based on the given compare function.
2998 *
2999 * @param compare Function to be called for comparisons
3000 * @return The item containing the min value.
3001 * @since 0.19.91
3002 */
3003 static Block28Data*
block28_data_ref(Block28Data * _data28_)3004 block28_data_ref (Block28Data* _data28_)
3005 {
3006 g_atomic_int_inc (&_data28_->_ref_count_);
3007 return _data28_;
3008 }
3009
3010 static void
block28_data_unref(void * _userdata_)3011 block28_data_unref (void * _userdata_)
3012 {
3013 Block28Data* _data28_;
3014 _data28_ = (Block28Data*) _userdata_;
3015 if (g_atomic_int_dec_and_test (&_data28_->_ref_count_)) {
3016 GeeTraversable* self;
3017 self = _data28_->self;
3018 ((_data28_->min_value == NULL) || (GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_destroy_func (self) == NULL)) ? NULL : (_data28_->min_value = (GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_destroy_func (self) (_data28_->min_value), NULL));
3019 (_data28_->compare_target_destroy_notify == NULL) ? NULL : (_data28_->compare_target_destroy_notify (_data28_->compare_target), NULL);
3020 _data28_->compare = NULL;
3021 _data28_->compare_target = NULL;
3022 _data28_->compare_target_destroy_notify = NULL;
3023 _g_object_unref0 (self);
3024 g_slice_free (Block28Data, _data28_);
3025 }
3026 }
3027
3028 static gboolean
__lambda28_(Block28Data * _data28_,gpointer item)3029 __lambda28_ (Block28Data* _data28_,
3030 gpointer item)
3031 {
3032 GeeTraversable* self;
3033 gboolean _tmp0_ = FALSE;
3034 gboolean result = FALSE;
3035 self = _data28_->self;
3036 if (_data28_->min_value == NULL) {
3037 _tmp0_ = TRUE;
3038 } else {
3039 _tmp0_ = _data28_->compare (_data28_->min_value, item, _data28_->compare_target) < 0;
3040 }
3041 if (_tmp0_) {
3042 gpointer _tmp1_;
3043 _tmp1_ = ((item != NULL) && (GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_dup_func (self) != NULL)) ? GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_dup_func (self) ((gpointer) item) : ((gpointer) item);
3044 ((_data28_->min_value == NULL) || (GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_destroy_func (self) == NULL)) ? NULL : (_data28_->min_value = (GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_destroy_func (self) (_data28_->min_value), NULL));
3045 _data28_->min_value = _tmp1_;
3046 }
3047 result = TRUE;
3048 ((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));
3049 return result;
3050 }
3051
3052 static gboolean
___lambda28__gee_forall_func(gpointer g,gpointer self)3053 ___lambda28__gee_forall_func (gpointer g,
3054 gpointer self)
3055 {
3056 gboolean result;
3057 result = __lambda28_ (self, g);
3058 return result;
3059 }
3060
3061 static gpointer
gee_traversable_real_min(GeeTraversable * self,GCompareDataFunc compare,gpointer compare_target,GDestroyNotify compare_target_destroy_notify)3062 gee_traversable_real_min (GeeTraversable* self,
3063 GCompareDataFunc compare,
3064 gpointer compare_target,
3065 GDestroyNotify compare_target_destroy_notify)
3066 {
3067 Block28Data* _data28_;
3068 gpointer _tmp0_;
3069 gpointer result = NULL;
3070 _data28_ = g_slice_new0 (Block28Data);
3071 _data28_->_ref_count_ = 1;
3072 _data28_->self = g_object_ref (self);
3073 (_data28_->compare_target_destroy_notify == NULL) ? NULL : (_data28_->compare_target_destroy_notify (_data28_->compare_target), NULL);
3074 _data28_->compare = NULL;
3075 _data28_->compare_target = NULL;
3076 _data28_->compare_target_destroy_notify = NULL;
3077 _data28_->compare = compare;
3078 _data28_->compare_target = compare_target;
3079 _data28_->compare_target_destroy_notify = compare_target_destroy_notify;
3080 _data28_->min_value = NULL;
3081 gee_traversable_foreach (self, ___lambda28__gee_forall_func, _data28_);
3082 _tmp0_ = ((_data28_->min_value != NULL) && (GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_dup_func (self) != NULL)) ? GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_dup_func (self) ((gpointer) _data28_->min_value) : ((gpointer) _data28_->min_value);
3083 result = _tmp0_;
3084 block28_data_unref (_data28_);
3085 _data28_ = NULL;
3086 return result;
3087 }
3088
3089 gpointer
gee_traversable_min(GeeTraversable * self,GCompareDataFunc compare,gpointer compare_target,GDestroyNotify compare_target_destroy_notify)3090 gee_traversable_min (GeeTraversable* self,
3091 GCompareDataFunc compare,
3092 gpointer compare_target,
3093 GDestroyNotify compare_target_destroy_notify)
3094 {
3095 g_return_val_if_fail (self != NULL, NULL);
3096 return GEE_TRAVERSABLE_GET_INTERFACE (self)->min (self, compare, compare_target, compare_target_destroy_notify);
3097 }
3098
3099 /**
3100 * Returns a new iterator containing the elements in the source
3101 * ordered as specified by the comparison function.
3102 *
3103 * @param compare Comparison function
3104 * @return A new iterator with the source elements sorted.
3105 * @since 0.19.91
3106 */
3107 static Block29Data*
block29_data_ref(Block29Data * _data29_)3108 block29_data_ref (Block29Data* _data29_)
3109 {
3110 g_atomic_int_inc (&_data29_->_ref_count_);
3111 return _data29_;
3112 }
3113
3114 static void
block29_data_unref(void * _userdata_)3115 block29_data_unref (void * _userdata_)
3116 {
3117 Block29Data* _data29_;
3118 _data29_ = (Block29Data*) _userdata_;
3119 if (g_atomic_int_dec_and_test (&_data29_->_ref_count_)) {
3120 GeeTraversable* self;
3121 self = _data29_->self;
3122 _g_object_unref0 (_data29_->_result_);
3123 _g_object_unref0 (self);
3124 g_slice_free (Block29Data, _data29_);
3125 }
3126 }
3127
3128 static gboolean
__lambda48_(Block29Data * _data29_,gpointer item)3129 __lambda48_ (Block29Data* _data29_,
3130 gpointer item)
3131 {
3132 GeeTraversable* self;
3133 gboolean result = FALSE;
3134 self = _data29_->self;
3135 result = gee_abstract_collection_add ((GeeAbstractCollection*) _data29_->_result_, item);
3136 ((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));
3137 return result;
3138 }
3139
3140 static gboolean
___lambda48__gee_forall_func(gpointer g,gpointer self)3141 ___lambda48__gee_forall_func (gpointer g,
3142 gpointer self)
3143 {
3144 gboolean result;
3145 result = __lambda48_ (self, g);
3146 return result;
3147 }
3148
3149 static GeeIterator*
gee_traversable_real_order_by(GeeTraversable * self,GCompareDataFunc compare,gpointer compare_target,GDestroyNotify compare_target_destroy_notify)3150 gee_traversable_real_order_by (GeeTraversable* self,
3151 GCompareDataFunc compare,
3152 gpointer compare_target,
3153 GDestroyNotify compare_target_destroy_notify)
3154 {
3155 Block29Data* _data29_;
3156 GeeArrayList* _tmp0_;
3157 GCompareDataFunc _tmp1_;
3158 gpointer _tmp1__target;
3159 GDestroyNotify _tmp1__target_destroy_notify;
3160 GeeIterator* _tmp2_;
3161 GeeIterator* result = NULL;
3162 _data29_ = g_slice_new0 (Block29Data);
3163 _data29_->_ref_count_ = 1;
3164 _data29_->self = g_object_ref (self);
3165 _tmp0_ = gee_array_list_new (GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_type (self), (GBoxedCopyFunc) GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_dup_func (self), (GDestroyNotify) GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_destroy_func (self), NULL, NULL, NULL);
3166 _data29_->_result_ = _tmp0_;
3167 gee_traversable_foreach (self, ___lambda48__gee_forall_func, _data29_);
3168 _tmp1_ = compare;
3169 _tmp1__target = compare_target;
3170 _tmp1__target_destroy_notify = compare_target_destroy_notify;
3171 compare = NULL;
3172 compare_target = NULL;
3173 compare_target_destroy_notify = NULL;
3174 gee_list_sort ((GeeList*) _data29_->_result_, _tmp1_, _tmp1__target, _tmp1__target_destroy_notify);
3175 _tmp2_ = gee_abstract_collection_iterator ((GeeAbstractCollection*) _data29_->_result_);
3176 result = _tmp2_;
3177 block29_data_unref (_data29_);
3178 _data29_ = NULL;
3179 (compare_target_destroy_notify == NULL) ? NULL : (compare_target_destroy_notify (compare_target), NULL);
3180 compare = NULL;
3181 compare_target = NULL;
3182 compare_target_destroy_notify = NULL;
3183 return result;
3184 }
3185
3186 GeeIterator*
gee_traversable_order_by(GeeTraversable * self,GCompareDataFunc compare,gpointer compare_target,GDestroyNotify compare_target_destroy_notify)3187 gee_traversable_order_by (GeeTraversable* self,
3188 GCompareDataFunc compare,
3189 gpointer compare_target,
3190 GDestroyNotify compare_target_destroy_notify)
3191 {
3192 g_return_val_if_fail (self != NULL, NULL);
3193 return GEE_TRAVERSABLE_GET_INTERFACE (self)->order_by (self, compare, compare_target, compare_target_destroy_notify);
3194 }
3195
3196 GType
gee_traversable_get_element_type(GeeTraversable * self)3197 gee_traversable_get_element_type (GeeTraversable* self)
3198 {
3199 g_return_val_if_fail (self != NULL, 0UL);
3200 return GEE_TRAVERSABLE_GET_INTERFACE (self)->get_element_type (self);
3201 }
3202
3203 static GType
gee_traversable_real_get_element_type(GeeTraversable * base)3204 gee_traversable_real_get_element_type (GeeTraversable* base)
3205 {
3206 GType result;
3207 GeeTraversable* self;
3208 self = base;
3209 result = GEE_TRAVERSABLE_GET_INTERFACE (self)->get_g_type (self);
3210 return result;
3211 }
3212
3213 static void
gee_traversable_default_init(GeeTraversableIface * iface,gpointer iface_data)3214 gee_traversable_default_init (GeeTraversableIface * iface,
3215 gpointer iface_data)
3216 {
3217 iface->stream = gee_traversable_real_stream;
3218 iface->fold = gee_traversable_real_fold;
3219 iface->map = gee_traversable_real_map;
3220 iface->scan = gee_traversable_real_scan;
3221 iface->filter = gee_traversable_real_filter;
3222 iface->chop = gee_traversable_real_chop;
3223 iface->flat_map = gee_traversable_real_flat_map;
3224 iface->tee = gee_traversable_real_tee;
3225 iface->first_match = gee_traversable_real_first_match;
3226 iface->any_match = gee_traversable_real_any_match;
3227 iface->all_match = gee_traversable_real_all_match;
3228 iface->max = gee_traversable_real_max;
3229 iface->min = gee_traversable_real_min;
3230 iface->order_by = gee_traversable_real_order_by;
3231 iface->get_element_type = gee_traversable_real_get_element_type;
3232 }
3233
3234 /**
3235 * It's a common interface for {@link Iterator} and {@link Iterable}. It
3236 * provides a fast, high level functions.
3237 *
3238 * ''{@link Iterator} implementation:'' Please note that most of the functions
3239 * affect the state of the iterator by moving it forward.
3240 * Even if the iterator is {@link BidirIterator} it ''must not''
3241 * rewind the state.
3242 *
3243 * ''{@link Iterable} implementation:'' validy ({@link Iterator.valid})
3244 * of returned iterator is the same as for invalid
3245 * iterator. In other words the following code is semantically equivalent:
3246 *
3247 * {{{
3248 * var x = iterable.function (args);
3249 * var x = iterable.iterator ().function(args);
3250 * }}}
3251 *
3252 * @since 0.7.0
3253 */
3254 GType
gee_traversable_get_type(void)3255 gee_traversable_get_type (void)
3256 {
3257 static volatile gsize gee_traversable_type_id__volatile = 0;
3258 if (g_once_init_enter (&gee_traversable_type_id__volatile)) {
3259 static const GTypeInfo g_define_type_info = { sizeof (GeeTraversableIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_traversable_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
3260 GType gee_traversable_type_id;
3261 gee_traversable_type_id = g_type_register_static (G_TYPE_INTERFACE, "GeeTraversable", &g_define_type_info, 0);
3262 g_type_interface_add_prerequisite (gee_traversable_type_id, G_TYPE_OBJECT);
3263 g_once_init_leave (&gee_traversable_type_id__volatile, gee_traversable_type_id);
3264 }
3265 return gee_traversable_type_id__volatile;
3266 }
3267
3268 static void
_vala_array_destroy(gpointer array,gint array_length,GDestroyNotify destroy_func)3269 _vala_array_destroy (gpointer array,
3270 gint array_length,
3271 GDestroyNotify destroy_func)
3272 {
3273 if ((array != NULL) && (destroy_func != NULL)) {
3274 int i;
3275 for (i = 0; i < array_length; i = i + 1) {
3276 if (((gpointer*) array)[i] != NULL) {
3277 destroy_func (((gpointer*) array)[i]);
3278 }
3279 }
3280 }
3281 }
3282
3283 static void
_vala_array_free(gpointer array,gint array_length,GDestroyNotify destroy_func)3284 _vala_array_free (gpointer array,
3285 gint array_length,
3286 GDestroyNotify destroy_func)
3287 {
3288 _vala_array_destroy (array, array_length, destroy_func);
3289 g_free (array);
3290 }
3291
3292