}
}
}
private GraphEvent createEvent(AbstractEvent event, List<Object> compress) {
final GraphEventDataImpl eventData = (event instanceof GeneralEvent) ? null : new GraphEventDataImpl();
final GraphEventImpl graphEventImpl = new GraphEventImpl(event.getView(), event.getEventType(), eventData);
if (event instanceof NodeEvent) {
Node[] nodes;
if (compress != null) {
nodes = compress.toArray(new Node[0]);
} else {
nodes = new Node[]{(Node) event.getData()};
}
switch (event.getEventType()) {
case ADD_NODES:
eventData.setAddedNodes(nodes);
break;
case REMOVE_NODES:
eventData.setRemovedNodes(nodes);
break;
case EXPAND:
eventData.setExpandedNodes(nodes);
break;
case RETRACT:
eventData.setRetractedNodes(nodes);
break;
case MOVE_NODES:
eventData.setMovedNodes(nodes);
break;
}
} else if (event instanceof EdgeEvent) {
Edge[] edges;
if (compress != null) {
edges = compress.toArray(new Edge[0]);
} else {
edges = new Edge[]{(Edge) event.getData()};
}
switch (event.getEventType()) {
case ADD_EDGES:
eventData.setAddedEdges(edges);
break;
case REMOVE_EDGES:
eventData.setRemovedEdges(edges);
break;
}
} else if (event instanceof ViewEvent) {
eventData.setView((GraphView) event.getData());
}
return graphEventImpl;
}