Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
SEG 28
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pr1n19
SEG 28
Merge requests
!1
Calculators and main
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Calculators and main
Calculators
into
master
Overview
0
Commits
8
Changes
3
Merged
Jaret Wrintmore
requested to merge
Calculators
into
master
3 years ago
Overview
0
Commits
8
Changes
3
Expand
To unify the naming used for classes
Edited
3 years ago
by
Jaret Wrintmore
0
0
Merge request reports
Viewing commit
538dab31
Prev
Next
Show latest version
3 files
+
31
−
10
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
Search (e.g. *.vue) (Ctrl+P)
538dab31
Uniques interactions first implementation
· 538dab31
Jaret Wrintmore
authored
3 years ago
src/Calculators/MetricCalculator.java
0 → 100644
+
43
−
0
Options
package
Calculators
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
Packets.BounceDefinition
;
import
Packets.ClickInfo
;
import
Packets.CompiledData
;
import
Packets.ServerInfo
;
/**
* Calculate the key metrics needed for graph generation.
*/
public
class
MetricCalculator
{
public
Metrics
calculateMetrics
(
CompiledData
compiledData
,
BounceDefinition
bounceDefinition
)
{
Integer
noOfImpressions
=
compiledData
.
getImpressionInfo
().
size
();
ArrayList
<
ClickInfo
>
clickInfoList
=
compiledData
.
getClickInfo
();
Integer
noOfClicks
=
clickInfoList
.
size
();
//Uniques
ArrayList
<
String
>
ids
=
new
ArrayList
<
String
>();
for
(
ClickInfo
ci
:
clickInfoList
)
{
ids
.
add
(
ci
.
getID
());
}
List
<
String
>
uniqueIds
=
ids
.
stream
().
distinct
().
collect
(
Collectors
.
toList
());
Integer
noOfUniques
=
uniqueIds
.
size
();
//Number of bounces
Integer
noOfBounces
=
0
;
if
(
bounceDefinition
.
getCountsPages
())
{
for
(
ServerInfo
i
:
compiledData
.
getServerInfo
())
{
if
(
i
.
getPages
()
<
bounceDefinition
.
getThreshold
())
{++
noOfBounces
;}
}
}
else
{
for
(
ServerInfo
i
:
compiledData
.
getServerInfo
())
{
if
(
i
.
getDuration
()
<
bounceDefinition
.
getThreshold
())
{++
noOfBounces
;}
}
}
}
}
\ No newline at end of file
Loading