org.quilt.cover.seg
Class Segment

java.lang.Object
  |
  +--org.quilt.cover.seg.Segment

public class Segment
extends java.lang.Object

A segment for coverage purposes. It has an index and visit count, and 'from' and 'to', which will typically be line numbers or indices of some sort.


Constructor Summary
Segment()
          No-arg constructor; creates a segment with -1 index.
Segment(int n)
          Constructor specifying a segment index.
 
Method Summary
protected  Segment add(Segment seg)
          Add the visit count from another segment.
 int getFrom()
          Get the 'from' value.
 int getIndex()
          Get the (ideally unique) index of the segment.
 int getTo()
          Get the 'to' value.
 int getVisits()
          Get the number of visits so far.
 void reset()
          Set the number of visits to zero.
 void setFrom(int n)
          Set the 'from' value.
 void setIndex(int n)
          Set the segment index.
 void setTo(int n)
          Set the 'to' value.
 void setVisits(int n)
          Set the number of visits; may never be used.
 java.lang.String toString()
          Format the segment for output as a String.
 java.lang.String toXML(java.lang.String type)
          Format the segment for XML output.
 void visit()
          Step the visit count.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Segment

public Segment()
No-arg constructor; creates a segment with -1 index.


Segment

public Segment(int n)
Constructor specifying a segment index.

Parameters:
n - The index; should be non-negative.
Method Detail

getFrom

public int getFrom()
Get the 'from' value.


setFrom

public void setFrom(int n)
Set the 'from' value.


getIndex

public int getIndex()
Get the (ideally unique) index of the segment.


setIndex

public void setIndex(int n)
Set the segment index.


getTo

public int getTo()
Get the 'to' value.


setTo

public void setTo(int n)
Set the 'to' value.


getVisits

public int getVisits()
Get the number of visits so far.


reset

public void reset()
Set the number of visits to zero.


setVisits

public void setVisits(int n)
Set the number of visits; may never be used.


add

protected Segment add(Segment seg)
Add the visit count from another segment.

Parameters:
seg - Reference to the other segment.

visit

public void visit()
Step the visit count.


toXML

public java.lang.String toXML(java.lang.String type)
Format the segment for XML output.

Parameters:
type - String whose value is appropriate for an XML element name.

toString

public java.lang.String toString()
Format the segment for output as a String.

Overrides:
toString in class java.lang.Object


Copyright © 2001-2003 Apache Software Foundation. All Rights Reserved.