Commit 6d39106a authored by Tobias Meuser's avatar Tobias Meuser
Browse files

Added smart aggregation at server side

parent 1eff65ac
......@@ -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(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment