<commit_before>define(function(require) {
	'use strict';
	var Backbone = require('lib/backbone'),
		config = require('spreadsheet/config'),
		cache = require('basic/tools/cache'),
		send = require('basic/tools/send'),
		original = require('basic/tools/original'),
		observerPattern = require('basic/util/observer.pattern'),
		strandMap = require('basic/tools/strandmap'),
		cols = require('collections/headItemCol'),
		rows = require('collections/headItemRow'),
		cells = require('collections/cells'),
		colList = cols.models,
		rowList = rows.models,
		index2Type = [],
		validate;


	index2Type[config.validationType.intType] = 'intType';
	index2Type[config.validationType.decimalType] = 'decimalType';
	index2Type[config.validationType.sequenceType] = 'sequenceType';
	index2Type[config.validationType.textType] = 'textType';


	validate = {
		validate: function(value, colAlias, rowAlias, colIndex, rowIndex) {
			var ruleIndex = strandMap.calcPointRecord(colAlias, rowAlias, 'validate'),
				validators,
				rule, i, len;

			validators = {
				intType: [intTypeValidator, rangeValidator],
				decimalType: [decimalTypeValidator, rangeValidator],
				textType: [intTypeValidator, lenValidator],
				sequenceType: [sequenceValidator]
			};

			//未输入数据或不存在规则
			if (value === '' || typeof ruleIndex === 'undefined') {
				return true;
			}

			rule = cache.validate[ruleIndex];

			if (rule) {
				validators = validators[index2Type[rule.validationType]];
				for (i = 0, len = validators.length; i < len; i++) {
					if (!validators[i](value, rule.formula1, rule.formula2)) {
						return false;
					}
				}
			} else {
				return getSequence(value, {
					oprCol: colList[colIndex].get('sort'),
					oprRow: rowList[rowIndex].get('sort'),
				});
			}
			return true;

			function intTypeValidator(value) {
				var reg = /^([-]){0,1}[0-9]*$/;
				return reg.test(value);
			}

			function decimalTypeValidator(value) {
				var reg = /^([-]){0,1}[0-9]+(.[0-9]*)?$/;
				return reg.test(value);
			}

			function rangeValidator(value, formula1, formula2) {
				value = parseFloat(value);
				if (value > parseFloat(formula1) || value < parseFloat(formula2)) {
					return false;
				}
				return true;
			}

			function lenValidator(value, formula1, formula2) {
				if (value.length > parseFloat(formula1) || value.length < parseFloat(formula2)) {
					return false;
				}
				return true;
			}

			function sequenceValidator(value, formula1) {
				var arrValidate = [],
					cellList,
					len, i;

				if (typeof formula1 === 'object') {
					cellList = cells.getCellByVertical(cols.getIndexByAlias(formula1.startColAlias),
						rows.getIndexByAlias(formula1.startRowAlias),
						cols.getIndexByAlias(formula1.endColAlias),
						rows.getIndexByAlias(formula1.endRowAlias)
					);
					for (i = 0, len = cellList.length; i < len; i++) {
						arrValidate.push(cellList[i].get('content').texts);
					}
				} else {
					arrValidate = formula1.split(',');
				}

				for (i = 0, len = arrValidate.length; i < len; i++) {<commit_msg>fix(core-sheet): 修改校验模块中，对于范围的判断错误<commit_after>define(function(require) {
	'use strict';
	var Backbone = require('lib/backbone'),
		config = require('spreadsheet/config'),
		cache = require('basic/tools/cache'),
		send = require('basic/tools/send'),
		original = require('basic/tools/original'),
		observerPattern = require('basic/util/observer.pattern'),
		strandMap = require('basic/tools/strandmap'),
		cols = require('collections/headItemCol'),
		rows = require('collections/headItemRow'),
		cells = require('collections/cells'),
		colList = cols.models,
		rowList = rows.models,
		index2Type = [],
		validate;


	index2Type[config.validationType.intType] = 'intType';
	index2Type[config.validationType.decimalType] = 'decimalType';
	index2Type[config.validationType.sequenceType] = 'sequenceType';
	index2Type[config.validationType.textType] = 'textType';


	validate = {
		validate: function(value, colAlias, rowAlias, colIndex, rowIndex) {
			var ruleIndex = strandMap.calcPointRecord(colAlias, rowAlias, 'validate'),
				validators,
				rule, i, len;

			validators = {
				intType: [intTypeValidator, rangeValidator],
				decimalType: [decimalTypeValidator, rangeValidator],
				textType: [intTypeValidator, lenValidator],
				sequenceType: [sequenceValidator]
			};

			//未输入数据或不存在规则
			if (value === '' || typeof ruleIndex === 'undefined') {
				return true;
			}

			rule = cache.validate[ruleIndex];

			if (rule) {
				validators = validators[index2Type[rule.validationType]];
				for (i = 0, len = validators.length; i < len; i++) {
					if (!validators[i](value, rule.formula1, rule.formula2)) {
						return false;
					}
				}
			} else {
				return getSequence(value, {
					oprCol: colList[colIndex].get('sort'),
					oprRow: rowList[rowIndex].get('sort'),
				});
			}
			return true;

			function intTypeValidator(value) {
				var reg = /^([-]){0,1}[0-9]*$/;
				return reg.test(value);
			}

			function decimalTypeValidator(value) {
				var reg = /^([-]){0,1}[0-9]+(.[0-9]*)?$/;
				return reg.test(value);
			}

			function rangeValidator(value, formula1, formula2) {
				value = parseFloat(value);
				if (value < parseFloat(formula1) || value > parseFloat(formula2)) {
					return false;
				}
				return true;
			}

			function lenValidator(value, formula1, formula2) {
				if (value.length < parseFloat(formula1) || value.length > parseFloat(formula2)) {
					return false;
				}
				return true;
			}

			function sequenceValidator(value, formula1) {
				var arrValidate = [],
					cellList,
					len, i;

				if (typeof formula1 === 'object') {
					cellList = cells.getCellByVertical(cols.getIndexByAlias(formula1.startColAlias),
						rows.getIndexByAlias(formula1.startRowAlias),
						cols.getIndexByAlias(formula1.endColAlias),
						rows.getIndexByAlias(formula1.endRowAlias)
					);
					for (i = 0, len = cellList.length; i < len; i++) {
						arrValidate.push(cellList[i].get('content').texts);
					}
				} else {
					arrValidate = formula1.split(',');
				}

				for (i = 0, len = arrValidate.length; i < len; i++) {
{'fraction_non_alphanumeric': 0.15166420724708968, 'fraction_numerical': 0.011805213969503197, 'mean_word_length': 3.6743295019157087, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 7, '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': '3801674', 'n_tokens_mistral': 2486, 'n_tokens_neox': 2004, 'n_words': 365}