|
Peach ::
Generators ::
dictionary ::
GeneratorList2 ::
Class GeneratorList2
|
|
Class GeneratorList2
source code
Iterates through a specified list of generators (different group
control). When the end of the list is reached a
generator.GeneratorCompleted exceoption is raised.
This generator differs from GeneratorList by allowing one group to
drive the rounds, but associating different sub groups to each generator.
When the master group is incremented the group for the current generator
is also incremented. This allows more complex control of how generators
create data.
NOTE: We only increment to next generator in list when the
GeneratorCompleted exception has been thrown from current generator.
This allows one todo kewl things like have 2 static generators, then a
dictionary, then a repeater.
Example:
>>> groupA = Group()
>>> groupBA = Group()
>>> groupBB = Group()
>>> groupB = GroupForeachDo(groupBA, groupBB)
>>>
>>> gen = GeneratorList2(None, [groupA, groupB], [
... Repeater(groupA, Static('A'), 1, 1, 3),
... Block([
... List(groupBA, [':', '\', '/']),
... Repeater(groupBB, Static('B'), 1, 1, 3)
... ])
... ])
>>>
>>> print gen.getValue()
A
>>> gen.next()
>>> gen.getValue()
AA
>>> gen.next()
>>> gen.getValue()
AAA
>>> gen.next()
>>> gen.getValue()
:B
>>> gen.next()
>>> gen.getValue()
:BB
>>> gen.next()
>>> gen.getValue()
:BBB
>>> gen.next()
>>> gen.getValue()
\B
>>> gen.next()
>>> gen.getValue()
\BB
>>> gen.next()
>>> gen.getValue()
\BBB
>>> gen.next()
>>> gen.getValue()
/B
>>> gen.next()
>>> gen.getValue()
/BB
>>> gen.next()
>>> gen.getValue()
/BBB
|
|
__init__(self,
group,
groupList=None,
list=None,
name=None)
Base constructor, please call me! |
source code
|
|
|
|
|
|
|
|
|
|
|
|
Inherited from GeneratorList:
getList,
getRawValue,
setList
Inherited from generator.Generator:
__iter__,
getGroup,
getName,
getTransformer,
getValue,
identity,
setGroup,
setName,
setTransformer
|
__init__(self,
group,
groupList=None,
list=None,
name=None)
(Constructor)
| source code
|
Base constructor, please call me!
- Parameters:
group (Group) - Group this Generator belongs to
groupList (list) - List of Groups to use on generators
list (list) - List of Generators to iterate through
name (String) - [optional] Name for this Generator. Used for debugging.
- Overrides:
generator.Generator.__init__
|
|
Next value. OVERRIDE
From Python docs on next():
The intention of the protocol is that once an iterator's next()
method raises StopIteration, it will continue to do so on subsequent
calls. Implementations that do not obey this property are deemed broken.
(This constraint was added in Python 2.3; in Python 2.2, various
iterators are broken according to this rule.)
For Generators, please use the GeneratorCompleted exception instead of
StopIteration (its a subclass).
- Overrides:
generator.Generator.next
- (inherited documentation)
|
|
Set list of Groups.
- Parameters:
list (list) - List of Groups
|