net.sourceforge.cobertura.coveragedata
Class LineData

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

public class LineData
extends java.lang.Object
implements java.lang.Comparable, CoverageData, HasBeenInstrumented, java.io.Serializable

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 hits
           
private  java.util.List jumps
           
private  int lineNumber
           
private  java.util.concurrent.locks.Lock lock
           
private  java.lang.String methodDescriptor
           
private  java.lang.String methodName
           
private static long serialVersionUID
           
private  java.util.List switches
           
 
Constructor Summary
LineData(int lineNumber)
           
LineData(int lineNumber, java.lang.String methodName, java.lang.String methodDescriptor)
           
 
Method Summary
(package private)  void addJump(int jumpNumber)
           
(package private)  void addSwitch(int switchNumber, int[] keys)
           
(package private)  void addSwitch(int switchNumber, int min, int max)
           
 int compareTo(java.lang.Object o)
          This is required because we implement Comparable.
 boolean equals(java.lang.Object obj)
           
private  void getBothLocks(LineData other)
           
 double getBranchCoverageRate()
           
 java.lang.String getConditionCoverage()
           
 java.lang.String getConditionCoverage(int index)
           
 java.lang.Object getConditionData(int index)
           
 int getConditionSize()
           
 long getHits()
           
(package private)  JumpData getJumpData(int jumpNumber)
           
 double getLineCoverageRate()
           
 int getLineNumber()
           
 java.lang.String getMethodDescriptor()
           
 java.lang.String getMethodName()
           
 int getNumberOfCoveredBranches()
           
 int getNumberOfCoveredLines()
           
 int getNumberOfValidBranches()
           
 int getNumberOfValidLines()
           
(package private)  SwitchData getSwitchData(int switchNumber, SwitchData data)
           
 boolean hasBranch()
           
 int hashCode()
           
private  void initLock()
           
 boolean isCovered()
           
 void merge(CoverageData coverageData)
          Warning: This is generally implemented as a "shallow" merge.
private  void readObject(java.io.ObjectInputStream in)
           
(package private)  void setMethodNameAndDescriptor(java.lang.String name, java.lang.String descriptor)
           
(package private)  void touch(int new_hits)
           
(package private)  void touchJump(int jumpNumber, boolean branch, int hits)
           
(package private)  void touchSwitch(int switchNumber, int branch, int hits)
           
 
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

lock

private transient java.util.concurrent.locks.Lock lock

hits

private long hits

jumps

private java.util.List jumps

switches

private java.util.List switches

lineNumber

private final int lineNumber

methodDescriptor

private java.lang.String methodDescriptor

methodName

private java.lang.String methodName
Constructor Detail

LineData

LineData(int lineNumber)

LineData

LineData(int lineNumber,
         java.lang.String methodName,
         java.lang.String methodDescriptor)
Method Detail

initLock

private void initLock()

compareTo

public int compareTo(java.lang.Object o)
This is required because we implement Comparable.

Specified by:
compareTo in interface java.lang.Comparable

equals

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

getBranchCoverageRate

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

getConditionCoverage

public java.lang.String getConditionCoverage()

getHits

public long getHits()

isCovered

public boolean isCovered()

getLineCoverageRate

public double getLineCoverageRate()
Specified by:
getLineCoverageRate in interface CoverageData

getLineNumber

public int getLineNumber()

getMethodDescriptor

public java.lang.String getMethodDescriptor()

getMethodName

public java.lang.String getMethodName()

getNumberOfCoveredLines

public int getNumberOfCoveredLines()
Specified by:
getNumberOfCoveredLines in interface CoverageData
See Also:
CoverageData.getNumberOfCoveredBranches()

getNumberOfValidBranches

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

getNumberOfCoveredBranches

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

getNumberOfValidLines

public int getNumberOfValidLines()
Specified by:
getNumberOfValidLines in interface CoverageData

hashCode

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

hasBranch

public boolean hasBranch()

merge

public void merge(CoverageData coverageData)
Description copied from interface: CoverageData
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 CoverageData

addJump

void addJump(int jumpNumber)

addSwitch

void addSwitch(int switchNumber,
               int[] keys)

addSwitch

void addSwitch(int switchNumber,
               int min,
               int max)

setMethodNameAndDescriptor

void setMethodNameAndDescriptor(java.lang.String name,
                                java.lang.String descriptor)

touch

void touch(int new_hits)

touchJump

void touchJump(int jumpNumber,
               boolean branch,
               int hits)

touchSwitch

void touchSwitch(int switchNumber,
                 int branch,
                 int hits)

getConditionSize

public int getConditionSize()

getConditionData

public java.lang.Object getConditionData(int index)

getConditionCoverage

public java.lang.String getConditionCoverage(int index)

getJumpData

JumpData getJumpData(int jumpNumber)

getSwitchData

SwitchData getSwitchData(int switchNumber,
                         SwitchData data)

getBothLocks

private void getBothLocks(LineData other)

readObject

private void readObject(java.io.ObjectInputStream in)
                 throws java.io.IOException,
                        java.lang.ClassNotFoundException
Throws:
java.io.IOException
java.lang.ClassNotFoundException