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
97a564a7
Commit
97a564a7
authored
Jun 05, 2017
by
GoshaZotov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add XOR function
parent
15702cc7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
90 additions
and
14 deletions
+90
-14
cell/model/FormulaObjects/_xlfnFunctions.js
cell/model/FormulaObjects/_xlfnFunctions.js
+1
-13
cell/model/FormulaObjects/logicalFunctions.js
cell/model/FormulaObjects/logicalFunctions.js
+89
-1
No files found.
cell/model/FormulaObjects/_xlfnFunctions.js
View file @
97a564a7
...
...
@@ -74,7 +74,7 @@
cFormulaFunctionGroup
[
'
Information
'
]
=
cFormulaFunctionGroup
[
'
Information
'
]
||
[];
cFormulaFunctionGroup
[
'
Information
'
].
push
(
cISFORMULA
,
cSHEET
,
cSHEETS
);
cFormulaFunctionGroup
[
'
Logical
'
]
=
cFormulaFunctionGroup
[
'
Logical
'
]
||
[];
cFormulaFunctionGroup
[
'
Logical
'
].
push
(
cIFNA
,
cXOR
);
cFormulaFunctionGroup
[
'
Logical
'
].
push
(
cIFNA
);
/**
* @constructor
...
...
@@ -1144,18 +1144,6 @@
cWEIBULL_DIST
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
cWEIBULL_DIST
.
prototype
.
constructor
=
cWEIBULL_DIST
;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function
cXOR
()
{
cBaseFunction
.
call
(
this
,
"
XOR
"
);
this
.
isXLFN
=
true
;
}
cXOR
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
cXOR
.
prototype
.
constructor
=
cXOR
;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
...
...
cell/model/FormulaObjects/logicalFunctions.js
View file @
97a564a7
...
...
@@ -50,7 +50,7 @@
var
cFormulaFunctionGroup
=
AscCommonExcel
.
cFormulaFunctionGroup
;
cFormulaFunctionGroup
[
'
Logical
'
]
=
cFormulaFunctionGroup
[
'
Logical
'
]
||
[];
cFormulaFunctionGroup
[
'
Logical
'
].
push
(
cAND
,
cFALSE
,
cIF
,
cIFERROR
,
cNOT
,
cOR
,
cTRUE
);
cFormulaFunctionGroup
[
'
Logical
'
].
push
(
cAND
,
cFALSE
,
cIF
,
cIFERROR
,
cNOT
,
cOR
,
cTRUE
,
cXOR
);
/**
* @constructor
...
...
@@ -376,4 +376,92 @@
name
:
this
.
name
,
args
:
"
()
"
};
};
/**
* @constructor
* @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
.
argumentsMin
=
1
;
cXOR
.
prototype
.
Calculate
=
function
(
arg
)
{
var
argResult
=
null
;
var
nTrueValues
=
0
;
for
(
var
i
=
0
;
i
<
arg
.
length
;
i
++
)
{
if
(
arg
[
i
]
instanceof
cArea
||
arg
[
i
]
instanceof
cArea3D
)
{
var
argArr
=
arg
[
i
].
getValue
();
for
(
var
j
=
0
;
j
<
argArr
.
length
;
j
++
)
{
if
(
argArr
[
j
]
instanceof
cError
)
{
return
this
.
value
=
argArr
[
j
];
}
else
if
(
argArr
[
j
]
instanceof
cString
||
argArr
[
j
]
instanceof
cEmpty
)
{
if
(
argResult
===
null
)
{
argResult
=
argArr
[
j
].
tocBool
();
}
else
{
argResult
=
new
cBool
(
argResult
.
value
||
argArr
[
j
].
tocBool
().
value
);
}
}
if
(
argResult
.
value
===
true
)
{
nTrueValues
++
;
}
}
}
else
{
if
(
arg
[
i
]
instanceof
cString
)
{
return
this
.
value
=
new
cError
(
cErrorType
.
wrong_value_type
);
}
else
if
(
arg
[
i
]
instanceof
cError
)
{
return
this
.
value
=
arg
[
i
];
}
else
if
(
arg
[
i
]
instanceof
cArray
)
{
arg
[
i
].
foreach
(
function
(
elem
)
{
if
(
elem
instanceof
cError
)
{
argResult
=
elem
;
return
true
;
}
else
if
(
elem
instanceof
cString
||
elem
instanceof
cEmpty
)
{
return
false
;
}
else
{
if
(
argResult
===
null
)
{
argResult
=
elem
.
tocBool
();
}
else
{
argResult
=
new
cBool
(
elem
.
tocBool
().
value
);
}
}
if
(
argResult
.
value
===
true
)
{
nTrueValues
++
;
}
})
}
else
{
if
(
argResult
==
null
)
{
argResult
=
arg
[
i
].
tocBool
();
}
else
{
argResult
=
new
cBool
(
arg
[
i
].
tocBool
().
value
);
}
if
(
argResult
.
value
===
true
)
{
nTrueValues
++
;
}
}
}
}
if
(
argResult
==
null
)
{
return
this
.
value
=
new
cError
(
cErrorType
.
wrong_value_type
);
}
else
{
if
(
nTrueValues
%
2
){
argResult
=
new
cBool
(
true
);
}
else
{
argResult
=
new
cBool
(
false
);
}
}
return
this
.
value
=
argResult
;
};
cXOR
.
prototype
.
getInfo
=
function
()
{
return
{
name
:
this
.
name
,
args
:
"
(logical1, logical2, ...)
"
};
};
})(
window
);
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