Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sdkjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
sdkjs
Commits
599e6ca1
Commit
599e6ca1
authored
Jun 06, 2017
by
GoshaZotov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
_checkArguments -> _prepareArguments(return obj)
parent
3f2fc7cb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
33 deletions
+37
-33
cell/model/FormulaObjects/mathematicFunctions.js
cell/model/FormulaObjects/mathematicFunctions.js
+24
-16
cell/model/FormulaObjects/parserFormula.js
cell/model/FormulaObjects/parserFormula.js
+13
-17
No files found.
cell/model/FormulaObjects/mathematicFunctions.js
View file @
599e6ca1
...
@@ -628,7 +628,8 @@
...
@@ -628,7 +628,8 @@
cBASE
.
prototype
.
argumentsMax
=
3
;
cBASE
.
prototype
.
argumentsMax
=
3
;
cBASE
.
prototype
.
isXLFN
=
true
;
cBASE
.
prototype
.
isXLFN
=
true
;
cBASE
.
prototype
.
Calculate
=
function
(
arg
)
{
cBASE
.
prototype
.
Calculate
=
function
(
arg
)
{
var
argClone
=
this
.
_checkArguments
(
arg
,
arguments
[
1
]);
var
oArguments
=
this
.
_prepareArguments
(
arg
,
arguments
[
1
]);
var
argClone
=
oArguments
.
args
;
argClone
[
0
]
=
argClone
[
0
].
tocNumber
();
argClone
[
0
]
=
argClone
[
0
].
tocNumber
();
argClone
[
1
]
=
argClone
[
1
].
tocNumber
();
argClone
[
1
]
=
argClone
[
1
].
tocNumber
();
...
@@ -661,7 +662,7 @@
...
@@ -661,7 +662,7 @@
return
new
cString
(
str
);
return
new
cString
(
str
);
}
}
return
this
.
value
=
this
.
_findArrayInNumberArguments
(
argClone
,
base_math
);
return
this
.
value
=
this
.
_findArrayInNumberArguments
(
oArguments
,
base_math
);
};
};
cBASE
.
prototype
.
getInfo
=
function
()
{
cBASE
.
prototype
.
getInfo
=
function
()
{
return
{
return
{
...
@@ -786,7 +787,8 @@
...
@@ -786,7 +787,8 @@
cCEILING_MATH
.
prototype
.
argumentsMax
=
3
;
cCEILING_MATH
.
prototype
.
argumentsMax
=
3
;
cCEILING_MATH
.
prototype
.
isXLFN
=
true
;
cCEILING_MATH
.
prototype
.
isXLFN
=
true
;
cCEILING_MATH
.
prototype
.
Calculate
=
function
(
arg
)
{
cCEILING_MATH
.
prototype
.
Calculate
=
function
(
arg
)
{
var
argClone
=
this
.
_checkArguments
(
arg
,
arguments
[
1
]);
var
oArguments
=
this
.
_prepareArguments
(
arg
,
arguments
[
1
]);
var
argClone
=
oArguments
.
args
;
argClone
[
0
]
=
argClone
[
0
].
tocNumber
();
argClone
[
0
]
=
argClone
[
0
].
tocNumber
();
if
(
!
argClone
[
1
]){
if
(
!
argClone
[
1
]){
...
@@ -818,7 +820,7 @@
...
@@ -818,7 +820,7 @@
}
}
}
}
return
this
.
value
=
this
.
_findArrayInNumberArguments
(
argClone
,
floor_math
);
return
this
.
value
=
this
.
_findArrayInNumberArguments
(
oArguments
,
floor_math
);
};
};
cCEILING_MATH
.
prototype
.
getInfo
=
function
()
{
cCEILING_MATH
.
prototype
.
getInfo
=
function
()
{
return
{
return
{
...
@@ -842,7 +844,8 @@
...
@@ -842,7 +844,8 @@
cCEILING_PRECISE
.
prototype
.
argumentsMax
=
2
;
cCEILING_PRECISE
.
prototype
.
argumentsMax
=
2
;
cCEILING_PRECISE
.
prototype
.
isXLFN
=
true
;
cCEILING_PRECISE
.
prototype
.
isXLFN
=
true
;
cCEILING_PRECISE
.
prototype
.
Calculate
=
function
(
arg
)
{
cCEILING_PRECISE
.
prototype
.
Calculate
=
function
(
arg
)
{
var
argClone
=
this
.
_checkArguments
(
arg
,
arguments
[
1
]);
var
oArguments
=
this
.
_prepareArguments
(
arg
,
arguments
[
1
]);
var
argClone
=
oArguments
.
args
;
argClone
[
0
]
=
argClone
[
0
].
tocNumber
();
argClone
[
0
]
=
argClone
[
0
].
tocNumber
();
argClone
[
1
]
=
argClone
[
1
]
?
argClone
[
1
].
tocNumber
()
:
new
cNumber
(
1
);
argClone
[
1
]
=
argClone
[
1
]
?
argClone
[
1
].
tocNumber
()
:
new
cNumber
(
1
);
...
@@ -864,7 +867,7 @@
...
@@ -864,7 +867,7 @@
return
new
cNumber
(
Math
.
ceil
(
quotient
)
*
absSignificance
);
return
new
cNumber
(
Math
.
ceil
(
quotient
)
*
absSignificance
);
}
}
return
this
.
value
=
this
.
_findArrayInNumberArguments
(
argClone
,
floorHelper
);
return
this
.
value
=
this
.
_findArrayInNumberArguments
(
oArguments
,
floorHelper
);
};
};
cCEILING_PRECISE
.
prototype
.
getInfo
=
function
()
{
cCEILING_PRECISE
.
prototype
.
getInfo
=
function
()
{
return
{
return
{
...
@@ -979,7 +982,8 @@
...
@@ -979,7 +982,8 @@
cCOMBINA
.
prototype
.
argumentsMax
=
2
;
cCOMBINA
.
prototype
.
argumentsMax
=
2
;
cCOMBINA
.
prototype
.
isXLFN
=
true
;
cCOMBINA
.
prototype
.
isXLFN
=
true
;
cCOMBINA
.
prototype
.
Calculate
=
function
(
arg
)
{
cCOMBINA
.
prototype
.
Calculate
=
function
(
arg
)
{
var
argClone
=
this
.
_checkArguments
(
arg
,
arguments
[
1
]);
var
oArguments
=
this
.
_prepareArguments
(
arg
,
arguments
[
1
]);
var
argClone
=
oArguments
.
args
;
argClone
[
0
]
=
argClone
[
0
].
tocNumber
();
argClone
[
0
]
=
argClone
[
0
].
tocNumber
();
argClone
[
1
]
=
argClone
[
1
].
tocNumber
();
argClone
[
1
]
=
argClone
[
1
].
tocNumber
();
...
@@ -1002,7 +1006,7 @@
...
@@ -1002,7 +1006,7 @@
return
new
cNumber
(
Math
.
binomCoeff
(
a
+
b
-
1
,
b
));
return
new
cNumber
(
Math
.
binomCoeff
(
a
+
b
-
1
,
b
));
}
}
return
this
.
value
=
this
.
_findArrayInNumberArguments
(
argClone
,
combinaCalculate
);
return
this
.
value
=
this
.
_findArrayInNumberArguments
(
oArguments
,
combinaCalculate
);
};
};
cCOMBINA
.
prototype
.
getInfo
=
function
()
{
cCOMBINA
.
prototype
.
getInfo
=
function
()
{
return
{
return
{
...
@@ -1342,7 +1346,8 @@
...
@@ -1342,7 +1346,8 @@
cDECIMAL
.
prototype
.
argumentsMax
=
2
;
cDECIMAL
.
prototype
.
argumentsMax
=
2
;
cDECIMAL
.
prototype
.
isXLFN
=
true
;
cDECIMAL
.
prototype
.
isXLFN
=
true
;
cDECIMAL
.
prototype
.
Calculate
=
function
(
arg
)
{
cDECIMAL
.
prototype
.
Calculate
=
function
(
arg
)
{
var
argClone
=
this
.
_checkArguments
(
arg
,
arguments
[
1
]);
var
oArguments
=
this
.
_prepareArguments
(
arg
,
arguments
[
1
]);
var
argClone
=
oArguments
.
args
;
argClone
[
0
]
=
argClone
[
0
].
tocString
();
argClone
[
0
]
=
argClone
[
0
].
tocString
();
argClone
[
1
]
=
argClone
[
1
].
tocNumber
();
argClone
[
1
]
=
argClone
[
1
].
tocNumber
();
...
@@ -1400,7 +1405,7 @@
...
@@ -1400,7 +1405,7 @@
return
isNaN
(
fVal
)
?
new
cError
(
cErrorType
.
not_numeric
)
:
new
cNumber
(
fVal
);
return
isNaN
(
fVal
)
?
new
cError
(
cErrorType
.
not_numeric
)
:
new
cNumber
(
fVal
);
}
}
return
this
.
value
=
this
.
_findArrayInNumberArguments
(
argClone
,
decimal_calculate
,
true
);
return
this
.
value
=
this
.
_findArrayInNumberArguments
(
oArguments
,
decimal_calculate
,
true
);
};
};
cDECIMAL
.
prototype
.
getInfo
=
function
()
{
cDECIMAL
.
prototype
.
getInfo
=
function
()
{
return
{
return
{
...
@@ -1813,7 +1818,8 @@
...
@@ -1813,7 +1818,8 @@
cFLOOR_PRECISE
.
prototype
.
argumentsMax
=
2
;
cFLOOR_PRECISE
.
prototype
.
argumentsMax
=
2
;
cFLOOR_PRECISE
.
prototype
.
isXLFN
=
true
;
cFLOOR_PRECISE
.
prototype
.
isXLFN
=
true
;
cFLOOR_PRECISE
.
prototype
.
Calculate
=
function
(
arg
)
{
cFLOOR_PRECISE
.
prototype
.
Calculate
=
function
(
arg
)
{
var
argClone
=
this
.
_checkArguments
(
arg
,
arguments
[
1
]);
var
oArguments
=
this
.
_prepareArguments
(
arg
,
arguments
[
1
]);
var
argClone
=
oArguments
.
args
;
argClone
[
0
]
=
argClone
[
0
].
tocNumber
();
argClone
[
0
]
=
argClone
[
0
].
tocNumber
();
argClone
[
1
]
=
argClone
[
1
]
?
argClone
[
1
].
tocNumber
()
:
new
cNumber
(
1
);
argClone
[
1
]
=
argClone
[
1
]
?
argClone
[
1
].
tocNumber
()
:
new
cNumber
(
1
);
...
@@ -1835,7 +1841,7 @@
...
@@ -1835,7 +1841,7 @@
return
new
cNumber
(
Math
.
floor
(
quotient
)
*
absSignificance
);
return
new
cNumber
(
Math
.
floor
(
quotient
)
*
absSignificance
);
}
}
return
this
.
value
=
this
.
_findArrayInNumberArguments
(
argClone
,
floorHelper
);
return
this
.
value
=
this
.
_findArrayInNumberArguments
(
oArguments
,
floorHelper
);
};
};
cFLOOR_PRECISE
.
prototype
.
getInfo
=
function
()
{
cFLOOR_PRECISE
.
prototype
.
getInfo
=
function
()
{
return
{
return
{
...
@@ -1859,7 +1865,8 @@
...
@@ -1859,7 +1865,8 @@
cFLOOR_MATH
.
prototype
.
argumentsMax
=
3
;
cFLOOR_MATH
.
prototype
.
argumentsMax
=
3
;
cFLOOR_MATH
.
prototype
.
isXLFN
=
true
;
cFLOOR_MATH
.
prototype
.
isXLFN
=
true
;
cFLOOR_MATH
.
prototype
.
Calculate
=
function
(
arg
)
{
cFLOOR_MATH
.
prototype
.
Calculate
=
function
(
arg
)
{
var
argClone
=
this
.
_checkArguments
(
arg
,
arguments
[
1
]);
var
oArguments
=
this
.
_prepareArguments
(
arg
,
arguments
[
1
]);
var
argClone
=
oArguments
.
args
;
argClone
[
0
]
=
argClone
[
0
].
tocNumber
();
argClone
[
0
]
=
argClone
[
0
].
tocNumber
();
if
(
!
argClone
[
1
]){
if
(
!
argClone
[
1
]){
...
@@ -1891,7 +1898,7 @@
...
@@ -1891,7 +1898,7 @@
}
}
}
}
return
this
.
value
=
this
.
_findArrayInNumberArguments
(
argClone
,
floor_math
);
return
this
.
value
=
this
.
_findArrayInNumberArguments
(
oArguments
,
floor_math
);
};
};
cFLOOR_MATH
.
prototype
.
getInfo
=
function
()
{
cFLOOR_MATH
.
prototype
.
getInfo
=
function
()
{
return
{
return
{
...
@@ -2063,7 +2070,8 @@
...
@@ -2063,7 +2070,8 @@
cISO_CEILING
.
prototype
.
argumentsMax
=
2
;
cISO_CEILING
.
prototype
.
argumentsMax
=
2
;
//cISO_CEILING.prototype.isXLFN = true;
//cISO_CEILING.prototype.isXLFN = true;
cISO_CEILING
.
prototype
.
Calculate
=
function
(
arg
)
{
cISO_CEILING
.
prototype
.
Calculate
=
function
(
arg
)
{
var
argClone
=
this
.
_checkArguments
(
arg
,
arguments
[
1
]);
var
oArguments
=
this
.
_prepareArguments
(
arg
,
arguments
[
1
]);
var
argClone
=
oArguments
.
args
;
argClone
[
0
]
=
argClone
[
0
].
tocNumber
();
argClone
[
0
]
=
argClone
[
0
].
tocNumber
();
argClone
[
1
]
=
argClone
[
1
]
?
argClone
[
1
].
tocNumber
()
:
new
cNumber
(
1
);
argClone
[
1
]
=
argClone
[
1
]
?
argClone
[
1
].
tocNumber
()
:
new
cNumber
(
1
);
...
@@ -2085,7 +2093,7 @@
...
@@ -2085,7 +2093,7 @@
return
new
cNumber
(
Math
.
ceil
(
quotient
)
*
absSignificance
);
return
new
cNumber
(
Math
.
ceil
(
quotient
)
*
absSignificance
);
}
}
return
this
.
value
=
this
.
_findArrayInNumberArguments
(
argClone
,
floorHelper
);
return
this
.
value
=
this
.
_findArrayInNumberArguments
(
oArguments
,
floorHelper
);
};
};
cISO_CEILING
.
prototype
.
getInfo
=
function
()
{
cISO_CEILING
.
prototype
.
getInfo
=
function
()
{
return
{
return
{
...
...
cell/model/FormulaObjects/parserFormula.js
View file @
599e6ca1
...
@@ -2293,7 +2293,6 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
...
@@ -2293,7 +2293,6 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
this
.
value
=
null
;
this
.
value
=
null
;
this
.
argumentsCurrent
=
0
;
this
.
argumentsCurrent
=
0
;
this
.
findArgArrayIndex
=
null
;
// this.isXLFN = rx_sFuncPref.test(this.name);
// this.isXLFN = rx_sFuncPref.test(this.name);
}
}
...
@@ -2371,8 +2370,10 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
...
@@ -2371,8 +2370,10 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
cBaseFunction
.
prototype
.
checkArguments
=
function
()
{
cBaseFunction
.
prototype
.
checkArguments
=
function
()
{
return
this
.
argumentsMin
<=
this
.
argumentsCurrent
&&
this
.
argumentsCurrent
<=
this
.
argumentsMax
;
return
this
.
argumentsMin
<=
this
.
argumentsCurrent
&&
this
.
argumentsCurrent
<=
this
.
argumentsMax
;
};
};
cBaseFunction
.
prototype
.
_findArrayInNumberArguments
=
function
(
input
Arguments
,
calculateFunc
,
dNotCheckNumberType
){
cBaseFunction
.
prototype
.
_findArrayInNumberArguments
=
function
(
o
Arguments
,
calculateFunc
,
dNotCheckNumberType
){
var
argsArray
=
[];
var
argsArray
=
[];
var
inputArguments
=
oArguments
.
args
;
var
findArgArrayIndex
=
oArguments
.
indexArr
;
var
parseArray
=
function
(
array
){
var
parseArray
=
function
(
array
){
array
.
foreach
(
function
(
elem
,
r
,
c
)
{
array
.
foreach
(
function
(
elem
,
r
,
c
)
{
...
@@ -2401,43 +2402,38 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
...
@@ -2401,43 +2402,38 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
return
array
;
return
array
;
};
};
if
(
null
!==
this
.
findArgArrayIndex
){
if
(
null
!==
findArgArrayIndex
){
return
parseArray
(
inputArguments
[
this
.
findArgArrayIndex
]);
return
parseArray
(
inputArguments
[
findArgArrayIndex
]);
}
}
else
{
else
{
for
(
var
i
=
0
;
i
<
inputArguments
.
length
;
i
++
){
for
(
var
i
=
0
;
i
<
inputArguments
.
length
;
i
++
){
if
(
cElementType
.
array
===
inputArguments
[
i
].
t
ype
){
if
(
cElementType
.
string
===
inputArguments
[
i
].
type
&&
!
dNotCheckNumberT
ype
){
return
parseArray
(
inputArguments
[
i
]
);
return
new
cError
(
cErrorType
.
wrong_value_type
);
}
else
{
}
else
{
if
(
cElementType
.
string
===
inputArguments
[
i
].
type
&&
!
dNotCheckNumberType
){
argsArray
[
i
]
=
inputArguments
[
i
].
getValue
();
return
new
cError
(
cErrorType
.
wrong_value_type
);
}
else
{
argsArray
[
i
]
=
inputArguments
[
i
].
getValue
();
}
}
}
}
}
}
}
return
calculateFunc
(
argsArray
);
return
calculateFunc
(
argsArray
);
};
};
cBaseFunction
.
prototype
.
_
check
Arguments
=
function
(
args
,
arg1
)
{
cBaseFunction
.
prototype
.
_
prepare
Arguments
=
function
(
args
,
arg1
)
{
var
newArgs
=
[];
var
newArgs
=
[];
var
indexArr
=
null
;
this
.
findArgArrayIndex
=
null
;
for
(
var
i
=
0
;
i
<
args
.
length
;
i
++
){
for
(
var
i
=
0
;
i
<
args
.
length
;
i
++
){
var
arg
=
args
[
i
];
var
arg
=
args
[
i
];
if
(
cElementType
.
cellsRange
===
arg
.
type
||
cElementType
.
cellsRange3D
===
arg
.
type
)
{
if
(
cElementType
.
cellsRange
===
arg
.
type
||
cElementType
.
cellsRange3D
===
arg
.
type
)
{
newArgs
[
i
]
=
arg
.
cross
(
arg1
);
newArgs
[
i
]
=
arg
.
cross
(
arg1
);
}
else
if
(
cElementType
.
array
===
arg
.
type
){
}
else
if
(
cElementType
.
array
===
arg
.
type
){
this
.
findArgArrayIndex
=
i
;
indexArr
=
i
;
newArgs
[
i
]
=
arg
;
newArgs
[
i
]
=
arg
;
}
else
{
}
else
{
newArgs
[
i
]
=
arg
;
newArgs
[
i
]
=
arg
;
}
}
}
}
return
newArgs
;
return
{
args
:
newArgs
,
indexArr
:
indexArr
}
;
};
};
cBaseFunction
.
prototype
.
_checkErrorArg
=
function
(
argArray
)
{
cBaseFunction
.
prototype
.
_checkErrorArg
=
function
(
argArray
)
{
for
(
var
i
=
0
;
i
<
argArray
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
argArray
.
length
;
i
++
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment