SetView<String> removedInNew = Sets.difference(oldKeys, newKeys);
SetView<String> addedInNew = Sets.difference(newKeys, oldKeys);
Map<String, Vertex> resultingVertexMap = Maps.newHashMap();
for(String s : removedInNew) {
Vertex v = oldVertexMap.get(s);
v.addStyleClass(STYLE_Removed);
v.setStyles(labelStyleForResource(catalogMap.get(v), oldRoot, null, null, new String[1]));
resultingVertexMap.put(s, v);
g.addVertex(v);
}
for(String s : addedInNew) {
Vertex v = newVertexMap.get(s);
v.addStyleClass(STYLE_Added);
v.setStyles(labelStyleForResource(null, null, catalogMap.get(v), newRoot, new String[1]));
resultingVertexMap.put(s, v);
g.addVertex(v);
}
for(String s : inBoth) {
Vertex vOld = oldVertexMap.get(s);
Vertex vNew = newVertexMap.get(s);
Vertex v = new Vertex("", STYLE_Resource);
String computedStyle[] = new String[1];
v.setStyles(labelStyleForResource(
catalogMap.get(vOld), oldRoot, catalogMap.get(vNew), newRoot, computedStyle));
v.addStyleClass(computedStyle[0]);
resultingVertexMap.put(s, v);
g.addVertex(v);
}
// Process Edges