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
5a51bd62
Commit
5a51bd62
authored
Sep 18, 2017
by
Tobias Meuser
Browse files
Changed all cache entries to PointInformation
parent
f609c951
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/de/tud/kom/p2psim/impl/vehicular/caching/DefaultCachingComponent.java
View file @
5a51bd62
...
...
@@ -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
<>());
}
...
...
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