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
Simonstrator
PeerfactSim.KOM
Commits
6d39106a
Commit
6d39106a
authored
May 02, 2018
by
Tobias Meuser
Browse files
Added smart aggregation at server side
parent
1eff65ac
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/de/tud/kom/p2psim/impl/vehicular/caching/DefaultCachingComponent.java
View file @
6d39106a
...
...
@@ -55,6 +55,8 @@ implements CachingComponent, ConnectivityListener {
private
CacheDecisionStrategy
_decisionStrategy
;
private
int
_minObservations
=
0
;
private
double
[]
informationRatios
=
new
double
[]
{
1
,
0.75
,
0.5
,
0.25
,
0
};
public
DefaultCachingComponent
(
Host
pHost
,
...
...
@@ -64,8 +66,13 @@ implements CachingComponent, ConnectivityListener {
_host
=
pHost
;
if
(
_host
!=
null
)
{
_host
.
getNetworkComponent
().
getByName
(
NetInterfaceName
.
WIFI
)
.
addConnectivityListener
(
this
);
NetInterface
wifi
=
_host
.
getNetworkComponent
().
getByName
(
NetInterfaceName
.
WIFI
);
if
(
wifi
!=
null
)
{
wifi
.
addConnectivityListener
(
this
);
}
else
{
NetInterface
cellular
=
_host
.
getNetworkComponent
().
getByName
(
NetInterfaceName
.
MOBILE
);
cellular
.
addConnectivityListener
(
this
);
}
}
_invalidationStrategy
=
pInvalidationStrategy
;
...
...
@@ -99,15 +106,21 @@ implements CachingComponent, ConnectivityListener {
for
(
Map
<
Class
<?
extends
Object
>,
List
<
PointInformation
>>
similarEdges
:
similarCacheEntries
.
values
())
{
for
(
List
<
PointInformation
>
similarInformation
:
similarEdges
.
values
())
{
PointInformation
correctInformation
=
_decisionStrategy
.
decideOnCorrectInformation
(
similarInformation
);
decidedInformation
.
add
((
T
)
correctInformation
);
if
(
similarInformation
.
size
()
>=
_minObservations
)
{
PointInformation
correctInformation
=
_decisionStrategy
.
decideOnCorrectInformation
(
similarInformation
);
decidedInformation
.
add
((
T
)
correctInformation
);
}
}
}
return
decidedInformation
;
}
public
void
setMinObservations
(
int
pMinObservations
)
{
this
.
_minObservations
=
pMinObservations
;
}
@Override
public
<
T
extends
PointInformation
>
List
<
T
>
getCacheEntries
(
...
...
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