View Javadoc
1 /*** 2 * This is a helper class to implement a CoverageSegment 3 */ 4 5 package junit.quilt.framework; 6 7 import java.util.Iterator; 8 import java.util.List; 9 10 public class CoverageSegmentImpl 11 implements CoverageSegment 12 { 13 private int VISITS = 0; 14 15 public CoverageSegmentImpl() { } 16 // CoverageSegment 17 public int getNumVisits() { 18 return VISITS; 19 } 20 21 public String getCustomXML() { return ""; } 22 23 public String toXML() { 24 StringBuffer RC = new StringBuffer(); 25 RC.append("<Statement>\n"); 26 RC.append( getCustomXML() ); 27 RC.append("<NumVisits>" + getNumVisits() + "</NumVisits>"); 28 List times = getTimes(); 29 if (times != null) { 30 RC.append(" <Times>\n"); 31 Iterator i = times.iterator(); 32 while (i.hasNext()) { 33 RC.append(" <Time>" + i.next().toString() + "</Time>\n"); 34 } 35 RC.append(" </Times>\n"); 36 } 37 RC.append(" <Advice>" + getAdvice() + "</Advice>\n"); 38 RC.append(" <Description>" + getDescription() + "</Description>\n"); 39 RC.append("</Statement>\n"); 40 return RC.toString(); 41 } 42 43 public List getTimes() { 44 return null; 45 } 46 47 public String getAdvice() { 48 return getDescription(); 49 } 50 51 public String getDescription() { 52 return "Description not available."; 53 } 54 55 public void reset() { 56 VISITS = 0; 57 } 58 // Helper methods. 59 protected void addVisits( int numVisits ) { 60 VISITS += numVisits; 61 } 62 }

This page was automatically generated by Maven