Peach :: Generators :: incrementor :: Incrementor :: Class Incrementor
[hide private]

Class Incrementor

source code


Increment a value by another value each round. For example, one could set 1 as an initial value with an incrementor of 1.

Instance Methods [hide private]
 
__init__(self, group=None, value=1, incrementor=1, formatString=None, maxValue=None, maxIterations=None, packString=None)
Base constructor, please call me!
source code
 
next(self)
Next value.
source code
 
reset(self)
Called to reset the generator to its initial state.
source code
string
getRawValue(self)
Return raw value w/o passing through transformer if set.
source code
 
setValue(self, value)
Set value to increment.
source code

Inherited from generator.Generator: __iter__, getGroup, getName, getTransformer, getValue, identity, setGroup, setName, setTransformer

Static Methods [hide private]
 
unittest() source code
Class Variables [hide private]
  _roundCount = 0
  _value = None
  _incrementor = None
  _currentValue = None
  _formatString = None
  _maxValue = None
  _maxIterations = None
  _packString = None
Method Details [hide private]

__init__(self, group=None, value=1, incrementor=1, formatString=None, maxValue=None, maxIterations=None, packString=None)
(Constructor)

source code 

Base constructor, please call me!

Parameters:
  • group (Group) - Group this generator works with
  • value (number) - Number to increment
  • incrementor (number) - Increment amount (can be negative), default is 1
  • formatString (string) - Format string for value (optional)
  • maxValue (number) - Maximum value (optional, default None)
  • maxIterations (number) - Maximum number of times to increment value (optional, default None)
  • packString (string) - Pack format string. Note that use of this option will override formatString. (optional, default None)
Overrides: generator.Generator.__init__

next(self)

source code 

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)

reset(self)

source code 

Called to reset the generator to its initial state. OVERRIDE

Overrides: generator.Generator.reset
(inherited documentation)

getRawValue(self)

source code 

Return raw value w/o passing through transformer if set. OVERRIDE

Returns: string
Data before transformations
Overrides: generator.Generator.getRawValue
(inherited documentation)

setValue(self, value)

source code 

Set value to increment.

Parameters:
  • value (number) - Number to increment