//Create all nodes
Set<Node> nodesInDraft = new HashSet<Node>();
int newNodeCount = 0;
for (NodeDraftGetter draftNode : container.getNodes()) {
Node node = null;
String id = draftNode.getId();
String label = draftNode.getLabel();
if (!draftNode.isAutoId() && id != null && map.get(id) != null && !labelmatching) {
node = map.get(id);
} else if (label != null && map.get(label) != null && labelmatching) {
node = map.get(label);
}
TimeInterval timeInterval = null;
if (node == null) {
//Node is new
node = factory.newNode(draftNode.isAutoId() ? null : draftNode.getId());
flushToNode(draftNode, node);
draftNode.setNode(node);
newNodeCount++;
} else {
timeInterval = (TimeInterval) node.getNodeData().getAttributes().getValue(nodeDynamicColumn.getIndex());
flushToNodeAttributes(draftNode, node);
draftNode.setNode(node);
}
nodesInDraft.add(node);
//Add Point
node.getNodeData().getAttributes().setValue(nodeDynamicColumn.getIndex(), addPoint(timeInterval, point));
}
//Push nodes in data structure
for (NodeDraftGetter draftNode : container.getNodes()) {
Node n = draftNode.getNode();
NodeDraftGetter[] parents = draftNode.getParents();
if (parents != null) {
for (int i = 0; i < parents.length; i++) {
Node parent = parents[i].getNode();
graph.addNode(n, parent);
}
} else {
graph.addNode(n);
}
}
//Remove point from all nodes not in draft
for (Node node : graph.getNodes()) {
if (!nodesInDraft.contains(node)) {
TimeInterval timeInterval = (TimeInterval) node.getNodeData().getAttributes().getValue(nodeDynamicColumn.getIndex());
node.getNodeData().getAttributes().setValue(nodeDynamicColumn.getIndex(), removePoint(timeInterval, point));
}
}
//Create all edges and push to data structure
Set<Edge> edgesInDraft = new HashSet<Edge>();
int newEdgeCount = 0;
for (EdgeDraftGetter draftEdge : container.getEdges()) {
Node source = draftEdge.getSource().getNode();
Node target = draftEdge.getTarget().getNode();
Edge edge = graph.getEdge(source, target);
TimeInterval timeInterval = null;
if (edge == null) {
//Edge is new
switch (container.getEdgeDefault()) {