Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openbis
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sispub
openbis
Commits
61a9d65d
Commit
61a9d65d
authored
15 years ago
by
felmer
Browse files
Options
Downloads
Patches
Plain Diff
add sum()
SVN: 14366
parent
13a9b571
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/calculator/StandardFunctions.java
+20
-0
20 additions, 0 deletions
...neric/client/web/server/calculator/StandardFunctions.java
with
20 additions
and
0 deletions
openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/calculator/StandardFunctions.java
+
20
−
0
View file @
61a9d65d
...
...
@@ -116,6 +116,26 @@ final class StandardFunctions
return
condition
!=
null
&&
condition
.
booleanValue
()
?
thenValue
:
elseValue
;
}
/**
* Calculates the sum of the specified values.
* Blank strings or <code>null</code> values in the list are ignored.
*
* @throws NumberFormatException if an element can not be parsed as a floating-point number.
* @throws IllegalArgumentException if the list is empty.
*/
public
static
Double
sum
(
List
<
Object
>
values
)
{
List
<
Double
>
array
=
toDoubleArray
(
values
);
String
functionName
=
"sum"
;
assertNotEmpty
(
array
,
functionName
);
double
sum
=
0.0
;
for
(
double
value
:
array
)
{
sum
+=
value
;
}
return
sum
;
}
/**
* Calculates the mean of the specified values.
* Blank strings or <code>null</code> values in the list are ignored.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment