Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
SimAquaLife
GR3D
Commits
86cb6c8d
Commit
86cb6c8d
authored
Apr 16, 2021
by
patrick.lambert
Browse files
add mean without NaN
parent
44552ff8
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/miscellaneous/QueueMemory.java
View file @
86cb6c8d
...
...
@@ -78,7 +78,7 @@ public class QueueMemory<E extends Number> extends ArrayBlockingQueue<E> {
double
sum
=
0
.;
double
total
=
0
.;
for
(
E
item
:
this
)
{
if
(
this
.
doubleValue
(
item
)
>
0
.)
{
if
(
this
.
doubleValue
(
item
)
!=
0
.)
{
sum
+=
this
.
doubleValue
(
item
);
total
++;
}
...
...
@@ -90,6 +90,23 @@ public class QueueMemory<E extends Number> extends ArrayBlockingQueue<E> {
}
public
double
getMeanWithoutNaN
()
{
double
sum
=
0
.;
double
total
=
0
.;
for
(
E
item
:
this
)
{
Double
value
=
this
.
doubleValue
(
item
);
if
(!
Double
.
isNaN
(
value
))
{
sum
+=
value
;
total
++;
}
}
if
(
total
>
0
)
{
sum
=
sum
/
total
;
}
return
(
sum
);
}
public
double
getGeometricMean
()
{
double
sum
=
0
.;
for
(
E
item
:
this
)
{
...
...
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