Package org.jacoco.report.check
Class Limit
- java.lang.Object
-
- org.jacoco.report.check.Limit
-
public class Limit extends java.lang.ObjectDescriptor for a limit which is given by aRule.
-
-
Field Summary
Fields Modifier and Type Field Description private ICoverageNode.CounterEntityentityprivate static java.util.Map<ICoverageNode.CounterEntity,java.lang.String>ENTITY_NAMESprivate java.math.BigDecimalmaximumprivate java.math.BigDecimalminimumprivate ICounter.CounterValuevalueprivate static java.util.Map<ICounter.CounterValue,java.lang.String>VALUE_NAMES
-
Constructor Summary
Constructors Constructor Description Limit()Creates a new instance with the following defaults: counter entity:ICoverageNode.CounterEntity.INSTRUCTIONcounter value:ICounter.CounterValue.COVEREDRATIOminimum: no limit maximum: no limit
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) java.lang.Stringcheck(ICoverageNode node)private java.lang.StringcheckRatioLimit()private java.lang.StringcheckRatioLimit(java.lang.String minmax, java.math.BigDecimal v)ICoverageNode.CounterEntitygetEntity()java.lang.StringgetMaximum()java.lang.StringgetMinimum()ICounter.CounterValuegetValue()private java.lang.Stringmessage(java.lang.String minmax, java.math.BigDecimal v, java.math.BigDecimal ref, java.math.RoundingMode mode)private static java.math.BigDecimalparseValue(java.lang.String value)voidsetCounter(java.lang.String entity)Sets the counter entity to check.voidsetMaximum(java.lang.String maximum)Sets the expected maximum value.voidsetMinimum(java.lang.String minimum)Sets the expected minimum value.voidsetValue(java.lang.String value)Sets the value to check.
-
-
-
Field Detail
-
VALUE_NAMES
private static final java.util.Map<ICounter.CounterValue,java.lang.String> VALUE_NAMES
-
ENTITY_NAMES
private static final java.util.Map<ICoverageNode.CounterEntity,java.lang.String> ENTITY_NAMES
-
entity
private ICoverageNode.CounterEntity entity
-
value
private ICounter.CounterValue value
-
minimum
private java.math.BigDecimal minimum
-
maximum
private java.math.BigDecimal maximum
-
-
Constructor Detail
-
Limit
public Limit()
Creates a new instance with the following defaults:- counter entity:
ICoverageNode.CounterEntity.INSTRUCTION - counter value:
ICounter.CounterValue.COVEREDRATIO - minimum: no limit
- maximum: no limit
- counter entity:
-
-
Method Detail
-
getEntity
public ICoverageNode.CounterEntity getEntity()
- Returns:
- the configured counter entity to check
-
setCounter
public void setCounter(java.lang.String entity)
Sets the counter entity to check.- Parameters:
entity- counter entity to check
-
getValue
public ICounter.CounterValue getValue()
- Returns:
- the configured value to check
-
setValue
public void setValue(java.lang.String value)
Sets the value to check.- Parameters:
value- value to check
-
getMinimum
public java.lang.String getMinimum()
- Returns:
- configured minimum value, or
nullif no minimum is given
-
setMinimum
public void setMinimum(java.lang.String minimum)
Sets the expected minimum value. If the minimum refers to a ratio it must be in the range from 0.0 to 1.0 where the number of decimal places will also determine the precision in error messages. A limit ratio may optionally be declared as a percentage where 0.80 and 80% represent the same value.- Parameters:
minimum- allowed minimum ornull, if no minimum should be checked
-
getMaximum
public java.lang.String getMaximum()
- Returns:
- configured maximum value, or
nullif no maximum is given
-
setMaximum
public void setMaximum(java.lang.String maximum)
Sets the expected maximum value. If the maximum refers to a ratio it must be in the range from 0.0 to 1.0 where the number of decimal places will also determine the precision in error messages. A limit ratio may optionally be declared as a percentage where 0.80 and 80% represent the same value.- Parameters:
maximum- allowed maximum ornull, if no maximum should be checked
-
parseValue
private static java.math.BigDecimal parseValue(java.lang.String value)
-
check
java.lang.String check(ICoverageNode node)
-
message
private java.lang.String message(java.lang.String minmax, java.math.BigDecimal v, java.math.BigDecimal ref, java.math.RoundingMode mode)
-
checkRatioLimit
private java.lang.String checkRatioLimit()
-
checkRatioLimit
private java.lang.String checkRatioLimit(java.lang.String minmax, java.math.BigDecimal v)
-
-