asciiflow2/js-lib/state.js

42 lines
964 B
JavaScript
Raw Normal View History

/**
* Classes holding the state of the ascii-diagram.
*/
2014-01-09 20:18:46 +00:00
goog.provide('ascii.State');
/**
* @constructor
*/
2014-01-09 20:18:46 +00:00
ascii.Cell = function() {
/** @type {string|null} */ // Uses the string "#" for lines.
this.value = null;
};
2014-01-09 20:18:46 +00:00
ascii.Cell.prototype.setValue = function(value) {
this.value = value;
};
/**
* @constructor
*/
2014-01-09 20:18:46 +00:00
ascii.State = function() {
/** @type {Array.<Array.<ascii.Cell>>} */
this.cells = new Array(ascii.State.MAX_SIZE);
for (var i = 0; i < this.cells.length; i++) {
2014-01-09 20:18:46 +00:00
this.cells[i] = new Array(ascii.State.MAX_SIZE);
for (var j = 0; j < this.cells[i].length; j++) {
2014-01-09 20:18:46 +00:00
this.cells[i][j] = new ascii.Cell();
// Hack: Just fill image with random stuff for now.
if ((i % 10 == 0) && (j % 10 == 0)) {
var jstr = ("" + j);
this.cells[i][j].setValue(jstr.substring(jstr.length-1,jstr.length));
}
}
}
};
2014-01-09 20:18:46 +00:00
/** @const */ ascii.State.MAX_SIZE = 1000;
2014-01-09 20:18:46 +00:00
ascii.State.prototype.blah = function() {
};