Expanded some documentation.
Added clean target to doc Makefile.
This commit is contained in:
parent
5d4700da20
commit
fe96772319
|
@ -8,4 +8,7 @@ html:
|
|||
@echo ----------------
|
||||
epydoc --html -o html/ ../fluents ../workflows 2> epydoc-html.log
|
||||
|
||||
clean:
|
||||
-rm -rf html
|
||||
-rm epydoc-html.log
|
||||
|
||||
|
|
|
@ -23,9 +23,19 @@ import scipy
|
|||
active_mode = 'default'
|
||||
|
||||
class ObjectTable:
|
||||
"""A 2D table of elements."""
|
||||
"""A 2D table of elements.
|
||||
An ObjectTable is a resizable two-dimensional array of objects.
|
||||
When resized, it will keep all the elements that fit in the new shape,
|
||||
and forget about other elements. When new elements are needed to fill
|
||||
out the new shape, they will be created.
|
||||
"""
|
||||
|
||||
def __init__(self, xsize=0, ysize=0, creator=None):
|
||||
"""Creates a two-dimensional table of objects.
|
||||
@param xsize: Width of the object table.
|
||||
@param ysize: Height of the object table.
|
||||
@param creator: A function that will be used to instantiate new items.
|
||||
"""
|
||||
self._elements = []
|
||||
self._creator = creator or (lambda : None)
|
||||
self.xsize = xsize
|
||||
|
@ -33,7 +43,18 @@ class ObjectTable:
|
|||
self.resize(xsize, ysize)
|
||||
|
||||
def resize(self, xsize, ysize):
|
||||
"""Resizes the table by removing and creating elements as required."""
|
||||
"""Resizes the table by removing and creating elements as required.
|
||||
Makes the ObjectTable the specified size by removing elements that
|
||||
will not fit in the new shape and appending elements to fill the
|
||||
table. New elements will be created with the creator function passed
|
||||
as an argument to __init__.
|
||||
|
||||
@param xsize: The new width.
|
||||
@type xsize: int
|
||||
@param ysize: The new height.
|
||||
@type ysize: int
|
||||
"""
|
||||
|
||||
# Delete or append new rows
|
||||
del self._elements[ysize:]
|
||||
new_rows = ysize - len(self._elements)
|
||||
|
|
Reference in New Issue