this.listenForUpdates = listenForUpdates;
}
public void process() {
GraphUpdatedListener gul = new GraphUpdatedListener();
if(listenForUpdates) {
igc.getGraph().addGraphListener(gul);
}
while(true) {
Set<AbstractIntermediate> snapshot = new HashSet<AbstractIntermediate>();
snapshot.addAll(igc.getGraph().vertexSet());
for(AbstractIntermediate vertex : snapshot) {
if(igc.getGraph().containsVertex(vertex)) {
vertex.accept(this);
}
}
//reset the update listener.
if(!gul.isUpdated()) {
break;
}
else {
gul.reset();
}
}
igc.getGraph().removeGraphListener(gul);
}