DummyArray
.dummy_array :: DummyIterator :: defaultinit
Initialize an iterator forarray
.
dummy_array $ DummyIterator :: SELF
Type of this instance, automatically specialized in every classcore :: Object :: class_factory
Implementation used byget_class
to create the specific class.
core :: Iterator :: defaultinit
dummy_array :: DummyIterator :: defaultinit
Initialize an iterator forarray
.
core :: Object :: 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).
# An iterator over a `DummyArray`.
class DummyIterator
super Iterator[Int]
private var array: DummyArray
private var pos: Int
redef fun item: Int
do
assert is_ok
return _array.value_at(_pos)
end
redef fun is_ok: Bool
do
return _pos < _array.length
end
redef fun next do _pos = _pos + 1 end
# Initialize an iterator for `array`.
init(array: DummyArray) is old_style_init do
_pos = 0
_array = array
end
end
lib/dummy_array/dummy_array.nit:90,1--114,3