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
6ea753ed
Commit
6ea753ed
authored
Jun 14, 2016
by
Alexander.Trofimov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
accelerated function LARGE (get only no empty values)
parent
9ed6855e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
95 additions
and
98 deletions
+95
-98
cell/model/FormulaObjects/parserFormula.js
cell/model/FormulaObjects/parserFormula.js
+34
-31
cell/model/FormulaObjects/statisticalFunctions.js
cell/model/FormulaObjects/statisticalFunctions.js
+61
-67
No files found.
cell/model/FormulaObjects/parserFormula.js
View file @
6ea753ed
...
@@ -715,27 +715,23 @@ cArea.prototype.foreach = function ( action ) {
...
@@ -715,27 +715,23 @@ cArea.prototype.foreach = function ( action ) {
r
.
_foreach2
(
action
);
r
.
_foreach2
(
action
);
}
}
};
};
cArea
.
prototype
.
_parseCellValue
=
function
(
cell
)
{
cArea
.
prototype
.
_parseCellValue
=
function
(
cell
)
{
var
result
,
cellType
,
cellValue
;
var
result
=
null
,
cellType
,
cellValue
;
if
(
cell
)
{
if
(
cell
)
{
cellType
=
cell
.
getType
();
cellType
=
cell
.
getType
();
cellValue
=
cell
.
getValueWithoutFormat
();
cellValue
=
cell
.
getValueWithoutFormat
();
if
(
cellType
===
CellValueType
.
Number
)
{
if
(
cellType
===
CellValueType
.
Number
)
{
result
=
cell
.
isEmptyTextString
()
?
new
cEmpty
()
:
new
cNumber
(
cellValue
);
result
=
cell
.
isEmptyTextString
()
?
new
cEmpty
()
:
new
cNumber
(
cellValue
);
}
else
if
(
cellType
===
CellValueType
.
Bool
)
{
}
else
if
(
cellType
===
CellValueType
.
Bool
)
{
result
=
new
cBool
(
cellValue
);
result
=
new
cBool
(
cellValue
);
}
else
if
(
cellType
===
CellValueType
.
Error
)
{
}
else
if
(
cellType
===
CellValueType
.
Error
)
{
result
=
new
cError
(
cellValue
);
result
=
new
cError
(
cellValue
);
}
else
if
(
cellType
===
CellValueType
.
String
)
{
}
else
if
(
cellType
===
CellValueType
.
String
)
{
result
=
new
cString
(
cellValue
);
result
=
new
cString
(
cellValue
);
}
else
{
result
=
cell
.
isEmptyTextString
()
?
checkTypeCell
(
""
+
cellValue
)
:
new
cNumber
(
cellValue
);
}
}
}
else
{
result
=
new
cEmpty
();
}
}
return
result
;
return
result
||
new
cEmpty
()
;
};
};
cArea
.
prototype
.
foreach2
=
function
(
action
)
{
cArea
.
prototype
.
foreach2
=
function
(
action
)
{
var
t
=
this
,
r
=
this
.
getRange
();
var
t
=
this
,
r
=
this
.
getRange
();
if
(
r
)
{
if
(
r
)
{
...
@@ -744,16 +740,23 @@ cArea.prototype.foreach2 = function ( action ) {
...
@@ -744,16 +740,23 @@ cArea.prototype.foreach2 = function ( action ) {
}
);
}
);
}
}
};
};
cArea
.
prototype
.
getMatrix
=
function
()
{
cArea
.
prototype
.
getMatrix
=
function
()
{
var
t
=
this
,
arr
=
[],
r
=
this
.
getRange
();
var
t
=
this
,
arr
=
[],
r
=
this
.
getRange
();
r
.
_foreach2
(
function
(
cell
,
i
,
j
,
r1
,
c1
)
{
r
.
_foreach2
(
function
(
cell
,
i
,
j
,
r1
,
c1
)
{
if
(
!
arr
[
i
-
r1
])
{
if
(
!
arr
[
i
-
r1
])
{
arr
[
i
-
r1
]
=
[];
arr
[
i
-
r1
]
=
[];
}
}
arr
[
i
-
r1
][
j
-
c1
]
=
t
.
_parseCellValue
(
cell
);
arr
[
i
-
r1
][
j
-
c1
]
=
t
.
_parseCellValue
(
cell
);
}
);
}
);
return
arr
;
return
arr
;
};
};
cArea
.
prototype
.
getValuesNoEmpty
=
function
()
{
var
t
=
this
,
arr
=
[],
r
=
this
.
getRange
();
r
.
_foreachNoEmpty
(
function
(
cell
)
{
arr
.
push
(
t
.
_parseCellValue
(
cell
));
});
return
[
arr
];
};
cArea
.
prototype
.
getRefMatrix
=
function
()
{
cArea
.
prototype
.
getRefMatrix
=
function
()
{
var
t
=
this
,
arr
=
[],
r
=
this
.
getRange
();
var
t
=
this
,
arr
=
[],
r
=
this
.
getRange
();
r
.
_foreach2
(
function
(
cell
,
i
,
j
,
r1
,
c1
)
{
r
.
_foreach2
(
function
(
cell
,
i
,
j
,
r1
,
c1
)
{
...
...
cell/model/FormulaObjects/statisticalFunctions.js
View file @
6ea753ed
...
@@ -2407,12 +2407,7 @@ cKURT.prototype.getInfo = function () {
...
@@ -2407,12 +2407,7 @@ cKURT.prototype.getInfo = function () {
};
};
};
};
function
cLARGE
()
{
function
cLARGE
()
{
// cBaseFunction.call( this, "LARGE" );
// this.setArgumentsMin( 2 );
// this.setArgumentsMax( 2 );
// this.setFormat( this.formatType.noneFormat );
this
.
name
=
"
LARGE
"
;
this
.
name
=
"
LARGE
"
;
this
.
type
=
cElementType
.
func
;
this
.
type
=
cElementType
.
func
;
this
.
value
=
null
;
this
.
value
=
null
;
...
@@ -2420,73 +2415,72 @@ function cLARGE() {
...
@@ -2420,73 +2415,72 @@ function cLARGE() {
this
.
argumentsCurrent
=
0
;
this
.
argumentsCurrent
=
0
;
this
.
argumentsMax
=
2
;
this
.
argumentsMax
=
2
;
this
.
formatType
=
{
this
.
formatType
=
{
def
:
-
1
,
//подразумевается формат первой ячейки входящей в формулу.
def
:
-
1
,
//подразумевается формат первой ячейки входящей в формулу.
noneFormat
:
-
2
noneFormat
:
-
2
};
};
this
.
numFormat
=
this
.
formatType
.
noneFormat
;
this
.
numFormat
=
this
.
formatType
.
noneFormat
;
}
}
cLARGE
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
cLARGE
.
prototype
.
_getValue
=
function
(
arg0
,
arg1
)
{
cLARGE
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
if
(
cElementType
.
error
===
arg1
.
type
)
{
cLARGE
.
prototype
.
Calculate
=
function
(
arg
)
{
return
arg1
;
function
frequency
(
A
,
k
)
{
var
tA
=
[];
for
(
var
i
=
0
;
i
<
A
.
length
;
i
++
)
{
for
(
var
j
=
0
;
j
<
A
[
i
].
length
;
j
++
)
{
if
(
A
[
i
][
j
]
instanceof
cError
)
{
return
A
[
i
][
j
];
}
}
else
if
(
A
[
i
][
j
]
instanceof
cNumber
)
{
tA
.
push
(
A
[
i
][
j
].
getValue
()
);
arg1
=
arg1
.
getValue
();
if
(
arg1
<=
0
)
{
return
new
cError
(
cErrorType
.
not_available
);
}
}
else
if
(
A
[
i
][
j
]
instanceof
cBool
)
{
tA
.
push
(
A
[
i
][
j
].
tocNumber
().
getValue
()
);
var
v
,
tA
=
[];
for
(
var
i
=
0
;
i
<
arg0
.
length
;
i
++
)
{
for
(
var
j
=
0
;
j
<
arg0
[
i
].
length
;
j
++
)
{
v
=
arg0
[
i
][
j
];
if
(
cElementType
.
error
===
v
.
type
)
{
return
v
;
}
else
if
(
cElementType
.
number
===
v
.
type
)
{
tA
.
push
(
v
.
getValue
());
}
else
if
(
cElementType
.
bool
===
v
.
type
)
{
tA
.
push
(
v
.
tocNumber
().
getValue
());
}
}
}
}
}
}
tA
.
sort
(
AscCommon
.
fSortDescending
);
tA
.
sort
(
AscCommon
.
fSortDescending
);
if
(
k
.
getValue
()
>
tA
.
length
||
k
.
getValue
()
<=
0
)
if
(
arg1
>
tA
.
length
)
{
return
new
cError
(
cErrorType
.
not_available
);
return
new
cError
(
cErrorType
.
not_available
);
else
}
else
{
return
new
cNumber
(
tA
[
k
.
getValue
()
-
1
]
);
return
new
cNumber
(
tA
[
arg1
-
1
]
);
}
}
};
cLARGE
.
prototype
.
Calculate
=
function
(
arg
)
{
var
arg0
=
arg
[
0
],
arg1
=
arg
[
1
];
var
arg0
=
arg
[
0
],
arg1
=
arg
[
1
];
if
(
arg0
instanceof
cArea
||
arg0
instanceof
cArray
)
{
if
(
cElementType
.
cellsRange
===
arg0
.
type
)
{
arg0
=
arg0
.
getValuesNoEmpty
();
}
else
if
(
cElementType
.
array
===
arg0
.
type
)
{
arg0
=
arg0
.
getMatrix
();
arg0
=
arg0
.
getMatrix
();
}
}
else
if
(
cElementType
.
cellsRange3D
===
arg0
.
type
)
{
else
if
(
arg0
instanceof
cArea3D
)
{
arg0
=
arg0
.
getMatrix
()[
0
];
arg0
=
arg0
.
getMatrix
()[
0
];
}
else
{
return
this
.
value
=
new
cError
(
cErrorType
.
not_available
);
}
}
else
return
this
.
value
=
new
cError
(
cErrorType
.
not_available
);
if
(
arg1
instanceof
cArea
||
arg1
instanceof
cArea3D
)
{
if
(
cElementType
.
cellsRange
===
arg1
.
type
||
cElementType
.
cellsRange3D
===
arg1
.
type
)
{
arg1
=
arg1
.
cross
(
arguments
[
1
].
first
);
arg1
=
arg1
.
cross
(
arguments
[
1
].
first
);
}
}
else
if
(
cElementType
.
array
===
arg1
.
type
)
{
else
if
(
arg1
instanceof
cArray
)
{
arg1
=
arg1
.
getElement
(
0
);
arg1
=
arg1
.
getElement
(
0
);
}
}
arg1
=
arg1
.
tocNumber
();
arg1
=
arg1
.
tocNumber
();
return
this
.
value
=
this
.
_getValue
(
arg0
,
arg1
);
if
(
arg1
instanceof
cError
)
return
this
.
value
=
arg1
;
};
cLARGE
.
prototype
.
getInfo
=
function
()
{
return
this
.
value
=
frequency
(
arg0
,
arg1
);
};
cLARGE
.
prototype
.
getInfo
=
function
()
{
return
{
return
{
name
:
this
.
name
,
name
:
this
.
name
,
args
:
"
( array , k )
"
args
:
"
( array , k )
"
};
};
};
};
function
cLINEST
()
{
function
cLINEST
()
{
cBaseFunction
.
call
(
this
,
"
LINEST
"
);
cBaseFunction
.
call
(
this
,
"
LINEST
"
);
...
...
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