| Short description: |
bidirectional external iterators |
| Category: |
Library/Design Patterns |
| Status: |
stable |
| Created: |
2003-11-20 13:01:21 GMT |
| Last update: |
2004-05-06 09:17:48 GMT |
| Owner: |
neoneye
(Projects of this owner) |
| Homepage: |
http://aeditor.rubyforge.org/iterator/ |
| Download: |
http://rubyforge.org/frs/?group_id=18&release_id=467
|
| License: |
Ruby's |
| Dependency: |
|
| Description: |
A bunch of external iterators with an interface similar to the GoF design pattern. Its carefully unittested.
It supports the following iterators:
Collection, iterates over an Array or similar containers.
Reverse, decorator which reverses the iterator.
Range, iterate in the range between two iterators.
Concat, concat multiple iterators into one.
Continuation, turn #each_word/#each_byte into an iterator.
ProxyLast, remembers the last visited value.
Plus some StandardTemplateLibrary inspired methods that operate
on iterators.
#copy
#copy_n
#copy_backward
#fill
#fill_n
#transform
#transform2
License
=======
Ruby's license.
Example
=======
We can virtually concatene two arrays, so that they appear
as they were a single array.
def test_concat_sort
i1 = [5, 3, 1].create_iterator
i2 = [2, 4, 6].create_iterator
iterator = Iterator::Concat.new(i1, i2)
assert_equal((1..6).to_a, iterator.sort)
end
|
| Versions: |
[0.7 (2004-05-06)]
[0.6 (-)]
|