Commit d18dfb21 authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

Поправил проблему с getValue у cArea

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@59915 954022d7-b5bf-4e40-9824-e11837661b57
parent d5753ea7
......@@ -32,7 +32,7 @@ cFormulaFunction.LookupAndReference = {
'RTD':cRTD,
'TRANSPOSE':cTRANSPOSE,
'VLOOKUP':cVLOOKUP
}
};
function cADDRESS() {
// cBaseFunction.call( this, "ADDRESS" );
......@@ -161,7 +161,7 @@ function cCHOOSE() {
}
cCHOOSE.prototype = Object.create( cBaseFunction.prototype )
cCHOOSE.prototype = Object.create( cBaseFunction.prototype );
cCHOOSE.prototype.Calculate = function ( arg ) {
var arg0 = arg[0];
......@@ -183,13 +183,13 @@ cCHOOSE.prototype.Calculate = function ( arg ) {
}
return this.value = new cError( cErrorType.wrong_value_type );
}
};
cCHOOSE.prototype.getInfo = function () {
return {
name:this.name,
args:"( index , argument-list )"
};
}
};
function cCOLUMN() {
// cBaseFunction.call( this, "COLUMN" );
......@@ -210,7 +210,7 @@ function cCOLUMN() {
}
cCOLUMN.prototype = Object.create( cBaseFunction.prototype )
cCOLUMN.prototype = Object.create( cBaseFunction.prototype );
cCOLUMN.prototype.Calculate = function ( arg ) {
var arg0;
if ( this.argumentsCurrent == 0 ) {
......@@ -236,13 +236,13 @@ cCOLUMN.prototype.Calculate = function ( arg ) {
}
else
return this.value = new cError( cErrorType.bad_reference );
}
};
cCOLUMN.prototype.getInfo = function () {
return {
name:this.name,
args:"( [ reference ] )"
};
}
};
function cCOLUMNS() {
// cBaseFunction.call( this, "COLUMNS" );
......@@ -263,7 +263,7 @@ function cCOLUMNS() {
}
cCOLUMNS.prototype = Object.create( cBaseFunction.prototype )
cCOLUMNS.prototype = Object.create( cBaseFunction.prototype );
cCOLUMNS.prototype.Calculate = function ( arg ) {
var arg0 = arg[0];
if ( arg0 instanceof cArray ) {
......@@ -282,13 +282,13 @@ cCOLUMNS.prototype.Calculate = function ( arg ) {
}
else
return this.value = new cError( cErrorType.wrong_value_type );
}
};
cCOLUMNS.prototype.getInfo = function () {
return {
name:this.name,
args:"( array )"
};
}
};
function cGETPIVOTDATA() {
cBaseFunction.call( this, "GETPIVOTDATA" );
......@@ -317,7 +317,7 @@ function cHLOOKUP() {
}
cHLOOKUP.prototype = Object.create( cBaseFunction.prototype )
cHLOOKUP.prototype = Object.create( cBaseFunction.prototype );
cHLOOKUP.prototype.Calculate = function ( arg ) {
var arg0 = arg[0], arg1 = arg[1], arg2 = arg[2], arg3 = this.argumentsCurrent == 4 ? arg[3].tocBool() : new cBool( true );
var numberRow = arg2.getValue() - 1, valueForSearching = arg0.getValue(), resC = -1, min, regexp;
......@@ -354,7 +354,7 @@ cHLOOKUP.prototype.Calculate = function ( arg ) {
// range._foreachColNoEmpty( /*func for col*/ null, /*func for cell in col*/ f );
}
else if ( arg1 instanceof cArea3D ) {
var range = arg1.getRange()[0], ws = arg1.getWS()
var range = arg1.getRange()[0], ws = arg1.getWS();
bb = range.getBBox0();
if ( numberRow > bb.r2 - bb.r1 )
return this.value = new cError( cErrorType.bad_reference );
......@@ -393,7 +393,7 @@ cHLOOKUP.prototype.Calculate = function ( arg ) {
}
min = Math.min( min, elem.getValue() );
} )
} );
if ( min > valueForSearching ) {
return this.value = new cError( cErrorType.not_available );
......@@ -421,27 +421,28 @@ cHLOOKUP.prototype.Calculate = function ( arg ) {
var c = new CellAddress( bb.r1 + numberRow, resC, 0 );
var v = arg1.getWS()._getCellNoEmpty( c.getRow0(), c.getCol0() )
var v = arg1.getWS()._getCellNoEmpty( c.getRow0(), c.getCol0() );
if ( v )
v = v.getValueWithoutFormat();
else
v = "";
return this.value = checkTypeCell( v );
}
};
cHLOOKUP.prototype.getInfo = function () {
return {
name:this.name,
args:"( lookup-value , table-array , row-index-num [ , [ range-lookup-flag ] ] )"
};
}
};
function cHYPERLINK() {
cBaseFunction.call( this, "HYPERLINK" );
}
cHYPERLINK.prototype = Object.create( cBaseFunction.prototype )
cHYPERLINK.prototype = Object.create( cBaseFunction.prototype );
/** @constructor */
function cINDEX() {
// cBaseFunction.call( this, "INDEX" );
......@@ -485,7 +486,7 @@ cINDEX.prototype.Calculate = function ( arg ) {
}
if (arg0 instanceof cArray || arg0 instanceof cArea) {
res = arg0.getValue(arg1.getValue() - 1, arg2.getValue() - 1);
res = arg0.getValue2(arg1.getValue() - 1, arg2.getValue() - 1);
} else {
res = arg0.tryConvert();
}
......@@ -497,8 +498,9 @@ cINDEX.prototype.getInfo = function () {
name:this.name,
args:"( array , [ row-number ] [ , [ column-number ] ] ) " + this.name + "( reference , [ row-number ] [ , [ column-number ] [ , [ area-number ] ] ] )"
};
}
};
/** @constructor */
function cINDIRECT() {
// cBaseFunction.call( this, "INDIRECT" );
// this.setArgumentsMin( 1 );
......@@ -695,10 +697,8 @@ cLOOKUP.prototype.Calculate = function ( arg ) {
return this.value = new cError( cErrorType.not_available );
}
var c = new CellAddress( BBox.r1 + resR, BBox.c1 + resC )
var c = new CellAddress( BBox.r1 + resR, BBox.c1 + resC );
return this.value = checkTypeCell( _arg2.getWS()._getCellNoEmpty( c.getRow0(), c.getCol0() ).getValueWithoutFormat() );
}
else {
var arg1Range = arg1.getRange(), arg2Range = arg2.getRange();
......@@ -708,28 +708,25 @@ cLOOKUP.prototype.Calculate = function ( arg ) {
if ( arg1 instanceof cArea3D ) {
arg1Range = arg1.getMatrix()[0];
// arg1Range = arg1Range[0];
}
else if ( arg1 instanceof cArea ) {
arg1Range = arg1.getMatrix();
}
if ( arg2 instanceof cArea3D ) {
arg2Range = arg2.getMatrix()[0];
// arg2Range = arg2Range[0];
}
else if ( arg2 instanceof cArea ) {
arg2Range = arg2.getMatrix();
}
var index = _func.binarySearch( arg0, function () {
var a = []
var a = [];
for ( var i = 0; i < arg1Range.length; i++ ) {
a.push( arg1Range[i][0] )
}
return a;
}() )
}() );
if ( index < 0 ) return this.value = new cError( cErrorType.not_available );
......@@ -749,17 +746,14 @@ cLOOKUP.prototype.Calculate = function ( arg ) {
else
return this.value = new cRef( arg1.ws.getCell3( (b.r1 - 1) + index, (b.c1 - 1) + 0 ).getName(), arg1.ws );
}
return this.value = arg2.getValue()[index];
}
}
};
cLOOKUP.prototype.getInfo = function () {
return {
name:this.name,
args:"( lookup-value , lookup-vector , result-vector )"
};
}
};
function cMATCH() {
......@@ -778,7 +772,7 @@ function cMATCH() {
this.numFormat = this.formatType.def;
}
cMATCH.prototype = Object.create( cBaseFunction.prototype )
cMATCH.prototype = Object.create( cBaseFunction.prototype );
cMATCH.prototype.Calculate = function ( arg ) {
var arg0 = arg[0], arg1 = arg[1], arg2 = arg[2] ? arg[2] : new cNumber( 1 );
......@@ -882,13 +876,13 @@ cMATCH.prototype.Calculate = function ( arg ) {
return this.value = findMatch( arg0, arg1, arg2 )
}
};
cMATCH.prototype.getInfo = function () {
return {
name:this.name,
args:"( lookup-value , lookup-array [ , [ match-type ]] )"
};
}
};
function cOFFSET() {
// cBaseFunction.call( this, "OFFSET" );
......@@ -1049,7 +1043,7 @@ function cROW() {
}
cROW.prototype = Object.create( cBaseFunction.prototype )
cROW.prototype = Object.create( cBaseFunction.prototype );
cROW.prototype.Calculate = function ( arg ) {
var arg0;
if ( this.argumentsCurrent == 0 ) {
......@@ -1075,13 +1069,13 @@ cROW.prototype.Calculate = function ( arg ) {
}
else
return this.value = new cError( cErrorType.bad_reference );
}
};
cROW.prototype.getInfo = function () {
return {
name:this.name,
args:"( [ reference ] )"
};
}
};
function cROWS() {
// cBaseFunction.call( this, "ROWS" );
......@@ -1102,7 +1096,7 @@ function cROWS() {
}
cROWS.prototype = Object.create( cBaseFunction.prototype )
cROWS.prototype = Object.create( cBaseFunction.prototype );
cROWS.prototype.Calculate = function ( arg ) {
var arg0 = arg[0];
if ( arg0 instanceof cArray ) {
......@@ -1121,19 +1115,19 @@ cROWS.prototype.Calculate = function ( arg ) {
}
else
return this.value = new cError( cErrorType.wrong_value_type );
}
};
cROWS.prototype.getInfo = function () {
return {
name:this.name,
args:"( array )"
};
}
};
function cRTD() {
cBaseFunction.call( this, "RTD" );
}
cRTD.prototype = Object.create( cBaseFunction.prototype )
cRTD.prototype = Object.create( cBaseFunction.prototype );
function cTRANSPOSE() {
// cBaseFunction.call( this, "TRANSPOSE" );
......@@ -1152,7 +1146,7 @@ function cTRANSPOSE() {
}
cTRANSPOSE.prototype = Object.create( cBaseFunction.prototype )
cTRANSPOSE.prototype = Object.create( cBaseFunction.prototype );
cTRANSPOSE.prototype.Calculate = function ( arg ) {
function TransposeMatrix( A ) {
......@@ -1186,13 +1180,13 @@ cTRANSPOSE.prototype.Calculate = function ( arg ) {
return this.value = TransposeMatrix( arg0 );
}
};
cTRANSPOSE.prototype.getInfo = function () {
return {
name:this.name,
args:"( array )"
};
}
};
function VHLOOKUPCache( bHor ) {
this.cacheId = {};
......
......@@ -92,7 +92,7 @@ function cABS() {
}
cABS.prototype = Object.create( cBaseFunction.prototype )
cABS.prototype = Object.create( cBaseFunction.prototype );
cABS.prototype.Calculate = function ( arg ) {
var arg0 = arg[0];
if ( arg0 instanceof cArea || arg0 instanceof cArea3D ) {
......@@ -115,13 +115,13 @@ cABS.prototype.Calculate = function ( arg ) {
return this.value = new cNumber( Math.abs( arg0.getValue() ) );
}
return this.value = arg0;
}
};
cABS.prototype.getInfo = function () {
return {
name:this.name,
args:"( x )"
}
}
};
function cACOS() {
// cBaseFunction.call( this, "ACOS" );
......@@ -142,7 +142,7 @@ function cACOS() {
}
cACOS.prototype = Object.create( cBaseFunction.prototype )
cACOS.prototype = Object.create( cBaseFunction.prototype );
cACOS.prototype.Calculate = function ( arg ) {
var arg0 = arg[0];
if ( arg0 instanceof cArea || arg0 instanceof cArea3D ) {
......@@ -167,13 +167,13 @@ cACOS.prototype.Calculate = function ( arg ) {
return this.value = isNaN( a ) ? new cError( cErrorType.not_numeric ) : new cNumber( a );
}
return this.value = arg0;
}
};
cACOS.prototype.getInfo = function () {
return {
name:this.name,
args:"( x )"
};
}
};
function cACOSH() {
// cBaseFunction.call( this, "ACOSH" );
......
......@@ -503,46 +503,10 @@ cArea.prototype.getValue = function () {
}
return val;
};
cArea.prototype.getValue2 = function ( cell ) {
var val = [], r = this.getRange();
if ( !r ) {
val.push( new cError( cErrorType.bad_reference ) );
}
else {
r._foreachNoEmpty( function ( cellData ) {
if ( cell.getID() === cellData.getName() ) {
var cellType = cellData.getType();
switch(cellType){
case CellValueType.Number:
cellData.getValueWithoutFormat() === "" ? val.push( new cEmpty() ) : val.push( new cNumber( cellData.getValueWithoutFormat() ) );
break;
case CellValueType.Bool:
val.push( new cBool( cellData.getValueWithoutFormat() ) );
break;
case CellValueType.Error:
val.push( new cError( cellData.getValueWithoutFormat() ) );
break;
case CellValueType.String:
val.push( new cString( cellData.getValueWithoutFormat() ) );
break;
default:
if ( cellData.getValueWithoutFormat() && cellData.getValueWithoutFormat() !== "" ) {
val.push( new cNumber( cellData.getValueWithoutFormat() ) );
}
else {
val.push( checkTypeCell( "" + cellData.getValueWithoutFormat() ) );
}
}
}
} );
}
if ( val[0] === undefined || val[0] === null ) {
return new cEmpty();
}
else {
return val[0];
}
cArea.prototype.getValue2 = function (i, j) {
var r = this.getRange();
var cell = r.worksheet._getCellNoEmpty(r.bbox.r1 + i, r.bbox.c1 + j);
return this._parseCellValue(cell);
};
cArea.prototype.getRange = function () {
if( !this.range ){
......@@ -596,24 +560,18 @@ cArea.prototype.getBBox0 = function () {
};
cArea.prototype.cross = function ( arg ) {
var r = this.getRange(), cross;
if ( !r ) {
return new cError( cErrorType.wrong_name );
if (!r) {
return new cError(cErrorType.wrong_name);
}
cross = r.cross( arg );
if ( cross ) {
if ( cross.r != undefined ) {
return this.getValue2( new CellAddress( cross.r, this.getBBox().c1 ) );
}
else if ( cross.c != undefined ) {
return this.getValue2( new CellAddress( this.getBBox().r1, cross.c ) );
}
else {
return new cError( cErrorType.wrong_value_type );
cross = r.cross(arg);
if (cross) {
if (cross.r != undefined) {
return this.getValue2(cross.r - this.getBBox().r1, 0);
} else if (cross.c != undefined) {
return this.getValue2(0, cross.c - this.getBBox().c1);
}
}
else {
return new cError( cErrorType.wrong_value_type );
}
return new cError(cErrorType.wrong_value_type);
};
cArea.prototype.isValid = function () {
var r = this.getRange();
......@@ -662,17 +620,12 @@ cArea.prototype.foreach2 = function ( action ) {
});
}
};
cArea.prototype.getValue = function (i, j) {
var r = this.getRange();
var cell = r.worksheet._getCellNoEmpty(r.bbox.r1 + i, r.bbox.c1 + j);
return this._parseCellValue(cell);
};
cArea.prototype.getMatrix = function () {
var t = this, arr = [], r = this.getRange();
r._foreach2( function ( cell, i, j, r1, c1 ) {
if (!arr[i - r1])
arr[i - r1] = [];
arr[i - r1][j - c1] = t._parseCellValue();
arr[i - r1][j - c1] = t._parseCellValue(cell);
} );
return arr;
};
......@@ -1401,7 +1354,7 @@ cArray.prototype.isValidArray = function () {
}
return true;
};
cArray.prototype.getValue = function (i, j) {
cArray.prototype.getValue2 = function (i, j) {
var result = this.array[i];
return result ? result[j] : result;
};
......@@ -1417,6 +1370,7 @@ cArray.prototype.fillFromArray = function ( arr ) {
}
};
/** @constructor */
function cUndefined(){this.value = undefined;}
cUndefined.prototype = Object.create( cBaseType.prototype );
......@@ -1603,6 +1557,7 @@ cBaseFunction.prototype = {
}
};
/** @constructor */
function parentLeft() {
this.name = "(";
this.type = cElementType.operator;
......@@ -1629,6 +1584,7 @@ parentLeft.prototype.Assemble2 = function ( arg, start, count ) {
return new cString( "(" + arg[start + count - 1] + ")" );
};
/** @constructor */
function parentRight() {
this.name = ")";
this.type = cElementType.operator;
......@@ -1639,6 +1595,7 @@ parentRight.prototype.toString = function () {
return this.name;
};
/** @constructor */
function cUnarMinusOperator() {
cBaseOperator.apply( this, ['un_minus'/**name operator*/, 50/**priority of operator*/, 1/**count arguments*/] );
this.isRightAssociative = true;
......@@ -1672,6 +1629,7 @@ cUnarMinusOperator.prototype.Assemble2 = function ( arg, start, count ) {
return new cString( "-" + arg[start + count - 1] );
};
/** @constructor */
function cUnarPlusOperator() {
cBaseOperator.apply( this, ['un_plus', 50, 1] );
this.isRightAssociative = true;
......@@ -1696,6 +1654,7 @@ cUnarPlusOperator.prototype.Assemble2 = function ( arg, start, count ) {
return new cString( "+" + arg[start + count - 1] );
};
/** @constructor */
function cAddOperator() {
cBaseOperator.apply( this, ['+', 20] );
}
......@@ -1715,6 +1674,7 @@ cAddOperator.prototype.Calculate = function ( arg ) {
return this.value = _func[arg0.type][arg1.type]( arg0, arg1, "+", arguments[1].first );
};
/** @constructor */
function cMinusOperator() {
cBaseOperator.apply( this, ['-', 20] );
}
......@@ -1733,6 +1693,7 @@ cMinusOperator.prototype.Calculate = function ( arg ) {
return this.value = _func[arg0.type][arg1.type]( arg0, arg1, "-", arguments[1].first );
};
/** @constructor */
function cPercentOperator() {
cBaseOperator.apply( this, ['%', 45, 1] );
this.isRightAssociative = true;
......@@ -1765,6 +1726,7 @@ cPercentOperator.prototype.Assemble2 = function ( arg, start, count ) {
return new cString( arg[start + count - 1] + this.name );
};
/** @constructor */
function cPowOperator() {
cBaseOperator.apply( this, ['^', 40] );
}
......@@ -1797,6 +1759,7 @@ cPowOperator.prototype.Calculate = function ( arg ) {
return this.value = new cNumber( _v );
};
/** @constructor */
function cMultOperator() {
cBaseOperator.apply( this, ['*', 30] );
}
......@@ -1815,6 +1778,7 @@ cMultOperator.prototype.Calculate = function ( arg ) {
return this.value = _func[arg0.type][arg1.type]( arg0, arg1, "*", arguments[1].first );
};
/** @constructor */
function cDivOperator() {
cBaseOperator.apply( this, ['/', 30] );
}
......@@ -1833,6 +1797,7 @@ cDivOperator.prototype.Calculate = function ( arg ) {
return this.value = _func[arg0.type][arg1.type]( arg0, arg1, "/", arguments[1].first );
};
/** @constructor */
function cConcatSTROperator() {
cBaseOperator.apply( this, ['&', 15] );
}
......@@ -1854,6 +1819,7 @@ cConcatSTROperator.prototype.Calculate = function ( arg ) {
new cString( arg0.toString().concat( arg1.toString() ) );
};
/** @constructor */
function cEqualsOperator() {
cBaseOperator.apply( this, ['=', 10] );
}
......@@ -1872,6 +1838,7 @@ cEqualsOperator.prototype.Calculate = function ( arg ) {
return this.value = _func[arg0.type][arg1.type]( arg0, arg1, "=", arguments[1].first );
};
/** @constructor */
function cNotEqualsOperator() {
cBaseOperator.apply( this, ['<>', 10] );
}
......@@ -1890,6 +1857,7 @@ cNotEqualsOperator.prototype.Calculate = function ( arg ) {
return this.value = _func[arg0.type][arg1.type]( arg0, arg1, "<>", arguments[1].first );
};
/** @constructor */
function cLessOperator() {
cBaseOperator.apply( this, ['<', 10] );
}
......@@ -1908,6 +1876,7 @@ cLessOperator.prototype.Calculate = function ( arg ) {
return this.value = _func[arg0.type][arg1.type]( arg0, arg1, "<", arguments[1].first );
};
/** @constructor */
function cLessOrEqualOperator() {
cBaseOperator.apply( this, ['<=', 10] );
}
......@@ -1926,6 +1895,7 @@ cLessOrEqualOperator.prototype.Calculate = function ( arg ) {
return this.value = _func[arg0.type][arg1.type]( arg0, arg1, "<=", arguments[1].first );
};
/** @constructor */
function cGreaterOperator() {
cBaseOperator.apply( this, ['>', 10] );
}
......@@ -1944,6 +1914,7 @@ cGreaterOperator.prototype.Calculate = function ( arg ) {
return this.value = _func[arg0.type][arg1.type]( arg0, arg1, ">", arguments[1].first );
};
/** @constructor */
function cGreaterOrEqualOperator() {
cBaseOperator.apply( this, ['>=', 10] );
}
......
......@@ -4015,12 +4015,14 @@ cQUARTILE.prototype.getInfo = function () {
};
};
/** @constructor */
function cRANK() {
cBaseFunction.call( this, "RANK" );
}
cRANK.prototype = Object.create( cBaseFunction.prototype )
cRANK.prototype = Object.create( cBaseFunction.prototype );
/** @constructor */
function cRSQ() {
// cBaseFunction.call( this, "RSQ" );
// this.setArgumentsMin( 2 );
......@@ -4040,7 +4042,7 @@ function cRSQ() {
}
cRSQ.prototype = Object.create( cBaseFunction.prototype )
cRSQ.prototype = Object.create( cBaseFunction.prototype );
cRSQ.prototype.Calculate = function ( arg ) {
function rsq( x, y ) {
......@@ -4093,7 +4095,7 @@ cRSQ.prototype.Calculate = function ( arg ) {
} );
}
else
return this.value = cError( cErrorType.wrong_value_type )
return this.value = cError( cErrorType.wrong_value_type );
if ( arg1 instanceof cArea ) {
arr1 = arg1.getValue();
......@@ -4104,18 +4106,19 @@ cRSQ.prototype.Calculate = function ( arg ) {
} );
}
else
return this.value = cError( cErrorType.wrong_value_type )
return this.value = cError( cErrorType.wrong_value_type );
return this.value = rsq( arr0, arr1 );
}
};
cRSQ.prototype.getInfo = function () {
return {
name:this.name,
args:"( array-1 , array-2 )"
};
}
};
/** @constructor */
function cSKEW() {
// cBaseFunction.call( this, "SKEW" );
// this.setArgumentsMin( 1 );
......@@ -4135,7 +4138,7 @@ function cSKEW() {
}
cSKEW.prototype = Object.create( cBaseFunction.prototype )
cSKEW.prototype = Object.create( cBaseFunction.prototype );
cSKEW.prototype.Calculate = function ( arg ) {
function skew( x ) {
......@@ -4151,7 +4154,7 @@ cSKEW.prototype.Calculate = function ( arg ) {
}
if ( xLength <= 2 )
return new cError( cErrorType.not_available )
return new cError( cErrorType.not_available );
_x /= xLength;
......@@ -4209,15 +4212,15 @@ cSKEW.prototype.Calculate = function ( arg ) {
}
return this.value = skew( arr0 );
}
};
cSKEW.prototype.getInfo = function () {
return {
name:this.name,
args:"( argument-list )"
};
}
};
/** @constructor */
function cSLOPE() {
// cBaseFunction.call( this, "SLOPE" );
// this.setArgumentsMin( 2 );
......@@ -4237,7 +4240,7 @@ function cSLOPE() {
}
cSLOPE.prototype = Object.create( cBaseFunction.prototype )
cSLOPE.prototype = Object.create( cBaseFunction.prototype );
cSLOPE.prototype.Calculate = function ( arg ) {
function slope( y, x ) {
......@@ -4304,14 +4307,15 @@ cSLOPE.prototype.Calculate = function ( arg ) {
return this.value = slope( arr0, arr1 );
}
};
cSLOPE.prototype.getInfo = function () {
return {
name:this.name,
args:"( array-1 , array-2 )"
};
}
};
/** @constructor */
function cSMALL() {
// cBaseFunction.call( this, "SMALL" );
// this.setArgumentsMin( 2 );
......@@ -4332,7 +4336,7 @@ function cSMALL() {
}
cSMALL.prototype = Object.create( cBaseFunction.prototype )
cSMALL.prototype = Object.create( cBaseFunction.prototype );
cSMALL.prototype.Calculate = function ( arg ) {
function frequency( A, k ) {
......@@ -4391,7 +4395,7 @@ cSMALL.prototype.getInfo = function () {
name:this.name,
args:"( array , k )"
};
}
};
function cSTANDARDIZE() {
// cBaseFunction.call( this, "STANDARDIZE" );
......@@ -4412,7 +4416,7 @@ function cSTANDARDIZE() {
}
cSTANDARDIZE.prototype = Object.create( cBaseFunction.prototype )
cSTANDARDIZE.prototype = Object.create( cBaseFunction.prototype );
cSTANDARDIZE.prototype.Calculate = function ( arg ) {
var arg0 = arg[0], arg1 = arg[1], arg2 = arg[2];
......@@ -4454,13 +4458,13 @@ cSTANDARDIZE.prototype.Calculate = function ( arg ) {
if ( arg2 instanceof cError ) return this.value = arg2;
return this.value = standardize( arg0.getValue(), arg1.getValue(), arg2.getValue() );
}
};
cSTANDARDIZE.prototype.getInfo = function () {
return {
name:this.name,
args:"( x , mean , standard-deviation )"
};
}
};
function cSTDEV() {
// cBaseFunction.call( this, "STDEV" );
......@@ -4482,7 +4486,7 @@ function cSTDEV() {
}
cSTDEV.prototype = Object.create( cBaseFunction.prototype )
cSTDEV.prototype = Object.create( cBaseFunction.prototype );
cSTDEV.prototype.Calculate = function ( arg ) {
var count = 0, sum = new cNumber( 0 ), member = [];
for ( var i = 0; i < arg.length; i++ ) {
......@@ -4537,7 +4541,7 @@ cSTDEV.prototype.getInfo = function () {
name:this.name,
args:"( argument-list )"
};
}
};
function cSTDEVA() {
// cBaseFunction.call( this, "STDEVA" );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment