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 compareICounter
objects by different criteria.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description 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.private boolean
reverse
private static long
serialVersionUID
static CounterComparator
TOTALITEMS
Compares the absolute number of total items.private ICounter.CounterValue
value
-
Constructor Summary
Constructors Modifier Constructor Description private
CounterComparator(ICounter.CounterValue value)
private
CounterComparator(ICounter.CounterValue value, boolean reverse)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compare(ICounter c1, ICounter c2)
NodeComparator
on(ICoverageNode.CounterEntity entity)
Creates a new comparator forICoverageNode
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.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
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.
-
value
private final ICounter.CounterValue value
-
reverse
private final boolean reverse
-
-
Constructor Detail
-
CounterComparator
private CounterComparator(ICounter.CounterValue value)
-
CounterComparator
private CounterComparator(ICounter.CounterValue value, boolean reverse)
-
-
Method Detail
-
compare
public int compare(ICounter c1, ICounter c2)
- Specified by:
compare
in interfacejava.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 forICoverageNode
counters of the given entity based on this counter sorting criteria.- Parameters:
entity
- counter entity to sort on- Returns:
- comparator for
ICoverageNode
elements
-
-