This commit is contained in:
Mikael Capelle
2018-02-16 15:29:11 +01:00
parent 65c81b9921
commit cfb59ac0f1
37 changed files with 1511 additions and 473 deletions

View File

@@ -0,0 +1,37 @@
package org.insa.algo.weakconnectivity;
import java.io.PrintStream;
import java.util.ArrayList;
import org.insa.graph.Node;
public class WeaklyConnectedComponentTextObserver extends WeaklyConnectedComponentObserver {
// Number of the current component.
private int numComponent = 1;
// Output stream
PrintStream stream;
public WeaklyConnectedComponentTextObserver(PrintStream stream) {
super(false);
this.stream = stream;
}
@Override
public void notifyStartComponent(Node curNode) {
stream.print("Entering component #" + numComponent + " from node #" + curNode.getId() + "... ");
}
@Override
public void notifyNewNodeInComponent(Node node) {
}
@Override
public void notifyEndComponent(ArrayList<Node> nodes) {
stream.println(nodes.size() + " nodes found.");
stream.flush();
numComponent += 1;
}
}