graph :: ArcsIterator :: defaultinit
graph $ ArcsIterator :: SELF
Type of this instance, automatically specialized in every classgraph $ ArcsIterator :: init
core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
graph :: ArcsIterator :: defaultinit
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.
Iterator
whose elements are sorted by the function
core :: Object :: output_class_name
Display class name on stdout (debug only).
# Arcs iterator
class ArcsIterator[V: Object]
super Iterator[Array[V]]
# The graph whose arcs are iterated over
var graph: Digraph[V]
# Attributes
#
private var sources_iterator: Iterator[V] is noinit
private var targets_iterator: Iterator[V] is noinit
init
do
sources_iterator = graph.vertices_iterator
if sources_iterator.is_ok then
targets_iterator = graph.successors(sources_iterator.item).iterator
if not targets_iterator.is_ok then update_iterators
end
end
redef fun is_ok do return sources_iterator.is_ok and targets_iterator.is_ok
redef fun item do return [sources_iterator.item, targets_iterator.item]
redef fun next
do
targets_iterator.next
update_iterators
end
private fun update_iterators
do
while not targets_iterator.is_ok and sources_iterator.is_ok
do
sources_iterator.next
if sources_iterator.is_ok then
targets_iterator = graph.successors(sources_iterator.item).iterator
end
end
end
end
lib/graph/digraph.nit:671,1--710,3