return _index >= 0 && _index < _list._size && ! _removed;
}
}
+
+ public void foreach (ForallFunc<G> f) {
+ assert (_stamp == _list._stamp);
+ if (_index < 0 || _removed)
+ _index++;
+ while (_index < _list._size) {
+ f (_list._items[_index]);
+ _index++;
+ }
+ _index = _list._size;
+ }
}
}
return _node != null;
}
}
+
+ public void foreach (ForallFunc<G> f) {
+ assert (_stamp == _set._stamp);
+ if (_node != null)
+ f (_node.key);
+ while (_index + 1 < _set._array_size || _next != null) {
+ if (_next != null) {
+ _node = _next;
+ f (_node.key);
+ _next = _node.next;
+ } else {
+ _index++;
+ _next = _set._nodes[_index];
+ }
+ }
+ }
}
}
public override int index_of (G item) {
int result = -1;
int idx = 0;
- foreach (G node_item in this) {
+ foreach (G node_item in (Collection)this) {
if (this.equal_func (item, node_item)) {
result = idx;
break;
return !this.removed && this.position != null;
}
}
+
+ public void foreach (ForallFunc<G> f) {
+ assert (_stamp == _list._stamp);
+ if (!started) {
+ position = _list._head;
+ if (position != null)
+ started = true;
+ }
+ removed = false;
+ while (position != null) {
+ f (position.data);
+ position = position.next;
+ }
+ position = _list._tail;
+ }
}
private unowned Node<G>? _get_node_at (int index) {
return started && ! removed && position != null;
}
}
+
+ /*public void foreach (ForallFunc<G> f) {
+ assert (stamp == queue._stamp);
+ if (position != null)
+ f (position.data);
+ else if (_next != null)
+ removed = false;
+ if (_next == null)
+ _has_next ();
+ while (_next != null) {
+ position = _next;
+ f (position.data);
+ _has_next ();
+ }
+ }*/
}
}
return true;
}
}
+
+ public void foreach (ForallFunc<G> f) {
+ _iter.foreach (f);
+ }
+
}
public virtual Collection<G> read_only_view {
}
}
+ public void foreach (ForallFunc<G> f) {
+ assert (stamp == _set.stamp);
+ if (current != null) {
+ f (current.key);
+ _next = current.next;
+ } else if (!started) {
+ _next = _set._first;
+ }
+ while (_next != null) {
+ current = _next;
+ f (current.key);
+ _next = current.next;
+ }
+ }
+
private weak Node<G>? current = null;
private weak Node<G>? _next = null;
private weak Node<G>? _prev = null;