net.sourceforge.cobertura.coveragedata
Class SwitchData

java.lang.Object
  extended by net.sourceforge.cobertura.coveragedata.SwitchData
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable, BranchCoverageData, HasBeenInstrumented

public class SwitchData
extends java.lang.Object
implements BranchCoverageData, java.lang.Comparable, java.io.Serializable, HasBeenInstrumented

This class implements HasBeenInstrumented so that when cobertura instruments itself, it will omit this class. It does this to avoid an infinite recursion problem because instrumented classes make use of this class.

See Also:
Serialized Form

Field Summary
private  long defaultHits
           
private  long[] hits
           
private  int[] keys
           
private static long serialVersionUID
           
private  int switchNumber
           
 
Constructor Summary
SwitchData(int switchNumber)
           
SwitchData(int switchNumber, int[] keys)
           
SwitchData(int switchNumber, int min, int max)
           
 
Method Summary
 int compareTo(java.lang.Object o)
           
 boolean equals(java.lang.Object obj)
           
 double getBranchCoverageRate()
           
 long getDefaultHits()
           
 long getHits(int branch)
           
 int getNumberOfCoveredBranches()
           
 int getNumberOfValidBranches()
           
 int getSwitchNumber()
           
 int hashCode()
           
 void merge(BranchCoverageData coverageData)
          Warning: This is generally implemented as a "shallow" merge.
(package private)  void touchBranch(int branch)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

switchNumber

private int switchNumber

defaultHits

private long defaultHits

hits

private long[] hits

keys

private int[] keys
Constructor Detail

SwitchData

public SwitchData(int switchNumber,
                  int[] keys)

SwitchData

public SwitchData(int switchNumber,
                  int min,
                  int max)

SwitchData

public SwitchData(int switchNumber)
Method Detail

compareTo

public int compareTo(java.lang.Object o)
Specified by:
compareTo in interface java.lang.Comparable

touchBranch

void touchBranch(int branch)

getSwitchNumber

public int getSwitchNumber()

getHits

public long getHits(int branch)

getDefaultHits

public long getDefaultHits()

getBranchCoverageRate

public double getBranchCoverageRate()
Specified by:
getBranchCoverageRate in interface BranchCoverageData

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

getNumberOfCoveredBranches

public int getNumberOfCoveredBranches()
Specified by:
getNumberOfCoveredBranches in interface BranchCoverageData

getNumberOfValidBranches

public int getNumberOfValidBranches()
Specified by:
getNumberOfValidBranches in interface BranchCoverageData

merge

public void merge(BranchCoverageData coverageData)
Description copied from interface: BranchCoverageData
Warning: This is generally implemented as a "shallow" merge. For our current use, this should be fine, but in the future it may make sense to modify the merge methods of the various classes to do a deep copy of the appropriate objects.

Specified by:
merge in interface BranchCoverageData