Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes
turtle.Tbuffer Class Reference
Inheritance diagram for turtle.Tbuffer:
Inheritance graph
[legend]
Collaboration diagram for turtle.Tbuffer:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def reset
def push
def pop
def nr_of_items
def __repr__

Public Attributes

 bufsize
 buffer
 ptr
 cumulate
_PyObject_HEAD_EXTRA Py_ssize_t ob_refcnt
struct _typeobjectob_type

Detailed Description

Ring buffer used as undobuffer for RawTurtle objects.

Definition at line 918 of file turtle.py.


Constructor & Destructor Documentation

def turtle.Tbuffer.__init__ (   self,
  bufsize = 10 
)

Definition at line 920 of file turtle.py.

00920 
00921     def __init__(self, bufsize=10):
00922         self.bufsize = bufsize
00923         self.buffer = [[None]] * bufsize
00924         self.ptr = -1
        self.cumulate = False

Here is the caller graph for this function:


Member Function Documentation

def turtle.Tbuffer.__repr__ (   self)

Definition at line 951 of file turtle.py.

00951 
00952     def __repr__(self):
00953         return str(self.buffer) + " " + str(self.ptr)
00954 
00955 

Definition at line 949 of file turtle.py.

00949 
00950     def nr_of_items(self):
        return self.bufsize - self.buffer.count([None])
def turtle.Tbuffer.pop (   self)

Definition at line 940 of file turtle.py.

00940 
00941     def pop(self):
00942         if self.bufsize > 0:
00943             item = self.buffer[self.ptr]
00944             if item is None:
00945                 return None
00946             else:
00947                 self.buffer[self.ptr] = [None]
00948                 self.ptr = (self.ptr - 1) % self.bufsize
                return (item)
def turtle.Tbuffer.push (   self,
  item 
)

Definition at line 933 of file turtle.py.

00933 
00934     def push(self, item):
00935         if self.bufsize > 0:
00936             if not self.cumulate:
00937                 self.ptr = (self.ptr + 1) % self.bufsize
00938                 self.buffer[self.ptr] = item
00939             else:
                self.buffer[self.ptr].append(item)

Here is the call graph for this function:

def turtle.Tbuffer.reset (   self,
  bufsize = None 
)

Definition at line 925 of file turtle.py.

00925 
00926     def reset(self, bufsize=None):
00927         if bufsize is None:
00928             for i in range(self.bufsize):
00929                 self.buffer[i] = [None]
00930         else:
00931             self.bufsize = bufsize
00932             self.buffer = [[None]] * bufsize
        self.ptr = -1

Here is the caller graph for this function:


Member Data Documentation

Definition at line 922 of file turtle.py.

Definition at line 921 of file turtle.py.

Definition at line 924 of file turtle.py.

Definition at line 107 of file object.h.

struct _typeobject* _object::ob_type [inherited]

Definition at line 108 of file object.h.

Definition at line 923 of file turtle.py.


The documentation for this class was generated from the following file: