Class EfficientCoverageMap
- java.lang.Object
-
- de.rwth.swc.coffee4j.algorithmic.sequential.generator.ipog.EfficientCoverageMap
-
- All Implemented Interfaces:
CoverageMap
public class EfficientCoverageMap extends Object implements CoverageMap
This acts as the coverage map described in section 4.1 of the paper "An Efficient Design and Implementation of the In-Parameter-Order Algorithm". Basically, it stores the tuples of each possible ParameterCombination as a bitmap with a bijective function to map to and from an index in said bitmap.This uses the index system described in
IpogAlgorithm.
-
-
Constructor Summary
Constructors Constructor Description EfficientCoverageMap(Collection<it.unimi.dsi.fastutil.ints.IntSet> parameterCombinations, int fixedParameter, it.unimi.dsi.fastutil.ints.Int2IntMap parameters, ConstraintChecker constraintChecker)Initializes a new coverage map with the given parameter combinations and the fixed parameter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int[]computeGainsOfFixedParameter(int[] combination)Computes the number of combinations which would be covered if the fixed parameter given in the constructor would be set to a specific value in the given combination.Optional<int[]>getUncoveredCombination()Finds the next uncovered combination and returns it.voidmarkAsCovered(int[] combination)Marks all sub-combinations which can be mapped to one of the given parameter combinations given in the constructor as covered.booleanmayHaveUncoveredCombinations()
-
-
-
Constructor Detail
-
EfficientCoverageMap
public EfficientCoverageMap(Collection<it.unimi.dsi.fastutil.ints.IntSet> parameterCombinations, int fixedParameter, it.unimi.dsi.fastutil.ints.Int2IntMap parameters, ConstraintChecker constraintChecker)
Initializes a new coverage map with the given parameter combinations and the fixed parameter. This means that internally the fixed parameter is added to each parameter combination.- Parameters:
parameterCombinations- the parameter combinations for which the tuple coverage shall be tracked. Must not benullfixedParameter- the parameter added to all parameters. Must not be negativeparameters- the sizes of all parameter. Must contains the sizes of the parameters in all combinations and the fixed parameter. Must not benullconstraintChecker- ConstraintChecker to identify irrelevant combinations- Throws:
NullPointerException- if parameterCombinations or parameters isnullIllegalArgumentException- if one of the other constraints described for each method parameter is not met
-
-
Method Detail
-
mayHaveUncoveredCombinations
public boolean mayHaveUncoveredCombinations()
- Specified by:
mayHaveUncoveredCombinationsin interfaceCoverageMap- Returns:
- whether any combination is not covered
-
markAsCovered
public void markAsCovered(int[] combination)
Marks all sub-combinations which can be mapped to one of the given parameter combinations given in the constructor as covered.- Specified by:
markAsCoveredin interfaceCoverageMap- Parameters:
combination- the combination to mark as covered. Must not benull- Throws:
NullPointerException- if combination isnull
-
computeGainsOfFixedParameter
public int[] computeGainsOfFixedParameter(int[] combination)
Computes the number of combinations which would be covered if the fixed parameter given in the constructor would be set to a specific value in the given combination.- Specified by:
computeGainsOfFixedParameterin interfaceCoverageMap- Parameters:
combination- the base combination in which the gains of the values for the fixed parameter shall be computed. Must not benull- Returns:
- the number of combinations which would additionally be covered
if the fixed parameter was set to a certain value. The index
in the array corresponds to the value index in the parameter
the index is -1 if it refers to an invalid combination Please note: only t-wise invalid combinations are identified! The test input must be checked as well for k>t-wise invalid combinations
- Throws:
NullPointerException- if combination isnull
-
getUncoveredCombination
public Optional<int[]> getUncoveredCombination()
Finds the next uncovered combination and returns it.- Specified by:
getUncoveredCombinationin interfaceCoverageMap- Returns:
- the next uncovered combination in all parameter combination
coverage maps or an empty
Optionalif no combination is uncovered
-
-