return getSnapshotGraph(new Interval(low, high), Estimator.FIRST);
}
@Override
public Graph getSnapshotGraph(Interval interval, Estimator estimator) {
Graph graph = model.getGraph(sourceView);
Graph vgraph = model.getGraph(currentView);
graph.writeLock();
if (attributeModel.getNodeTable().hasColumn(DynamicModel.TIMEINTERVAL_COLUMN)) {
for (Node n : graph.getNodes().toArray()) {
TimeInterval ti = (TimeInterval) n.getNodeData().getAttributes().getValue(DynamicModel.TIMEINTERVAL_COLUMN);
if (ti == null && !vgraph.contains(n)) {
vgraph.addNode(n);
} else if (ti != null) {
boolean isInRange = ti.isInRange(interval);
boolean isInGraph = vgraph.contains(n);
if (!isInRange && isInGraph) {
vgraph.removeNode(n);
} else if (isInRange && !isInGraph) {
vgraph.addNode(n);
}
}
}
}
if (attributeModel.getEdgeTable().hasColumn(DynamicModel.TIMEINTERVAL_COLUMN)) {
for (Edge e : graph.getEdges().toArray()) {
TimeInterval ti = (TimeInterval) e.getEdgeData().getAttributes().getValue(DynamicModel.TIMEINTERVAL_COLUMN);
if (ti == null && !vgraph.contains(e)
&& vgraph.contains(e.getSource()) && vgraph.contains(e.getTarget())) {
vgraph.addEdge(e);
} else if (ti != null) {
boolean isInRange = ti.isInRange(interval);
boolean isInGraph = vgraph.contains(e);
if (!isInRange && isInGraph) {
vgraph.removeEdge(e);
} else if (isInRange && !isInGraph && vgraph.contains(e.getSource()) && vgraph.contains(e.getTarget())) {
vgraph.addEdge(e);
}
}
}
}
graph.writeUnlock();