ordered_tree $ OrderedTreeIterator :: SELF
Type of this instance, automatically specialized in every classcore :: Object :: class_factory
Implementation used byget_class
to create the specific class.
core :: Object :: defaultinit
core :: Iterator :: defaultinit
core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
core :: Object :: native_class_name
The class name of the object in CString format.Iterator
whose elements are sorted by the function
core :: Object :: output_class_name
Display class name on stdout (debug only).
# An Iterator over an OrderedTree
private class OrderedTreeIterator[E: Object]
super Iterator[E]
var tree: OrderedTree[E]
var iterators = new Array[Iterator[E]]
init do
if not tree.is_empty then
iterators.add tree.roots.iterator
end
end
redef fun is_ok do return not iterators.is_empty
redef fun item do
assert is_ok
return iterators.last.item
end
redef fun next do
assert is_ok
if tree.sub.has_key(item) then
iterators.add tree.sub[item].iterator
else
iterators.last.next
while is_ok and not iterators.last.is_ok do
iterators.pop
if is_ok and iterators.last.is_ok then
iterators.last.next
end
end
end
end
redef fun iterator do return new OrderedTreeIterator[E](tree)
end
lib/ordered_tree/ordered_tree.nit:292,1--329,3