[libgee] Add the implementation for PriorityQueue.foreach



commit fd10371c60e12f9b93325355e6d4c51b0411fdcb
Author: Maciej Piechotka <uzytkownik2 gmail com>
Date:   Mon Jul 15 19:51:16 2013 +0200

    Add the implementation for PriorityQueue.foreach

 gee/priorityqueue.vala |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/gee/priorityqueue.vala b/gee/priorityqueue.vala
index d6f6abe..9b2cbdc 100644
--- a/gee/priorityqueue.vala
+++ b/gee/priorityqueue.vala
@@ -103,7 +103,7 @@ public class Gee.PriorityQueue<G> : Gee.AbstractQueue<G> {
        public override bool is_full {
                get { return false; }
        }
-       
+
        /**
         * { inheritDoc}
         */
@@ -368,6 +368,18 @@ public class Gee.PriorityQueue<G> : Gee.AbstractQueue<G> {
                return new Iterator<G> (this);
        }
 
+       /**
+        * { inheritDoc}
+        */
+       public override bool foreach (ForallFunc f) {
+               for (unowned Node<G>? current = _iter_head; current != null; current = current.iter_next) {
+                       if (!f (current.data)) {
+                               return false;
+                       }
+               }
+               return true;
+       }
+
        private inline int _compare (Node<G> node1, Node<G> node2) {
                // Assume there can't be two nodes pending drop
                if (node1.pending_drop) {


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