Spreadsheet:
I am a Spreadsheet.
I am an abstract class.
When I get a message to create
a new spreadsheet of a particular type, I pass the message to the appropriate
subclass for a new spreadsheet and return what that subclass returns to me.
I know my sheetType and I can return it when I am asked for it.
I can set the value of my sheetType (sheetType:).
I know my value.
Cell:
I am a Cell class.
I know my value and my number, I can change my
value(value:) and number(number:).
I can tell my value and number when I am
asked for it.
I create a new one of myself and return it when I get a message new.
I can tell my dependents that my value has changed.
CellSheet:
I am a CellSheet.
I hold a number of Cells.
I can calculate the sum and
average of the values of the Cells that I hold. I store it as my value(value:).
I can return my value when someone asks me for it.
I create a new one of
myself when I receive a message type:, this also tells me whether I should sum
or average the values of my Cells, I return a new one of myself.
I can add new
values to my collection individually(cell: put:) and also when presented in
form of an array(cells:).
I create a new Cell for each of the new value I
receive and add it to my collection at the specified location.
I can calculate my size.
I can return one of my Cells at a particular location(aCell:).
I can also return value of one my Cells at a particular location(cell:).
I can tell my dependents that my value has changed.
SpreadsheetSumSheet:
I am a SpreadsheetSumSheet.
I hold a number of CellSheets.
I can calculate the sum of the values of the CellSheets that I hold.
I store it as my value(value:).
I return my value when someone asks me for it.
I create a new one of myself when I receive a message type: with:.
I add all the CellSheets that I receive in an array with the message to
my collection (with:) and return myself.
I update my value whenever the value of one of my CellSheets changes.
CellAverageSheet:
I am a CellAverageSheet.
I hold two Cells of CellSheet.
I can calculate their average. I store it as my value(value:).
I can tell my value when someone asks for it.
I create a new one of myself when I receive a mes
sage type: with: cell: with: cell:, I add the two Cells of the given
CellSheets to my collection (with: cell: with: cell:) and return myself.
I update my value
whenever the value of one of my Cells changes. I can calculate my size.