2013-06-04 06:17:48 +00:00
|
|
|
/**
|
|
|
|
|
* The model.
|
|
|
|
|
*/
|
|
|
|
|
package main
|
|
|
|
|
|
2018-09-01 01:27:34 +00:00
|
|
|
// An abstract model interface. At a minimum, models must be read only.
|
2015-01-02 23:37:15 +00:00
|
|
|
type Model interface {
|
|
|
|
|
|
2018-09-01 01:27:34 +00:00
|
|
|
// The dimensions of the model (height, width).
|
2015-03-24 02:12:40 +00:00
|
|
|
Dimensions() (int, int)
|
|
|
|
|
|
2018-09-01 01:27:34 +00:00
|
|
|
// Returns the value of a cell
|
2015-03-24 02:12:40 +00:00
|
|
|
CellValue(r, c int) string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// A read/write model.
|
|
|
|
|
type RWModel interface {
|
|
|
|
|
Model
|
|
|
|
|
|
|
|
|
|
// Resize the model.
|
|
|
|
|
Resize(newRow, newCol int)
|
|
|
|
|
|
|
|
|
|
// Sets the cell value
|
|
|
|
|
SetCellValue(r, c int, value string)
|
2018-09-01 01:27:34 +00:00
|
|
|
|
|
|
|
|
// Returns true if the model has been modified in some way
|
|
|
|
|
IsDirty() bool
|
2015-01-02 23:37:15 +00:00
|
|
|
}
|