Model subclass: #Spreadsheet
instanceVariableNames: 'mySpreadSheet value '
classVariableNames: ''
poolDictionaries: ''
category: 'Spreadsheets'!
!Spreadsheet methodsFor: 'private'!
mySpreadSheet: newSpreadSheet
"assign a spread sheet"
value: aValue
"update value and broadcast the change to dependencies."
!Spreadsheet methodsFor: 'accessing'!
cell: whichCell
"get the value of a cell"
mySpreadSheet
value
!Spreadsheet methodsFor: 'operations'!
cell: whichCell put: dataItem
"fill a cell with some data"
cells: anArray
"assign mySpreadSheet a fixed array"
updateValue
"force subclasses to implement this method"
"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!
Spreadsheet class
instanceVariableNames: ''!
!Spreadsheet class methodsFor: 'initializing'!
type: typeOfSheet
"create a new spreadsheet of a specified type and return it"
type: typeOfSheet with: sheetArray
"create a new linked spreadsheet of a specified type and return it"
type: typeOfSheet with: sheet1 cell: cell1 with: sheet2 cell: cell2
"create a new spreadsheet linked to two specific cells and return it"
Spreadsheet subclass: #SumSpreadsheet
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'Spreadsheets'!
!SumSpreadsheet methodsFor: 'operations'!
updateValue
"update value with the sum of the spreadsheet"
Spreadsheet subclass: #AverageSpreadsheet
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'Spreadsheets'!
!AverageSpreadsheet methodsFor: 'operations'!
updateValue
"update value with the average value of the spreadsheet's cells"
Object subclass: #SpreadsheetCell
instanceVariableNames: 'sheet cell '
classVariableNames: ''
poolDictionaries: ''
category: 'Spreadsheets'!
!SpreadsheetCell methodsFor: 'accessing'!
cell
cell: aCell
sheet
sheet: aSheet