Folge dem Video um zu sehen, wie unsere Website als Web-App auf dem Startbildschirm installiert werden kann.
Anmerkung: Diese Funktion ist in einigen Browsern möglicherweise nicht verfügbar.
public class DtNetz implements Serializable {
private static final long serialVersionUID = 1L;
private HashMap<String, DtHalt> haltlist = new HashMap<String, DtHalt>();
//Der Stirng ist eine "ID"....
public DtNetz() {
}
}
public class DtHalt implements Serializable {
private static final long serialVersionUID = 1L;
private String attribut_1;
private String attribut_2;
private String attribut_3;
private transient GeoPosition geoPosition;
private HashMap<DtHalt, DtKante> hm_connected_to = new HashMap<DtHalt, DtKante>();
public DtHalt() {
}
}
public class DtKante implements Serializable {
private Integer distance = null;
private ArrayList<String> al_1 = new ArrayList();
public void DtKante() {
}
}
at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:78)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:157)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:148)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.visit(AbstractReflectionConverter.java:118)
at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:129)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:100)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:58)
at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68)
at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:78)
at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:63)
at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeItem(AbstractCollectionConverter.java:64)
at com.thoughtworks.xstream.converters.collections.MapConverter.marshal(MapConverter.java:57)
at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68)
at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:78)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:157)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:148)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.visit(AbstractReflectionConverter.java:118)
at
fos = new FileOutputStream("Netz.xml");
BufferedOutputStream bos = new BufferedOutputStream(fos);
XStream xstream = new XStream();
xstream.setMode(XStream.XPATH_ABSOLUTE_REFERENCES);
xstream.toXML(hm_Halte, bos);
import java.io.BufferedOutputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.thoughtworks.xstream.XStream;
public class XStreamTest {
public static void main(String[] args) throws IOException {
final Graph graph = new Graph();
final Node a = graph.addNode("a");
final Node b = graph.addNode("b");
final Node c = graph.addNode("c");
new Edge(a, b);
new Edge(b, c);
new Edge(c, a);
final FileOutputStream fos = new FileOutputStream("Netz.xml");
final BufferedOutputStream bos = new BufferedOutputStream(fos);
final XStream xstream = new XStream();
xstream.alias("edge", Edge.class);
xstream.alias("node", Node.class);
xstream.alias("graph", Graph.class);
xstream.setMode(XStream.XPATH_ABSOLUTE_REFERENCES);
xstream.toXML(graph, bos);
bos.close();
}
public static final class Graph {
private final Map<String, Node> graph = new HashMap<String, Node>();
public Node addNode(String name) {
final Node node = new Node(name);
graph.put(name, node);
return node;
}
}
public static final class Edge {
private final Node inNode;
private final Node outNode;
public Edge(final Node inNode, final Node outNode) {
this.inNode = inNode;
this.outNode = outNode;
inNode.addOutEdge(this);
outNode.addInEdge(this);
}
}
public static final class Node {
private final List<Edge> inEdges = new ArrayList<Edge>();
private final List<Edge> outEdges = new ArrayList<Edge>();
private final String name;
public Node(String name) {
this.name = name;
}
public final void addInEdge(Edge edge) {
this.inEdges.add(edge);
}
public final void addOutEdge(Edge edge) {
this.outEdges.add(edge);
}
}
}