org.jacoco.core.analysis
Class AbstractCounter

java.lang.Object
  extended by org.jacoco.core.analysis.AbstractCounter
All Implemented Interfaces:
ICounter
Direct Known Subclasses:
CounterImpl, LinesImpl

public abstract class AbstractCounter
extends Object
implements ICounter

Base class for ICounter implementations.

Version:
$Revision: $
Author:
Marc R. Hoffmann

Field Summary
protected  int covered
          covered number of items
protected  int total
          total number of items
 
Constructor Summary
protected AbstractCounter(int total, int covered)
          Creates a instance with the given numbers.
 
Method Summary
 boolean equals(Object obj)
           
 int getCoveredCount()
          Returns the total count of covered items.
 double getCoveredRatio()
          Calculates the ratio of covered to total count items.
 int getNotCoveredCount()
          Returns the total count of items not covered.
 double getNotCoveredRatio()
          Calculates the ratio of not covered to total count items.
 int getTotalCount()
          Returns the total count of instrumented items.
 int hashCode()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

total

protected int total
total number of items


covered

protected int covered
covered number of items

Constructor Detail

AbstractCounter

protected AbstractCounter(int total,
                          int covered)
Creates a instance with the given numbers.

Parameters:
total - number of total items
covered - number of covered items
Method Detail

getTotalCount

public int getTotalCount()
Description copied from interface: ICounter
Returns the total count of instrumented items.

Specified by:
getTotalCount in interface ICounter
Returns:
total count of instrumented items

getCoveredCount

public int getCoveredCount()
Description copied from interface: ICounter
Returns the total count of covered items.

Specified by:
getCoveredCount in interface ICounter
Returns:
total count of covered items

getNotCoveredCount

public int getNotCoveredCount()
Description copied from interface: ICounter
Returns the total count of items not covered.

Specified by:
getNotCoveredCount in interface ICounter
Returns:
total count of items not covered

getCoveredRatio

public double getCoveredRatio()
Description copied from interface: ICounter
Calculates the ratio of covered to total count items. If total count items is 0 this method returns NaN.

Specified by:
getCoveredRatio in interface ICounter
Returns:
ratio of covered to total count items

getNotCoveredRatio

public double getNotCoveredRatio()
Description copied from interface: ICounter
Calculates the ratio of not covered to total count items. If total count items is 0 this method returns NaN.

Specified by:
getNotCoveredRatio in interface ICounter
Returns:
ratio of not covered to total count items

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object