Commit b2b8cad1 authored by GoshaZotov's avatar GoshaZotov

move name function into prototype

formatted functions
parent f5868984
......@@ -66,118 +66,138 @@
* @extends {AscCommonExcel.cBaseFunction}
*/
function cDBCS() {
cBaseFunction.call(this, "DBCS");
this.isXLFN = true;
this.value = null;
this.argumentsCurrent = 0;
}
cDBCS.prototype = Object.create(cBaseFunction.prototype);
cDBCS.prototype.constructor = cDBCS;
cDBCS.prototype.name = "DBCS";
cDBCS.prototype.isXLFN = true;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cFILTERXML() {
cBaseFunction.call(this, "FILTERXML");
this.isXLFN = true;
this.value = null;
this.argumentsCurrent = 0;
}
cFILTERXML.prototype = Object.create(cBaseFunction.prototype);
cFILTERXML.prototype.constructor = cFILTERXML;
cFILTERXML.prototype.name = "FILTERXML";
cFILTERXML.prototype.isXLFN = true;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cFORECAST_ETS() {
cBaseFunction.call(this, "FORECAST.ETS");
this.isXLFN = true;
this.value = null;
this.argumentsCurrent = 0;
}
cFORECAST_ETS.prototype = Object.create(cBaseFunction.prototype);
cFORECAST_ETS.prototype.constructor = cFORECAST_ETS;
cFORECAST_ETS.prototype.name = "FORECAST.ETS";
cFORECAST_ETS.prototype.isXLFN = true;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cFORECAST_ETS_CONFINT() {
cBaseFunction.call(this, "FORECAST.ETS.CONFINT");
this.isXLFN = true;
this.value = null;
this.argumentsCurrent = 0;
}
cFORECAST_ETS_CONFINT.prototype = Object.create(cBaseFunction.prototype);
cFORECAST_ETS_CONFINT.prototype.constructor = cFORECAST_ETS_CONFINT;
cFORECAST_ETS_CONFINT.prototype.name = "FORECAST.ETS.CONFINT";
cFORECAST_ETS_CONFINT.prototype.isXLFN = true;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cFORECAST_ETS_SEASONALITY() {
cBaseFunction.call(this, "FORECAST.ETS.SEASONALITY");
this.isXLFN = true;
this.value = null;
this.argumentsCurrent = 0;
}
cFORECAST_ETS_SEASONALITY.prototype = Object.create(cBaseFunction.prototype);
cFORECAST_ETS_SEASONALITY.prototype.constructor = cFORECAST_ETS_SEASONALITY;
cFORECAST_ETS_SEASONALITY.prototype.name = "FORECAST.ETS.SEASONALITY";
cFORECAST_ETS_SEASONALITY.prototype.isXLFN = true;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cFORECAST_ETS_STAT() {
cBaseFunction.call(this, "FORECAST.ETS.STAT");
this.isXLFN = true;
this.value = null;
this.argumentsCurrent = 0;
}
cFORECAST_ETS_STAT.prototype = Object.create(cBaseFunction.prototype);
cFORECAST_ETS_STAT.prototype.constructor = cFORECAST_ETS_STAT;
cFORECAST_ETS_STAT.prototype.name = "FORECAST.ETS.STAT";
cFORECAST_ETS_STAT.prototype.isXLFN = true;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cHYPGEOM_DIST() {
cBaseFunction.call(this, "HYPGEOM.DIST");
this.isXLFN = true;
this.value = null;
this.argumentsCurrent = 0;
}
cHYPGEOM_DIST.prototype = Object.create(cBaseFunction.prototype);
cHYPGEOM_DIST.prototype.constructor = cHYPGEOM_DIST;
cHYPGEOM_DIST.prototype.name = "HYPGEOM.DIST";
cHYPGEOM_DIST.prototype.isXLFN = true;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cMUNIT() {
cBaseFunction.call(this, "MUNIT");
this.isXLFN = true;
this.value = null;
this.argumentsCurrent = 0;
}
cMUNIT.prototype = Object.create(cBaseFunction.prototype);
cMUNIT.prototype.constructor = cMUNIT;
cMUNIT.prototype.name = "MUNIT";
cMUNIT.prototype.isXLFN = true;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cQUERYSTRING() {
cBaseFunction.call(this, "QUERYSTRING");
this.isXLFN = true;
this.value = null;
this.argumentsCurrent = 0;
}
cQUERYSTRING.prototype = Object.create(cBaseFunction.prototype);
cQUERYSTRING.prototype.constructor = cQUERYSTRING;
cQUERYSTRING.prototype.name = "QUERYSTRING";
cQUERYSTRING.prototype.isXLFN = true;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cWEBSERVICE() {
cBaseFunction.call(this, "WEBSERVICE");
this.isXLFN = true;
this.value = null;
this.argumentsCurrent = 0;
}
cWEBSERVICE.prototype = Object.create(cBaseFunction.prototype);
cWEBSERVICE.prototype.constructor = cWEBSERVICE;
cWEBSERVICE.prototype.name = "WEBSERVICE";
cWEBSERVICE.prototype.isXLFN = true;
})(window);
......@@ -53,89 +53,89 @@
* @extends {AscCommonExcel.cBaseFunction}
*/
function cCUBEKPIMEMBER() {
this.name = "CUBEKPIMEMBER";
this.value = null;
this.argumentsCurrent = 0;
}
cCUBEKPIMEMBER.prototype = Object.create(cBaseFunction.prototype);
cCUBEKPIMEMBER.prototype.constructor = cCUBEKPIMEMBER;
cCUBEKPIMEMBER.prototype.name = 'CUBEKPIMEMBER';
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cCUBEMEMBER() {
this.name = "CUBEMEMBER";
this.value = null;
this.argumentsCurrent = 0;
}
cCUBEMEMBER.prototype = Object.create(cBaseFunction.prototype);
cCUBEMEMBER.prototype.constructor = cCUBEMEMBER;
cCUBEMEMBER.prototype.name = 'CUBEMEMBER';
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cCUBEMEMBERPROPERTY() {
this.name = "CUBEMEMBERPROPERTY";
this.value = null;
this.argumentsCurrent = 0;
}
cCUBEMEMBERPROPERTY.prototype = Object.create(cBaseFunction.prototype);
cCUBEMEMBERPROPERTY.prototype.constructor = cCUBEMEMBERPROPERTY;
cCUBEMEMBERPROPERTY.prototype.name = 'CUBEMEMBERPROPERTY';
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cCUBERANKEDMEMBER() {
this.name = "CUBERANKEDMEMBER";
this.value = null;
this.argumentsCurrent = 0;
}
cCUBERANKEDMEMBER.prototype = Object.create(cBaseFunction.prototype);
cCUBERANKEDMEMBER.prototype.constructor = cCUBERANKEDMEMBER;
cCUBERANKEDMEMBER.prototype.name = 'CUBERANKEDMEMBER';
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cCUBESET() {
this.name = "CUBESET";
this.value = null;
this.argumentsCurrent = 0;
}
cCUBESET.prototype = Object.create(cBaseFunction.prototype);
cCUBESET.prototype.constructor = cCUBESET;
cCUBESET.prototype.name = 'CUBESET';
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cCUBESETCOUNT() {
this.name = "CUBESETCOUNT";
this.value = null;
this.argumentsCurrent = 0;
}
cCUBESETCOUNT.prototype = Object.create(cBaseFunction.prototype);
cCUBESETCOUNT.prototype.constructor = cCUBESETCOUNT;
cCUBESETCOUNT.prototype.name = 'CUBESETCOUNT';
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cCUBEVALUE() {
this.name = "CUBEVALUE";
this.value = null;
this.argumentsCurrent = 0;
}
cCUBEVALUE.prototype = Object.create(cBaseFunction.prototype);
cCUBEVALUE.prototype.constructor = cCUBEVALUE;
cCUBEVALUE.prototype.name = 'CUBEVALUE';
})(window);
......@@ -207,11 +207,13 @@
* @extends {AscCommonExcel.cBaseFunction}
*/
function cDAVERAGE() {
cBaseFunction.call(this, "DAVERAGE");
this.value = null;
this.argumentsCurrent = 0;
}
cDAVERAGE.prototype = Object.create(cBaseFunction.prototype);
cDAVERAGE.prototype.constructor = cDAVERAGE;
cDAVERAGE.prototype.name = "DAVERAGE";
cDAVERAGE.prototype.argumentsMin = 3;
cDAVERAGE.prototype.argumentsMax = 3;
cDAVERAGE.prototype.Calculate = function (arg) {
......@@ -259,11 +261,13 @@
* @extends {AscCommonExcel.cBaseFunction}
*/
function cDCOUNT() {
cBaseFunction.call(this, "DCOUNT");
this.value = null;
this.argumentsCurrent = 0;
}
cDCOUNT.prototype = Object.create(cBaseFunction.prototype);
cDCOUNT.prototype.constructor = cDCOUNT;
cDCOUNT.prototype.name = "DCOUNT";
cDCOUNT.prototype.argumentsMin = 3;
cDCOUNT.prototype.argumentsMax = 3;
cDCOUNT.prototype.Calculate = function (arg) {
......@@ -300,11 +304,13 @@
* @extends {AscCommonExcel.cBaseFunction}
*/
function cDCOUNTA() {
cBaseFunction.call(this, "DCOUNTA");
this.value = null;
this.argumentsCurrent = 0;
}
cDCOUNTA.prototype = Object.create(cBaseFunction.prototype);
cDCOUNTA.prototype.constructor = cDCOUNTA;
cDCOUNTA.prototype.name = "DCOUNTA";
cDCOUNTA.prototype.argumentsMin = 3;
cDCOUNTA.prototype.argumentsMax = 3;
cDCOUNTA.prototype.Calculate = function (arg) {
......@@ -339,11 +345,13 @@
* @extends {AscCommonExcel.cBaseFunction}
*/
function cDGET() {
cBaseFunction.call(this, "DGET");
this.value = null;
this.argumentsCurrent = 0;
}
cDGET.prototype = Object.create(cBaseFunction.prototype);
cDGET.prototype.constructor = cDGET;
cDGET.prototype.name = "DGET";
cDGET.prototype.argumentsMin = 3;
cDGET.prototype.argumentsMax = 3;
cDGET.prototype.Calculate = function (arg) {
......@@ -379,11 +387,13 @@
* @extends {AscCommonExcel.cBaseFunction}
*/
function cDMAX() {
cBaseFunction.call(this, "DMAX");
this.value = null;
this.argumentsCurrent = 0;
}
cDMAX.prototype = Object.create(cBaseFunction.prototype);
cDMAX.prototype.constructor = cDMAX;
cDMAX.prototype.name = "DMAX";
cDMAX.prototype.argumentsMin = 3;
cDMAX.prototype.argumentsMax = 3;
cDMAX.prototype.Calculate = function (arg) {
......@@ -420,11 +430,13 @@
* @extends {AscCommonExcel.cBaseFunction}
*/
function cDMIN() {
cBaseFunction.call(this, "DMIN");
this.value = null;
this.argumentsCurrent = 0;
}
cDMIN.prototype = Object.create(cBaseFunction.prototype);
cDMIN.prototype.constructor = cDMIN;
cDMIN.prototype.name = "DMIN";
cDMIN.prototype.argumentsMin = 3;
cDMIN.prototype.argumentsMax = 3;
cDMIN.prototype.Calculate = function (arg) {
......@@ -462,11 +474,13 @@
* @extends {AscCommonExcel.cBaseFunction}
*/
function cDPRODUCT() {
cBaseFunction.call(this, "DPRODUCT");
this.value = null;
this.argumentsCurrent = 0;
}
cDPRODUCT.prototype = Object.create(cBaseFunction.prototype);
cDPRODUCT.prototype.constructor = cDPRODUCT;
cDPRODUCT.prototype.name = "DPRODUCT";
cDPRODUCT.prototype.argumentsMin = 3;
cDPRODUCT.prototype.argumentsMax = 3;
cDPRODUCT.prototype.Calculate = function (arg) {
......@@ -511,11 +525,13 @@
* @extends {AscCommonExcel.cBaseFunction}
*/
function cDSTDEV() {
cBaseFunction.call(this, "DSTDEV");
this.value = null;
this.argumentsCurrent = 0;
}
cDSTDEV.prototype = Object.create(cBaseFunction.prototype);
cDSTDEV.prototype.constructor = cDSTDEV;
cDSTDEV.prototype.name = "DSTDEV";
cDSTDEV.prototype.argumentsMin = 3;
cDSTDEV.prototype.argumentsMax = 3;
cDSTDEV.prototype.Calculate = function (arg) {
......@@ -568,11 +584,13 @@
* @extends {AscCommonExcel.cBaseFunction}
*/
function cDSTDEVP() {
cBaseFunction.call(this, "DSTDEVP");
this.value = null;
this.argumentsCurrent = 0;
}
cDSTDEVP.prototype = Object.create(cBaseFunction.prototype);
cDSTDEVP.prototype.constructor = cDSTDEVP;
cDSTDEVP.prototype.name = "DSTDEVP";
cDSTDEVP.prototype.argumentsMin = 3;
cDSTDEVP.prototype.argumentsMax = 3;
cDSTDEVP.prototype.Calculate = function (arg) {
......@@ -626,11 +644,13 @@
* @extends {AscCommonExcel.cBaseFunction}
*/
function cDSUM() {
cBaseFunction.call(this, "DSUM");
this.value = null;
this.argumentsCurrent = 0;
}
cDSUM.prototype = Object.create(cBaseFunction.prototype);
cDSUM.prototype.constructor = cDSUM;
cDSUM.prototype.name = "DSUM";
cDSUM.prototype.argumentsMin = 3;
cDSUM.prototype.argumentsMax = 3;
cDSUM.prototype.Calculate = function (arg) {
......@@ -671,11 +691,13 @@
* @extends {AscCommonExcel.cBaseFunction}
*/
function cDVAR() {
cBaseFunction.call(this, "DVAR");
this.value = null;
this.argumentsCurrent = 0;
}
cDVAR.prototype = Object.create(cBaseFunction.prototype);
cDVAR.prototype.constructor = cDVAR;
cDVAR.prototype.name = "DVAR";
cDVAR.prototype.argumentsMin = 3;
cDVAR.prototype.argumentsMax = 3;
cDVAR.prototype.Calculate = function (arg) {
......@@ -735,11 +757,13 @@
* @extends {AscCommonExcel.cBaseFunction}
*/
function cDVARP() {
cBaseFunction.call(this, "DVARP");
this.value = null;
this.argumentsCurrent = 0;
}
cDVARP.prototype = Object.create(cBaseFunction.prototype);
cDVARP.prototype.constructor = cDVARP;
cDVARP.prototype.name = "DVARP";
cDVARP.prototype.argumentsMin = 3;
cDVARP.prototype.argumentsMax = 3;
cDVARP.prototype.Calculate = function (arg) {
......
......@@ -58,13 +58,13 @@
* @extends {AscCommonExcel.cBaseFunction}
*/
function cAND() {
this.name = "AND";
this.value = null;
this.argumentsCurrent = 0;
}
cAND.prototype = Object.create(cBaseFunction.prototype);
cAND.prototype.constructor = cAND;
cAND.prototype.name = 'AND';
cAND.prototype.argumentsMin = 1;
cAND.prototype.Calculate = function (arg) {
var argResult = null;
......@@ -131,13 +131,13 @@
* @extends {AscCommonExcel.cBaseFunction}
*/
function cFALSE() {
this.name = "FALSE";
this.value = null;
this.argumentsCurrent = 0;
}
cFALSE.prototype = Object.create(cBaseFunction.prototype);
cFALSE.prototype.constructor = cFALSE;
cFALSE.prototype.name = 'FALSE';
cFALSE.prototype.argumentsMax = 0;
cFALSE.prototype.Calculate = function () {
return this.value = new cBool(false);
......@@ -148,13 +148,13 @@
* @extends {AscCommonExcel.cBaseFunction}
*/
function cIF() {
this.name = "IF";
this.value = null;
this.argumentsCurrent = 0;
}
cIF.prototype = Object.create(cBaseFunction.prototype);
cIF.prototype.constructor = cIF;
cIF.prototype.name = 'IF';
cIF.prototype.argumentsMin = 1;
cIF.prototype.argumentsMax = 3;
cIF.prototype.numFormat = AscCommonExcel.cNumFormatNone;
......@@ -188,13 +188,13 @@
* @extends {AscCommonExcel.cBaseFunction}
*/
function cIFERROR() {
this.name = "IFERROR";
this.value = null;
this.argumentsCurrent = 0;
}
cIFERROR.prototype = Object.create(cBaseFunction.prototype);
cIFERROR.prototype.constructor = cIFERROR;
cIFERROR.prototype.name = 'IFERROR';
cIFERROR.prototype.argumentsMin = 2;
cIFERROR.prototype.argumentsMax = 2;
cIFERROR.prototype.Calculate = function (arg) {
......@@ -221,13 +221,13 @@
* @extends {AscCommonExcel.cBaseFunction}
*/
function cIFNA() {
this.name = "IFNA";
this.value = null;
this.argumentsCurrent = 0;
}
cIFNA.prototype = Object.create(cBaseFunction.prototype);
cIFNA.prototype.constructor = cIFNA;
cIFNA.prototype.name = 'IFNA';
cIFNA.prototype.argumentsMin = 2;
cIFNA.prototype.argumentsMax = 2;
cIFNA.prototype.isXLFN = true;
......@@ -255,13 +255,13 @@
* @extends {AscCommonExcel.cBaseFunction}
*/
function cIFS() {
this.name = "IFS";
this.value = null;
this.argumentsCurrent = 0;
}
cIFS.prototype = Object.create(cBaseFunction.prototype);
cIFS.prototype.constructor = cIFS;
cIFS.prototype.name = 'IFS';
cIFS.prototype.argumentsMin = 2;
cIFS.prototype.Calculate = function (arg) {
var oArguments = this._prepareArguments(arg, arguments[1], true);
......@@ -273,31 +273,31 @@
}
var res = null;
for(var i = 0; i < this.argumentsCurrent; i++){
for (var i = 0; i < this.argumentsCurrent; i++) {
var argN = argClone[i];
if(cElementType.string === argN.type){
if (cElementType.string === argN.type) {
res = new cError(cErrorType.wrong_value_type);
break;
} else if(cElementType.number === argN.type || cElementType.bool === argN.type){
if(!argClone[i + 1]){
} else if (cElementType.number === argN.type || cElementType.bool === argN.type) {
if (!argClone[i + 1]) {
res = new cError(cErrorType.not_available);
break;
}
argN = argN.tocBool();
if(true === argN.value){
if (true === argN.value) {
res = argClone[i + 1];
break;
}
}
if(i === this.argumentsCurrent - 1){
if (i === this.argumentsCurrent - 1) {
res = new cError(cErrorType.not_available);
break;
}
i++;
}
if(null === res){
if (null === res) {
return this.value = new cError(cErrorType.not_available);
}
......@@ -309,13 +309,13 @@
* @extends {AscCommonExcel.cBaseFunction}
*/
function cNOT() {
this.name = "NOT";
this.value = null;
this.argumentsCurrent = 0;
}
cNOT.prototype = Object.create(cBaseFunction.prototype);
cNOT.prototype.constructor = cNOT;
cNOT.prototype.name = 'NOT';
cNOT.prototype.argumentsMin = 1;
cNOT.prototype.argumentsMax = 1;
cNOT.prototype.Calculate = function (arg) {
......@@ -347,13 +347,13 @@
* @extends {AscCommonExcel.cBaseFunction}
*/
function cOR() {
this.name = "OR";
this.value = null;
this.argumentsCurrent = 0;
}
cOR.prototype = Object.create(cBaseFunction.prototype);
cOR.prototype.constructor = cOR;
cOR.prototype.name = 'OR';
cOR.prototype.argumentsMin = 1;
cOR.prototype.Calculate = function (arg) {
var argResult = null;
......@@ -417,13 +417,13 @@
* @extends {AscCommonExcel.cBaseFunction}
*/
function cSWITCH() {
this.name = "SWITCH";
this.value = null;
this.argumentsCurrent = 0;
}
cSWITCH.prototype = Object.create(cBaseFunction.prototype);
cSWITCH.prototype.constructor = cSWITCH;
cSWITCH.prototype.name = 'SWITCH';
cSWITCH.prototype.argumentsMin = 3;
cSWITCH.prototype.argumentsMax = 126;
cSWITCH.prototype.isXLFN = true;
......@@ -437,28 +437,28 @@
}
var arg0 = argClone[0].getValue();
if(cElementType.cell === argClone[0].type || cElementType.cell3D === argClone[0].type){
if (cElementType.cell === argClone[0].type || cElementType.cell3D === argClone[0].type) {
arg0 = arg0.getValue()
}
var res = null;
for(var i = 1; i < this.argumentsCurrent; i++){
for (var i = 1; i < this.argumentsCurrent; i++) {
var argN = argClone[i].getValue();
if(arg0 === argN){
if(!argClone[i + 1]){
if (arg0 === argN) {
if (!argClone[i + 1]) {
return this.value = cErrorType.not_available;
}else{
} else {
res = argClone[i + 1];
break;
}
}
if(i === this.argumentsCurrent - 1){
if (i === this.argumentsCurrent - 1) {
res = argClone[i];
}
i++;
}
if(null === res){
if (null === res) {
return this.value = new cError(cErrorType.not_available);
}
......@@ -470,13 +470,13 @@
* @extends {AscCommonExcel.cBaseFunction}
*/
function cTRUE() {
this.name = "TRUE";
this.value = null;
this.argumentsCurrent = 0;
}
cTRUE.prototype = Object.create(cBaseFunction.prototype);
cTRUE.prototype.constructor = cTRUE;
cTRUE.prototype.name = 'TRUE';
cTRUE.prototype.argumentsMax = 0;
cTRUE.prototype.Calculate = function () {
return this.value = new cBool(true);
......@@ -487,13 +487,13 @@
* @extends {AscCommonExcel.cBaseFunction}
*/
function cXOR() {
this.name = "XOR";
this.value = null;
this.argumentsCurrent = 0;
}
cXOR.prototype = Object.create(cBaseFunction.prototype);
cXOR.prototype.constructor = cXOR;
cXOR.prototype.name = 'XOR';
cXOR.prototype.argumentsMin = 1;
cXOR.prototype.argumentsMax = 254;
cXOR.prototype.isXLFN = true;
......@@ -556,10 +556,10 @@
}
if (argResult == null) {
return this.value = new cError(cErrorType.wrong_value_type);
}else{
if(nTrueValues % 2){
} else {
if (nTrueValues % 2) {
argResult = new cBool(true);
}else{
} else {
argResult = new cBool(false);
}
}
......
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