Commit d71c9bcb authored by Dmitry.Shahtanov's avatar Dmitry.Shahtanov Committed by Alexander.Trofimov

функции на прототипах

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@53848 954022d7-b5bf-4e40-9824-e11837661b57
parent 15695f4d
......@@ -7,32 +7,46 @@
*/
cFormulaFunction.Cube = {
'groupName':"Cube",
'CUBEKPIMEMBER':function () {
var r = new cBaseFunction( "CUBEKPIMEMBER" );
return r;
},
'CUBEMEMBER':function () {
var r = new cBaseFunction( "CUBEMEMBER" );
return r;
},
'CUBEMEMBERPROPERTY':function () {
var r = new cBaseFunction( "CUBEMEMBERPROPERTY" );
return r;
},
'CUBERANKEDMEMBER':function () {
var r = new cBaseFunction( "CUBERANKEDMEMBER" );
return r;
},
'CUBESET':function () {
var r = new cBaseFunction( "CUBESET" );
return r;
},
'CUBESETCOUNT':function () {
var r = new cBaseFunction( "CUBESETCOUNT" );
return r;
},
'CUBEVALUE':function () {
var r = new cBaseFunction( "CUBEVALUE" );
return r;
}
'CUBEKPIMEMBER':cCUBEKPIMEMBER,
'CUBEMEMBER':cCUBEMEMBER,
'CUBEMEMBERPROPERTY':cCUBEMEMBERPROPERTY,
'CUBERANKEDMEMBER':cCUBERANKEDMEMBER,
'CUBESET':cCUBESET,
'CUBESETCOUNT':cCUBESETCOUNT,
'CUBEVALUE':cCUBEVALUE
}
function cCUBEKPIMEMBER() {
cBaseFunction.call( this, "CUBEKPIMEMBER" );
}
cCUBEKPIMEMBER.prototype = Object.create( cBaseFunction.prototype )
function cCUBEMEMBER() {
cBaseFunction.call( this, "CUBEMEMBER" );
}
cCUBEMEMBER.prototype = Object.create( cBaseFunction.prototype )
function cCUBEMEMBERPROPERTY() {
cBaseFunction.call( this, "CUBEMEMBERPROPERTY" );
}
cCUBEMEMBERPROPERTY.prototype = Object.create( cBaseFunction.prototype )
function cCUBERANKEDMEMBER() {
cBaseFunction.call( this, "CUBERANKEDMEMBER" );
}
cCUBERANKEDMEMBER.prototype = Object.create( cBaseFunction.prototype )
function cCUBESET() {
cBaseFunction.call( this, "CUBESET" );
}
cCUBESET.prototype = Object.create( cBaseFunction.prototype )
function cCUBESETCOUNT() {
cBaseFunction.call( this, "CUBESETCOUNT" );
}
cCUBESETCOUNT.prototype = Object.create( cBaseFunction.prototype )
function cCUBEVALUE() {
cBaseFunction.call( this, "CUBEVALUE" );
}
cCUBEVALUE.prototype = Object.create( cBaseFunction.prototype )
......@@ -7,52 +7,76 @@
*/
cFormulaFunction.Database = {
'groupName':"Database",
'DAVERAGE':function () {
var r = new cBaseFunction( "DAVERAGE" );
return r;
},
'DCOUNT':function () {
var r = new cBaseFunction( "DCOUNT" );
return r;
},
'DCOUNTA':function () {
var r = new cBaseFunction( "DCOUNTA" );
return r;
},
'DGET':function () {
var r = new cBaseFunction( "DGET" );
return r;
},
'DMAX':function () {
var r = new cBaseFunction( "DMAX" );
return r;
},
'DMIN':function () {
var r = new cBaseFunction( "DMIN" );
return r;
},
'DPRODUCT':function () {
var r = new cBaseFunction( "DPRODUCT" );
return r;
},
'DSTDEV':function () {
var r = new cBaseFunction( "DSTDEV" );
return r;
},
'DSTDEVP':function () {
var r = new cBaseFunction( "DSTDEVP" );
return r;
},
'DSUM':function () {
var r = new cBaseFunction( "DSUM" );
return r;
},
'DVAR':function () {
var r = new cBaseFunction( "DVAR" );
return r;
},
'DVARP':function () {
var r = new cBaseFunction( "DVARP" );
return r;
}
'DAVERAGE':cDAVERAGE,
'DCOUNT':cDCOUNT,
'DCOUNTA':cDCOUNTA,
'DGET':cDGET,
'DMAX':cDMAX,
'DMIN':cDMIN,
'DPRODUCT':cDPRODUCT,
'DSTDEV':cDSTDEV,
'DSTDEVP':cDSTDEVP,
'DSUM':cDSUM,
'DVAR':cDVAR,
'DVARP':cDVARP
}
function cDAVERAGE() {
cBaseFunction.call( this, "DAVERAGE" );
}
cDAVERAGE.prototype = Object.create( cBaseFunction.prototype )
function cDCOUNT() {
cBaseFunction.call( this, "DCOUNT" );
}
cDCOUNT.prototype = Object.create( cBaseFunction.prototype )
function cDCOUNTA() {
cBaseFunction.call( this, "DCOUNTA" );
}
cDCOUNTA.prototype = Object.create( cBaseFunction.prototype )
function cDGET() {
cBaseFunction.call( this, "DGET" );
}
cDGET.prototype = Object.create( cBaseFunction.prototype )
function cDMAX() {
cBaseFunction.call( this, "DMAX" );
}
cDMAX.prototype = Object.create( cBaseFunction.prototype )
function cDMIN() {
cBaseFunction.call( this, "DMIN" );
}
cDMIN.prototype = Object.create( cBaseFunction.prototype )
function cDPRODUCT() {
cBaseFunction.call( this, "DPRODUCT" );
}
cDPRODUCT.prototype = Object.create( cBaseFunction.prototype )
function cDSTDEV() {
cBaseFunction.call( this, "DSTDEV" );
}
cDSTDEV.prototype = Object.create( cBaseFunction.prototype )
function cDSTDEVP() {
cBaseFunction.call( this, "DSTDEVP" );
}
cDSTDEVP.prototype = Object.create( cBaseFunction.prototype )
function cDSUM() {
cBaseFunction.call( this, "DSUM" );
}
cDSUM.prototype = Object.create( cBaseFunction.prototype )
function cDVAR() {
cBaseFunction.call( this, "DVAR" );
}
cDVAR.prototype = Object.create( cBaseFunction.prototype )
function cDVARP() {
cBaseFunction.call( this, "DVARP" );
}
cDVARP.prototype = Object.create( cBaseFunction.prototype )
......@@ -5,13 +5,25 @@
* Time: 15:22
* To change this template use File | Settings | File Templates.
*/
"use strict";
cFormulaFunction.Logical = {
'groupName':"Logical",
'AND':function () {
var r = new cBaseFunction( "AND" );
r.setArgumentsMin( 1 );
r.setArgumentsMax( 255 );
r.Calculate = function ( arg ) {
'AND':cAND,
'FALSE':cFALSE,
'IF':cIF,
'IFERROR':cIFERROR,
'NOT':cNOT,
'OR':cOR,
'TRUE':cTRUE
}
function cAND() {
cBaseFunction.call( this, "AND" );
this.setArgumentsMin( 1 );
this.setArgumentsMax( 255 );
}
cAND.prototype = Object.create( cBaseFunction.prototype )
cAND.prototype.Calculate = function ( arg ) {
var argResult = null;
for ( var i = 0; i < arg.length; i++ ) {
if ( arg[i] instanceof cArea || arg[i] instanceof cArea3D ) {
......@@ -66,35 +78,37 @@ cFormulaFunction.Logical = {
if ( argResult == null )
return this.value = new cError( cErrorType.wrong_value_type );
return this.value = argResult;
}
r.getInfo = function () {
}
cAND.prototype.getInfo = function () {
return {
name:this.name,
args:"(logical1, logical2, ...)"
};
}
return r;
},
'FALSE':function () {
var r = new cBaseFunction( "FALSE" );
r.setArgumentsMin( 0 );
r.setArgumentsMax( 0 );
r.Calculate = function () {
}
function cFALSE() {
cBaseFunction.call( this, "FALSE" );
this.setArgumentsMin( 0 );
this.setArgumentsMax( 0 );
}
cFALSE.prototype = Object.create( cBaseFunction.prototype )
cFALSE.prototype.Calculate = function () {
return this.value = new cBool( false );
}
r.getInfo = function () {
}
cFALSE.prototype.getInfo = function () {
return {
name:this.name,
args:"()"
};
}
return r;
},
'IF':function () {
var r = new cBaseFunction( "IF" );
r.setArgumentsMin( 1 );
r.setArgumentsMax( 3 );
r.Calculate = function ( arg ) {
}
function cIF() {
cBaseFunction.call( this, "IF" );
this.setArgumentsMin( 1 );
this.setArgumentsMax( 3 );
}
cIF.prototype = Object.create( cBaseFunction.prototype )
cIF.prototype.Calculate = function ( arg ) {
var arg0 = arg[0], arg1 = arg[1], arg2 = arg[2];
if ( arg0 instanceof cArray )
......@@ -123,20 +137,21 @@ cFormulaFunction.Logical = {
arg2 :
new cBool( false );
}
}
r.getInfo = function () {
}
cIF.prototype.getInfo = function () {
return {
name:this.name,
args:"(logical_test, value_if_true, value_if_false)"
};
}
return r;
},
'IFERROR':function () {
var r = new cBaseFunction( "IFERROR" );
r.setArgumentsMin( 2 );
r.setArgumentsMax( 2 );
r.Calculate = function ( arg ) {
}
function cIFERROR() {
cBaseFunction.call( this, "IFERROR" );
this.setArgumentsMin( 2 );
this.setArgumentsMax( 2 );
}
cIFERROR.prototype = Object.create( cBaseFunction.prototype )
cIFERROR.prototype.Calculate = function ( arg ) {
var arg0 = arg[0];
if ( arg0 instanceof cArray ) {
arg0 = arg0.getElement( 0 );
......@@ -151,20 +166,21 @@ cFormulaFunction.Logical = {
if ( arg0 instanceof cError )
return this.value = arg[1] instanceof cArray ? arg[1].getElement( 0 ) : arg[1];
else return this.value = arg[0];
}
r.getInfo = function () {
}
cIFERROR.prototype.getInfo = function () {
return {
name:this.name,
args:"(value, value_if_error)"
};
}
return r;
},
'NOT':function () {
var r = new cBaseFunction( "NOT" );
r.setArgumentsMin( 1 );
r.setArgumentsMax( 1 );
r.Calculate = function ( arg ) {
}
function cNOT() {
cBaseFunction.call( this, "NOT" );
this.setArgumentsMin( 1 );
this.setArgumentsMax( 1 );
}
cNOT.prototype = Object.create( cBaseFunction.prototype )
cNOT.prototype.Calculate = function ( arg ) {
var arg0 = arg[0];
if ( arg0 instanceof cArray )
arg0 = arg0.getElement( 0 );
......@@ -184,20 +200,21 @@ cFormulaFunction.Logical = {
return this.value = arg0;
else
return this.value = new cBool( !arg0.tocBool().value );
}
r.getInfo = function () {
}
cNOT.prototype.getInfo = function () {
return {
name:this.name,
args:"(logical)"
};
}
return r;
},
'OR':function () {
var r = new cBaseFunction( "OR" );
r.setArgumentsMin( 1 );
r.setArgumentsMax( 255 );
r.Calculate = function ( arg ) {
}
function cOR() {
cBaseFunction.call( this, "OR" );
this.setArgumentsMin( 1 );
this.setArgumentsMax( 255 );
}
cOR.prototype = Object.create( cBaseFunction.prototype )
cOR.prototype.Calculate = function ( arg ) {
var argResult = null;
for ( var i = 0; i < arg.length; i++ ) {
if ( arg[i] instanceof cArea || arg[i] instanceof cArea3D ) {
......@@ -247,28 +264,26 @@ cFormulaFunction.Logical = {
if ( argResult == null )
return this.value = new cError( cErrorType.wrong_value_type );
return this.value = argResult;
}
r.getInfo = function () {
}
cOR.prototype.getInfo = function () {
return {
name:this.name,
args:"(logical1, logical2, ...)"
};
}
return r;
},
'TRUE':function () {
var r = new cBaseFunction( "TRUE" );
r.setArgumentsMin( 0 );
r.setArgumentsMax( 0 );
r.Calculate = function () {
}
function cTRUE() {
cBaseFunction.call( this, "TRUE" );
this.setArgumentsMin( 0 );
this.setArgumentsMax( 0 );
}
cTRUE.prototype = Object.create( cBaseFunction.prototype )
cTRUE.prototype.Calculate = function () {
return this.value = new cBool( true );
}
r.getInfo = function () {
}
cTRUE.prototype.getInfo = function () {
return {
name:this.name,
args:"()"
};
}
return r;
}
}
......@@ -2659,38 +2659,38 @@ parserFormula.prototype = {
else if ( parserHelp.isFunc.call( this, this.Formula, this.pCurrPos ) ) {
var found_operator = null;
if ( this.operand_str.toUpperCase() in cFormulaFunction.Mathematic )//mathematic
found_operator = cFormulaFunction.Mathematic[this.operand_str.toUpperCase()]();
if ( this.operand_str.toUpperCase() in cFormulaFunction.Mathematic )//Mathematic
found_operator = new cFormulaFunction.Mathematic[this.operand_str.toUpperCase()]();
else if ( this.operand_str.toUpperCase() in cFormulaFunction.Logical )//logical
found_operator = cFormulaFunction.Logical[this.operand_str.toUpperCase()]();
else if ( this.operand_str.toUpperCase() in cFormulaFunction.Logical )//Logical
found_operator = new cFormulaFunction.Logical[this.operand_str.toUpperCase()]();
else if ( this.operand_str.toUpperCase() in cFormulaFunction.Information )//information
found_operator = cFormulaFunction.Information[this.operand_str.toUpperCase()]();
else if ( this.operand_str.toUpperCase() in cFormulaFunction.Information )//Information
found_operator = new cFormulaFunction.Information[this.operand_str.toUpperCase()]();
else if ( this.operand_str.toUpperCase() in cFormulaFunction.Statistical )//statistical
found_operator = cFormulaFunction.Statistical[this.operand_str.toUpperCase()]();
else if ( this.operand_str.toUpperCase() in cFormulaFunction.Statistical )//Statistical
found_operator = new cFormulaFunction.Statistical[this.operand_str.toUpperCase()]();
else if ( this.operand_str.toUpperCase() in cFormulaFunction.TextAndData )//text and data
found_operator = cFormulaFunction.TextAndData[this.operand_str.toUpperCase()]();
else if ( this.operand_str.toUpperCase() in cFormulaFunction.TextAndData )//Text and data
found_operator = new cFormulaFunction.TextAndData[this.operand_str.toUpperCase()]();
else if ( this.operand_str.toUpperCase() in cFormulaFunction.Cube )//cube
found_operator = cFormulaFunction.Cube[this.operand_str.toUpperCase()]();
else if ( this.operand_str.toUpperCase() in cFormulaFunction.Cube )//Cube
found_operator = new cFormulaFunction.Cube[this.operand_str.toUpperCase()]();
else if ( this.operand_str.toUpperCase() in cFormulaFunction.Database )//Database
found_operator = cFormulaFunction.Database[this.operand_str.toUpperCase()]();
found_operator = new cFormulaFunction.Database[this.operand_str.toUpperCase()]();
else if ( this.operand_str.toUpperCase() in cFormulaFunction.DateAndTime )//Date and time
found_operator = cFormulaFunction.DateAndTime[this.operand_str.toUpperCase()]();
found_operator = new cFormulaFunction.DateAndTime[this.operand_str.toUpperCase()]();
else if ( this.operand_str.toUpperCase() in cFormulaFunction.Engineering )//Engineering
found_operator = cFormulaFunction.Engineering[this.operand_str.toUpperCase()]();
found_operator = new cFormulaFunction.Engineering[this.operand_str.toUpperCase()]();
else if ( this.operand_str.toUpperCase() in cFormulaFunction.Financial )//Financial
found_operator = cFormulaFunction.Financial[this.operand_str.toUpperCase()]();
found_operator = new cFormulaFunction.Financial[this.operand_str.toUpperCase()]();
else if ( this.operand_str.toUpperCase() in cFormulaFunction.LookupAndReference )//Lookup and reference
found_operator = cFormulaFunction.LookupAndReference[this.operand_str.toUpperCase()]();
found_operator = new cFormulaFunction.LookupAndReference[this.operand_str.toUpperCase()]();
if ( found_operator != null && found_operator != undefined )
this.elemArr.push( found_operator );
......
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