1 package net.sourceforge.selfesteem;
2
3 import java.util.Iterator;
4
5 public class StoryNode extends CompositeNode {
6 public StoryNode(String name) {
7 super(name);
8 }
9
10 public String toString() {
11 return getName() + " - (" + percent("tests") + ")";
12 }
13
14 public void serialize(Serializer serializer, int level) {
15 // not the most efficient algorithm, but...who cares
16 serializer.addLine(level, toString());
17
18 int pass = getPassingChildCount();
19 if (pass > 0) {
20 serializer.addLine(level + 1, "Passing Tests");
21 for (Iterator i = iterator(); i.hasNext();) {
22 Node node = (Node) i.next();
23 if (node.isPassing()) {
24 node.serialize(serializer, level + 2);
25 }
26 }
27 }
28
29 if (_list.size() - pass > 0) {
30 serializer.addLine(level + 1, "Failing Tests");
31 for (Iterator i = iterator(); i.hasNext();) {
32 Node node = (Node) i.next();
33 if (!node.isPassing()) {
34 node.serialize(serializer, level + 2);
35 }
36 }
37 }
38 }
39 }
This page was automatically generated by Maven