org.jacoco.core.internal.analysis

## Class CounterImpl

- java.lang.Object
- - org.jacoco.core.internal.analysis.CounterImpl

All Implemented Interfaces:
  ICounter

    public abstract class CounterImpl
    extends Object
    implements ICounter

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

### Nested Class Summary

### Nested classes/interfaces inherited from interface org.jacoco.core.analysis.ICounter

`ICounter.CounterValue`

### Field Summary

Fields
`static CounterImpl` `COUNTER_0_0` Constant for Counter with 0/0 values.
`static CounterImpl` `COUNTER_0_1` Constant for Counter with 0/1 values.
`static CounterImpl` `COUNTER_1_0` Constant for Counter with 1/0 values.
`protected int` `covered` number of covered items
`protected int` `missed` number of missed items

### Fields inherited from interface org.jacoco.core.analysis.ICounter

`EMPTY, FULLY_COVERED, NOT_COVERED, PARTLY_COVERED`

### Constructor Summary

Constructors
`protected` `CounterImpl(int missed, int covered)` Creates a new instance with the given numbers.

### Method Summary

All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
`boolean` `equals(Object obj)`
`int` `getCoveredCount()` Returns the count of covered items.
`double` `getCoveredRatio()` Calculates the ratio of covered to total count items.
`static CounterImpl` `getInstance(ICounter counter)` Factory method to retrieve a clone of the given counter.
`static CounterImpl` `getInstance(int missed, int covered)` Factory method to retrieve a counter with the given number of items.
`int` `getMissedCount()` Returns the count of missed items.
`double` `getMissedRatio()` Calculates the ratio of missed to total count items.
`int` `getStatus()` Returns the coverage status of this counter.
`int` `getTotalCount()` Returns the total count of items.
`double` `getValue(ICounter.CounterValue value)` Returns the counter value of the given type.
`int` `hashCode()`
`CounterImpl` `increment(ICounter counter)` Returns a counter with values incremented by the numbers of the given counter.
`abstract CounterImpl` `increment(int missed, int covered)` Returns a counter with values incremented by the given numbers.
`String` `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.

#### COUNTER_1_0

    public static final CounterImpl COUNTER_1_0

Constant for Counter with 1/0 values.

#### COUNTER_0_1

    public static final CounterImpl COUNTER_0_1

Constant for Counter with 0/1 values.

#### missed

    protected int missed

number of missed items

#### covered

    protected int covered

number of covered items

### Constructor Detail

#### CounterImpl

    protected CounterImpl(int missed,
                          int covered)

Creates a new instance with the given numbers.

Parameters:
  `missed` - number of missed items
  `covered` - number of covered items

### Method Detail

#### getInstance

    public static CounterImpl getInstance(int missed,
                                          int covered)

Factory method to retrieve a counter with the given number of items.

Parameters:
  `missed` - number of missed items
  `covered` - number of covered items
Returns:
  counter instance

#### getInstance

    public static CounterImpl getInstance(ICounter counter)

Factory method to retrieve a clone of the given counter.

Parameters:
  `counter` - counter to copy
Returns:
  counter instance

#### increment

    public 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

#### increment

    public abstract CounterImpl increment(int missed,
                                          int covered)

Returns a counter with values incremented by the given numbers. It is up to the implementation whether this counter instance is modified or a new instance is returned.

Parameters:
  `missed` - number of missed items
  `covered` - number of covered items
Returns:
  counter instance with incremented values

#### getValue

    public double getValue(ICounter.CounterValue value)

Description copied from interface: `ICounter`
Returns the counter value of the given type.

Specified by:
  `getValue` in interface `ICounter`
Parameters:
  `value` - value type to return
Returns:
  counter value

#### getTotalCount

    public int getTotalCount()

Description copied from interface: `ICounter`
Returns the total count of items.

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

#### getCoveredCount

    public int getCoveredCount()

Description copied from interface: `ICounter`
Returns the count of covered items.

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

#### getMissedCount

    public int getMissedCount()

Description copied from interface: `ICounter`
Returns the count of missed items.

Specified by:
  `getMissedCount` in interface `ICounter`
Returns:
  count of missed items

#### 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

#### getMissedRatio

    public double getMissedRatio()

Description copied from interface: `ICounter`
Calculates the ratio of missed to total count items. If total count items is 0 this method returns NaN.

Specified by:
  `getMissedRatio` in interface `ICounter`
Returns:
  ratio of missed to total count items

#### getStatus

    public int getStatus()

Description copied from interface: `ICounter`
Returns the coverage status of this counter.

Specified by:
  `getStatus` in interface `ICounter`
Returns:
  status of this line
See Also:
  `ICounter.EMPTY`, `ICounter.NOT_COVERED`, `ICounter.PARTLY_COVERED`, `ICounter.FULLY_COVERED`

#### 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`