Commit 0a1cfdb4 authored by Tobias Meuser's avatar Tobias Meuser
Browse files

First working version of privacy-aware offloading

parent 040822f5
......@@ -13,6 +13,7 @@ public class PrivacyLevel implements Comparable<PrivacyLevel> {
private final int id;
private double imprecisionAreaRadius;
private int[] responsibility = new int[0];
@XMLConfigurableConstructor({ "imprecision" })
public PrivacyLevel(double pImprecisionAreaRadius) {
......@@ -22,6 +23,24 @@ public class PrivacyLevel implements Comparable<PrivacyLevel> {
imprecisionAreaRadius = pImprecisionAreaRadius;
}
@XMLConfigurableConstructor({ "imprecision", "responsibility" })
public PrivacyLevel(double pImprecisionAreaRadius, String responsibility) {
synchronized (PrivacyLevel.class) {
id = staticID++;
}
imprecisionAreaRadius = pImprecisionAreaRadius;
String[] responsibilityLevels;
if (responsibility.contains(";")) {
responsibilityLevels = responsibility.split(";");
} else {
responsibilityLevels = new String[0];
}
this.responsibility = new int[responsibilityLevels.length];
for (int i = 0; i < responsibilityLevels.length; i++) {
this.responsibility[i] = Integer.valueOf(responsibilityLevels[i]);
}
}
public int getId() {
return id;
}
......@@ -35,6 +54,19 @@ public class PrivacyLevel implements Comparable<PrivacyLevel> {
return id;
}
public void setResponsibility(int[] responsibility) {
this.responsibility = responsibility;
}
public boolean isResponsible(int pState) {
for (int i = 0; i < responsibility.length; i++) {
if (responsibility[i] == pState) {
return true;
}
}
return false;
}
@Override
public boolean equals(Object pObj) {
if (pObj instanceof PrivacyLevel) {
......
......@@ -33,7 +33,7 @@ import de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.Road
* @version 1.0.0
*
*/
public interface VehicularRelevanceCalculationComponent extends HostComponent {
public interface VehicularRelevanceCalculationComponent extends HostComponent, RelevanceCalculationComponent {
public enum PositionRepresentation {
ROAD_BASED, LOCATION_BASED
}
......
......@@ -21,16 +21,27 @@
package de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.benefit;
import de.tudarmstadt.maki.simonstrator.api.common.graph.INodeID;
import de.tudarmstadt.maki.simonstrator.api.component.sensor.location.Location;
public class NodeProperties {
private final INodeID _id;
private final Location _location;
public NodeProperties(INodeID pId) {
this(pId, null);
}
public NodeProperties(INodeID pId, Location pLocation) {
_id = pId;
_location = pLocation;
}
public INodeID getId() {
return _id;
}
public Location getLocation() {
return _location;
}
}
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