<commit_before>import Layer from './layer';
import Row from './row';
import Column from './column';
import Cell from './cell';

class BoxCore {
	constructor() {
	}

	column() {
		return {
			cells: () => {
				return [];
			}
		};
	}

	row() {
		return {
			cells: () => {
				return [];
			}
		};
	}

	rows() {
		return [];
	}

	cell() {
		return null;
	}

	addLayer() {
		return Layer.empty;
	}

	removeLayer() {
	}

	scrollLeft() {
		return 0;
	}

	scrollTop() {
		return 0;
	}
}

export default class Box extends BoxCore {
	constructor(document, element, template) {
		super();

		this.document = document;
		this.element = element;
		this.template = template;
		this.layers = new Map();
	}

	static get empty() {
		return new BoxCore();
	}

	column(index) {
		if (index >= 0) {
			const rows = this._rows();
			if (rows.length) {
				const cellsCount = rows[0].cells.length;
				if (index < cellsCount) {
					return new Column(this.element, index)
				}
			}
		}
		return {
			cells: () => {
				return [];
			},
			cell: () => {
				return null;
			}
		};
	}

	row(index) {
		if (index >= 0) {
			const rows = this._rows();
			if (index < rows.length) {
				return new Row(rows[index]);
			}
		}
		return {
			cells: () => {
				return [];
			},
			cell: () => {
				return null;
			}
		};
	}

	rows() {
		return this._rows().map(element => new Row(element));
	}

	rowCount() {
		return this._rows().length;
	}

	columnCount() {
		if (this.rowCount() > 0) {
			const row = this._rows()[0];
			return row.cells.length;
		}

		return 0;
	}

	cell(row, column) {
		if (row >= 0 && column >= 0) {
			const rows = this._rows();
			if (rows.length) {
				const cellsCount = rows[0].cells.length;
				if (row < rows.length && column < cellsCount) {
					const cell = rows[row].cells[column];
					return new Cell(cell);
				}
			}<commit_msg>fix cell() and cells() of null<commit_after>import Layer from './layer';
import Row from './row';
import Column from './column';
import Cell from './cell';

class BoxCore {
	constructor() {
	}

	column() {
		return {
			cells: () => {
				return [];
			},
			cell: () => {
				return null;
			}
		};
	}

	row() {
		return {
			cells: () => {
				return [];
			},
			cell: () => {
				return null;
			}
		};
	}

	rows() {
		return [];
	}

	cell() {
		return null;
	}

	addLayer() {
		return Layer.empty;
	}

	removeLayer() {
	}

	scrollLeft() {
		return 0;
	}

	scrollTop() {
		return 0;
	}
}

export default class Box extends BoxCore {
	constructor(document, element, template) {
		super();

		this.document = document;
		this.element = element;
		this.template = template;
		this.layers = new Map();
	}

	static get empty() {
		return new BoxCore();
	}

	column(index) {
		if (index >= 0) {
			const rows = this._rows();
			if (rows.length) {
				const cellsCount = rows[0].cells.length;
				if (index < cellsCount) {
					return new Column(this.element, index)
				}
			}
		}
		return Box.empty.column();
	}

	row(index) {
		if (index >= 0) {
			const rows = this._rows();
			if (index < rows.length) {
				return new Row(rows[index]);
			}
		}
		return Box.empty.row();
	}

	rows() {
		return this._rows().map(element => new Row(element));
	}

	rowCount() {
		return this._rows().length;
	}

	columnCount() {
		if (this.rowCount() > 0) {
			const row = this._rows()[0];
			return row.cells.length;
		}

		return 0;
	}

	cell(row, column) {
		if (row >= 0 && column >= 0) {
			const rows = this._rows();
			if (rows.length) {
				const cellsCount = rows[0].cells.length;
				if (row < rows.length && column < cellsCount) {
					const cell = rows[row].cells[column];
					return new Cell(cell);
				}
			}
{'fraction_non_alphanumeric': 0.17543859649122806, 'fraction_numerical': 0.006030701754385965, 'mean_word_length': 2.423076923076923, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4793195', 'n_tokens_mistral': 1614, 'n_tokens_neox': 1308, 'n_words': 315}