org.jacoco.core.analysis
Class CounterImpl

java.lang.Object
  extended by org.jacoco.core.analysis.AbstractCounter
      extended by org.jacoco.core.analysis.CounterImpl
All Implemented Interfaces:
ICounter

public abstract class CounterImpl
extends AbstractCounter

ICounter implementations. Implementing a factory pattern allows to share counter instances.

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

Field Summary
static CounterImpl COUNTER_0_0
          Constant for Counter with 0/0 values.
 
Fields inherited from class org.jacoco.core.analysis.AbstractCounter
covered, total
 
Constructor Summary
protected CounterImpl(int total, int covered)
          Creates a new instance with the given figures.
 
Method Summary
static CounterImpl getInstance(boolean covered)
          Factory method to retrieve a counter for a single item.
static CounterImpl getInstance(ICounter counter)
          Factory method to retrieve a clone ot the given counter.
static CounterImpl getInstance(int total, boolean covered)
          Factory method to retrieve a counter with the given number of items.
static CounterImpl getInstance(int total, int covered)
          Factory method to retrieve a counter with the given number of items.
abstract  CounterImpl increment(ICounter counter)
          Returns a counter with values incremented by the numbers of the given counter.
 
Methods inherited from class org.jacoco.core.analysis.AbstractCounter
equals, getCoveredCount, getCoveredRatio, getNotCoveredCount, getNotCoveredRatio, getTotalCount, hashCode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

COUNTER_0_0

public static final CounterImpl COUNTER_0_0
Constant for Counter with 0/0 values.

Constructor Detail

CounterImpl

protected CounterImpl(int total,
                      int covered)
Creates a new instance with the given figures.

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

getInstance

public static CounterImpl getInstance(int total,
                                      int covered)
Factory method to retrieve a counter with the given number of items.

Parameters:
total - total number of items
covered - covered number of items
Returns:
counter instance

getInstance

public static CounterImpl getInstance(ICounter counter)
Factory method to retrieve a clone ot the given counter.

Parameters:
counter - counter to copy
Returns:
counter instance

getInstance

public static CounterImpl getInstance(int total,
                                      boolean covered)
Factory method to retrieve a counter with the given number of items.

Parameters:
total - total number of items
covered - true, if all items are covered
Returns:
counter instance

getInstance

public static CounterImpl getInstance(boolean covered)
Factory method to retrieve a counter for a single item.

Parameters:
covered - true, if the item is covered
Returns:
counter instance

increment

public abstract CounterImpl increment(ICounter counter)
Returns a counter with values incremented by the numbers of the given counter. It is up to the implementation whether this counter instance is modified or a new instance is returned.

Parameters:
counter - number of additional total and covered items
Returns:
counter instance with incremented values