Trees | Indices | Toggle frames |
---|
List of contiguous runs of values.
A RunList is an efficient encoding of a sequence of values. For example, the sequence aaaabbccccc is encoded as (4, a), (2, b), (5, c). The class provides methods for modifying and querying the run list without needing to deal with the tricky cases of splitting and merging the run list entries.
Run lists are used to represent formatted character data in pyglet. A separate run list is maintained for each style attribute, for example, bold, italic, font size, and so on. Unless you are overriding the document interfaces, the only interaction with run lists is via RunIterator.
The length and ranges of a run list always refer to the character positions in the decoded list. For example, in the above sequence, set_run(2, 5, 'x') would change the sequence to aaxxxbccccc.
__init__(self,
size,
initial)
Create a run list of the given size and a default value.
|
|
insert(self,
pos,
length)
Insert characters into the run list.
|
|
delete(self,
start,
end)
Remove characters from the run list.
|
|
set_run(self,
start,
end,
value)
Set the value of a range of characters.
|
|
__iter__(self) | |
RunIterator |
get_run_iterator(self)
Get an extended iterator over the run list.
|
object |
__getitem__(self,
index)
Get the value at a character position.
|
__repr__(self) |
Insert characters into the run list.
The inserted characters will take on the value immediately preceding
the insertion point (or the value of the first character, if pos
is
0).
Trees | Indices | Toggle frames |
---|
Generated by Epydoc 3.0beta1 on Thu Dec 31 17:58:20 2009 | http://epydoc.sourceforge.net |