<commit_before>import Em from 'ember';
var observer = Em.observer;
var computed = Em.computed;
var oneWay = computed.oneWay;

/**
 * Responsible for observing and maintaining the position of the focused cell.
 * @module mixins
 * @constructor
 * @class FocusPositionMixin
 * @extends Ember.Mixin
 */
var FocusPositionMixin = Em.Mixin.create({
	focusRow: oneWay('sortedRows.firstObject'),
	focusColumn: oneWay('sortedColumns.firstObject'),

	getRowIndex: function (row) {
		var sortedRows = this.get('sortedRows');
		var rowIndex = sortedRows.indexOf(row);
		return rowIndex;
	},

	getVisibleRowIndex: function (row) {
		var visibleRows = this.get('sortedRows').rejectBy('isHidden');
		var rowIndex = visibleRows.indexOf(row);
		return rowIndex;
	},

	getVisibleRowAtIndex: function (rowIndex) {
		var visibleRows = this.get('sortedRows').rejectBy('isHidden');
		var row = visibleRows.objectAt(rowIndex);
		return row;
	},

	getVisibleColumnIndex: function (column) {
		var visibleColumns = this.get('sortedColumns').rejectBy('isHidden');
		var columnIndex = visibleColumns.indexOf(column);
		return columnIndex;
	},

	getVisibleColumnAtIndex: function (columnIndex) {
		var visibleColumns = this.get('sortedColumns').rejectBy('isHidden');
		var column = visibleColumns.objectAt(columnIndex);
		return column;
	},

	getCellFor: function (row, column) {
		var rowIndex = this.getRowIndex(row);
		var columngroupViews = this.get('bodyColumngroupViews');
		var cellView;
		columngroupViews.find(function (columngroupView) {
			var columnViews = columngroupView.get('columnViews');
			var columnView = columnViews.find(function (columnView) {
				return columnView.get('column') === column;
			});
			if (!columnView) return;
			var cellViews = columnView.get('cellViews');
			cellView = cellViews.objectAt(rowIndex);<commit_msg>Allow searching of visible columns/rows at negative index<commit_after>import Em from 'ember';
var observer = Em.observer;
var computed = Em.computed;
var oneWay = computed.oneWay;

/**
 * Responsible for observing and maintaining the position of the focused cell.
 * @module mixins
 * @constructor
 * @class FocusPositionMixin
 * @extends Ember.Mixin
 */
var FocusPositionMixin = Em.Mixin.create({
	focusRow: oneWay('sortedRows.firstObject'),
	focusColumn: oneWay('sortedColumns.firstObject'),

	getRowIndex: function (row) {
		var sortedRows = this.get('sortedRows');
		var rowIndex = sortedRows.indexOf(row);
		return rowIndex;
	},

	getVisibleRowIndex: function (row) {
		var visibleRows = this.get('sortedRows').rejectBy('isHidden');
		var rowIndex = visibleRows.indexOf(row);
		return rowIndex;
	},

	getVisibleRowAtIndex: function (rowIndex) {
		var visibleRows = this.get('sortedRows').rejectBy('isHidden');
		var row;
		if (rowIndex < 0) {
			rowIndex = visibleRows.length + rowIndex;
		}
		row = visibleRows.objectAt(rowIndex);
		return row;
	},

	getVisibleColumnIndex: function (column) {
		var visibleColumns = this.get('sortedColumns').rejectBy('isHidden');
		var columnIndex = visibleColumns.indexOf(column);
		return columnIndex;
	},

	getVisibleColumnAtIndex: function (columnIndex) {
		var visibleColumns = this.get('sortedColumns').rejectBy('isHidden');
		var column;
		if (columnIndex < 0) {
			columnIndex = visibleColumns.length + columnIndex;
		}
		column = visibleColumns.objectAt(columnIndex);
		return column;
	},

	getCellFor: function (row, column) {
		var rowIndex = this.getRowIndex(row);
		var columngroupViews = this.get('bodyColumngroupViews');
		var cellView;
		columngroupViews.find(function (columngroupView) {
			var columnViews = columngroupView.get('columnViews');
			var columnView = columnViews.find(function (columnView) {
				return columnView.get('column') === column;
			});
			if (!columnView) return;
			var cellViews = columnView.get('cellViews');
			cellView = cellViews.objectAt(rowIndex);
{'fraction_non_alphanumeric': 0.1239968936060057, 'fraction_numerical': 0.0005177323323841574, 'mean_word_length': 5.202247191011236, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '3804590', 'n_tokens_mistral': 1294, 'n_tokens_neox': 1163, 'n_words': 270}