Commit 20e2dc83 authored by Tobias Meuser's avatar Tobias Meuser
Browse files

Made the serializable classes xml-serializable

parent e5a2181d
...@@ -26,13 +26,22 @@ import java.util.HashMap; ...@@ -26,13 +26,22 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
public class SerializableRoadNetwork implements Serializable { public class SerializableRoadNetwork implements Serializable {
/** /**
* *
*/ */
private static final long serialVersionUID = -8523360385937842443L; private static final long serialVersionUID = -8523360385937842443L;
@XmlElement(name = "roadNetwork")
private Map<String, SerializableRoadNetworkEdge> _roadNetwork; private Map<String, SerializableRoadNetworkEdge> _roadNetwork;
private SerializableRoadNetwork() {
}
public SerializableRoadNetwork(RoadNetwork pRoadNetwork) { public SerializableRoadNetwork(RoadNetwork pRoadNetwork) {
_roadNetwork = new HashMap<>(); _roadNetwork = new HashMap<>();
for (RoadNetworkEdge edge : pRoadNetwork.getAvailableEdges()) { for (RoadNetworkEdge edge : pRoadNetwork.getAvailableEdges()) {
......
...@@ -25,20 +25,30 @@ import java.util.ArrayList; ...@@ -25,20 +25,30 @@ import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import javax.xml.bind.annotation.XmlElement;
public class SerializableRoadNetworkEdge implements Serializable { public class SerializableRoadNetworkEdge implements Serializable {
/** /**
* *
*/ */
private static final long serialVersionUID = -311466941428215723L; private static final long serialVersionUID = -311466941428215723L;
@XmlElement(name = "edgeID")
private String _edgeID; private String _edgeID;
@XmlElement(name = "angle")
private double _angle; private double _angle;
@XmlElement(name = "lanes")
private List<SerializableRoadNetworkLane> _lanes = new ArrayList<>(); private List<SerializableRoadNetworkLane> _lanes = new ArrayList<>();
@XmlElement(name = "maxSpeed")
private double _maxSpeed = 0; private double _maxSpeed = 0;
private List<String> _accessibleEdgeIDs = new ArrayList<>(); private List<String> _accessibleEdgeIDs = new ArrayList<>();
private SerializableRoadNetworkEdge() {
}
public SerializableRoadNetworkEdge(RoadNetworkEdge pEdge) { public SerializableRoadNetworkEdge(RoadNetworkEdge pEdge) {
_edgeID = pEdge.getEdgeID(); _edgeID = pEdge.getEdgeID();
_angle = pEdge.getAngle(); _angle = pEdge.getAngle();
......
...@@ -22,13 +22,20 @@ package de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork; ...@@ -22,13 +22,20 @@ package de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork;
import java.io.Serializable; import java.io.Serializable;
import javax.xml.bind.annotation.XmlElement;
public class SerializableRoadNetworkLane implements Serializable { public class SerializableRoadNetworkLane implements Serializable {
/** /**
* *
*/ */
private static final long serialVersionUID = 1504425570955552005L; private static final long serialVersionUID = 1504425570955552005L;
@XmlElement(name = "laneID")
private String _laneID; private String _laneID;
private SerializableRoadNetworkLane() {
}
public SerializableRoadNetworkLane(RoadNetworkLane pLane) { public SerializableRoadNetworkLane(RoadNetworkLane pLane) {
_laneID = pLane.getLaneID(); _laneID = pLane.getLaneID();
} }
......
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