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
97c0ed5e
Commit
97c0ed5e
authored
Dec 15, 2018
by
Tobias Meuser
Browse files
Working version for attacker scenario
parent
345fec46
Changes
1
Show whitespace changes
Inline
Side-by-side
src/de/tud/kom/p2psim/impl/vehicular/caching/DefaultCachingComponent.java
View file @
97c0ed5e
...
...
@@ -28,11 +28,10 @@ import java.util.Map.Entry;
import
java.util.Set
;
import
de.tudarmstadt.maki.simonstrator.api.Host
;
import
de.tudarmstadt.maki.simonstrator.api.
Time
;
import
de.tudarmstadt.maki.simonstrator.api.
common.graph.INodeID
;
import
de.tudarmstadt.maki.simonstrator.api.component.ComponentNotAvailableException
;
import
de.tudarmstadt.maki.simonstrator.api.component.network.NetInterface
;
import
de.tudarmstadt.maki.simonstrator.api.component.network.NetworkComponent.NetInterfaceName
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.RoadProperty
;
import
de.tudarmstadt.maki.simonstrator.api.component.transition.TransitionEngine
;
import
de.tudarmstadt.maki.simonstrator.api.component.transport.ConnectivityListener
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.VehicleInformationComponent
;
...
...
@@ -50,7 +49,6 @@ import de.tudarmstadt.maki.simonstrator.api.component.vehicular.information.Road
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.RoadNetwork
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.RoadNetworkEdge
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.RoadNetworkRoute
;
import
de.tudresden.sumo.cmd.Simulation
;
public
class
DefaultCachingComponent
implements
CachingComponent
,
ConnectivityListener
{
...
...
@@ -158,6 +156,12 @@ public class DefaultCachingComponent implements CachingComponent, ConnectivityLi
@Override
public
<
T
extends
PointInformation
>
List
<
T
>
getDecidedCacheEntries
(
Class
<
T
>
pCacheEntryClass
,
Class
<?>
pCacheValueClass
,
RoadNetworkEdge
pEdge
)
{
return
getDecidedCacheEntries
(
pCacheEntryClass
,
pCacheValueClass
,
pEdge
,
null
);
}
@Override
public
<
T
extends
PointInformation
>
List
<
T
>
getDecidedCacheEntries
(
Class
<
T
>
pCacheEntryClass
,
Class
<?>
pCacheValueClass
,
RoadNetworkEdge
pEdge
,
INodeID
pWithoutID
)
{
CacheDecisionStrategy
decisionStrategy
=
getCacheDecisionStrategy
(
pCacheEntryClass
);
Set
<
RoadNetworkEdge
>
allEverActiveEdges
=
RoadNetwork
.
CURRENT_ROAD_NETWORK
.
getAllEverActiveEdges
();
...
...
@@ -174,6 +178,7 @@ public class DefaultCachingComponent implements CachingComponent, ConnectivityLi
Map
<
Class
<?
extends
Object
>,
List
<
PointInformation
>>
similarCacheEntries
=
new
HashMap
<>();
for
(
T
t
:
cacheEntries
)
{
if
(
pWithoutID
==
null
||
!
t
.
getAttribute
(
AvailableInformationAttributes
.
OWNER
).
equals
(
pWithoutID
))
{
Object
position
=
getEdgeOrPosition
(
t
);
if
(
position
.
equals
(
pEdge
)
&&
(
pCacheValueClass
==
null
||
t
.
getValue
().
getClass
().
equals
(
pCacheValueClass
)))
{
...
...
@@ -182,7 +187,7 @@ public class DefaultCachingComponent implements CachingComponent, ConnectivityLi
}
similarCacheEntries
.
get
(
t
.
getValue
().
getClass
()).
add
(
t
);
}
}
}
List
<
T
>
decidedInformation
=
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