Commit 5a51bd62 authored by Tobias Meuser's avatar Tobias Meuser
Browse files

Changed all cache entries to PointInformation

parent f609c951
......@@ -32,9 +32,10 @@ import de.tudarmstadt.maki.simonstrator.api.component.transport.ConnectivityList
import de.tudarmstadt.maki.simonstrator.api.component.vehicular.caching.CachingComponent;
import de.tudarmstadt.maki.simonstrator.api.component.vehicular.caching.invalidation.CacheInvalidationStrategy;
import de.tudarmstadt.maki.simonstrator.api.component.vehicular.caching.replacement.CacheReplacementStrategy;
import de.tudarmstadt.maki.simonstrator.api.component.vehicular.information.PointInformation;
public class DefaultCachingComponent implements CachingComponent, ConnectivityListener {
private Map<Class<? extends Object>, List<Object>> _cache = new HashMap<>();
private Map<Class<? extends Object>, List<PointInformation>> _cache = new HashMap<>();
private Host _host;
private CacheInvalidationStrategy _invalidationStrategy;
......@@ -50,7 +51,7 @@ public class DefaultCachingComponent implements CachingComponent, ConnectivityLi
}
@Override
public <T> List<T> getCacheEntries(Class<T> pCacheEntryClass) {
public <T extends PointInformation> List<T> getCacheEntries(Class<T> pCacheEntryClass) {
if (_cache.containsKey(pCacheEntryClass)) {
List<? extends Object> cacheEntries = _cache.get(pCacheEntryClass);
List<T> results = new ArrayList<>();
......@@ -65,7 +66,7 @@ public class DefaultCachingComponent implements CachingComponent, ConnectivityLi
}
@Override
public <T> boolean containsEntry(T pCacheEntry) {
public <T extends PointInformation> boolean containsEntry(T pCacheEntry) {
if (_cache.containsKey(pCacheEntry)) {
List<? extends Object> cacheEntries = _cache.get(pCacheEntry);
return cacheEntries.contains(pCacheEntry);
......@@ -74,7 +75,7 @@ public class DefaultCachingComponent implements CachingComponent, ConnectivityLi
}
@Override
public <T> void storeCacheEntry(T pCacheEntry) {
public <T extends PointInformation> void storeCacheEntry(T pCacheEntry) {
if (!_cache.containsKey(pCacheEntry.getClass())) {
_cache.put(pCacheEntry.getClass(), new ArrayList<>());
}
......
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