Package org.jacoco.core.analysis

## Class CounterComparator

- java.lang.Object
- - org.jacoco.core.analysis.CounterComparator

All Implemented Interfaces:
  `java.io.Serializable`, `java.util.Comparator<ICounter>`

    public class CounterComparator
    extends java.lang.Object
    implements java.util.Comparator<ICounter>, java.io.Serializable

Collection of comparators to compare `ICounter` objects by different criteria.

See Also:
  Serialized Form

### Field Summary

Fields
`static CounterComparator` `COVEREDITEMS` Compares the absolute number of covered items.
`static CounterComparator` `COVEREDRATIO` Compares the ratio of covered items.
`static CounterComparator` `MISSEDITEMS` Compares the absolute number of missed items.
`static CounterComparator` `MISSEDRATIO` Compares the ratio of missed items.
`static CounterComparator` `TOTALITEMS` Compares the absolute number of total items.

### Method Summary

All Methods Instance Methods Concrete Methods
`int` `compare​(ICounter c1, ICounter c2)`
`NodeComparator` `on​(ICoverageNode.CounterEntity entity)` Creates a new comparator for `ICoverageNode` counters of the given entity based on this counter sorting criteria.
`CounterComparator` `reverse()` Creates a new version of this comparator that sorts in reverse order.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface java.util.Comparator

`equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong`

### Field Detail

#### TOTALITEMS

    public static final CounterComparator TOTALITEMS

Compares the absolute number of total items.

#### COVEREDITEMS

    public static final CounterComparator COVEREDITEMS

Compares the absolute number of covered items.

#### MISSEDITEMS

    public static final CounterComparator MISSEDITEMS

Compares the absolute number of missed items.

#### COVEREDRATIO

    public static final CounterComparator COVEREDRATIO

Compares the ratio of covered items.

#### MISSEDRATIO

    public static final CounterComparator MISSEDRATIO

Compares the ratio of missed items.

### Method Detail

#### compare

    public int compare​(ICounter c1,
                       ICounter c2)

Specified by:
  `compare` in interface `java.util.Comparator<ICounter>`

#### reverse

    public CounterComparator reverse()

Creates a new version of this comparator that sorts in reverse order.

Returns:
  reverse comparator

#### on

    public NodeComparator on​(ICoverageNode.CounterEntity entity)

Creates a new comparator for `ICoverageNode` counters of the given entity based on this counter sorting criteria.

Parameters:
  `entity` - counter entity to sort on
Returns:
  comparator for `ICoverageNode` elements