diff --git a/doc/Makefile b/doc/Makefile index 7714bd5..82c73b1 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -8,4 +8,7 @@ html: @echo ---------------- epydoc --html -o html/ ../fluents ../workflows 2> epydoc-html.log +clean: + -rm -rf html + -rm epydoc-html.log diff --git a/fluents/plots.py b/fluents/plots.py index 2e9c123..13aa692 100644 --- a/fluents/plots.py +++ b/fluents/plots.py @@ -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)