Commit 97c0ed5e authored by Tobias Meuser's avatar Tobias Meuser
Browse files

Working version for attacker scenario

parent 345fec46
......@@ -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<>();
......
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