Deque<Pair> stack = new ArrayDeque<Pair>();
for (AbstractTCGEdge edge : atcg.getInitialNode().getOutgoing()) {
stack.add(new Pair(edge, new Integer(0)));
}
AbstractTCGNode currentNode = atcg.getInitialNode();
Pair currentEdge;
Path currentPath = TestCaseGraphRuntimeFactory.eINSTANCE.createPath();
while (!stack.isEmpty()
&& (result.size() <= maxNoPaths || maxNoPaths == -1)) {
currentEdge = stack.removeFirst();
while (currentEdge.getSecond() != currentPath.getEdges().size()) {
EList<AbstractTCGEdge> l = currentPath.getEdges();
AbstractTCGEdge e = l.remove(l.size() - 1);
// retreat
currentNode = e.getSource();
}
if (!currentNode.equals(currentEdge.getFirst().getSource())) {
try {
throw new YouShallNotDoThisException("bullshit");
} catch (YouShallNotDoThisException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
;
currentNode = currentEdge.getFirst().getTarget();
currentPath.getEdges().add(currentEdge.getFirst());
if (currentPath.getEdges().size() <= maxDepth) {
for (AbstractTCGEdge outgoing : currentNode.getOutgoing()) {
stack.addFirst(new Pair(outgoing, new Integer(currentPath
.getEdges().size())));
}
}
if (currentNode.getOutgoing().size() == 0) {
// found final node -> Add path to result
result.add(currentPath);
currentPath = TestCaseGraphRuntimeFactory.eINSTANCE
.createPath();
for (AbstractTCGEdge e : result.get(result.size() - 1)