/*
 * Row.js: 
 * This file defines a Row object.
 * Each row has a name, followed by an array of images
 */
function Row (rowImages) {
    var width = rowImages.length;
    this.width = width
    this.rowImages = new Array(width);
    for (var i = 0; i < width; i++) {
        this.rowImages[i] = rowImages[i];
    }
}

Row.prototype.width = function() {
    return this.width;
}

Row.prototype.image = function(i) {
    return this.rowImages[i];
}

Row.prototype.name = function() {
    return this.name;
}

Row.fromString = function (s) {
    var len = s.length;
    var c = " ";
    var rowImages = new Array(Matrix.width);
    for (var l = 0; l < Matrix.width; l++) {
        if (l < len) {
            c = s.charAt(l);
            rowImages [l] = Table.char2image(c);
        }
        else {
            c = " ";
            rowImages [l] = Table.char2image(c);
        }
    }
    var row = new Row(rowImages);
    return row;
} 

