Class 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 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 be null
        fixedParameter - the parameter added to all parameters. Must not be negative
        parameters - the sizes of all parameter. Must contains the sizes of the parameters in all combinations and the fixed parameter. Must not be null
        constraintChecker - ConstraintChecker to identify irrelevant combinations
        Throws:
        NullPointerException - if parameterCombinations or parameters is null
        IllegalArgumentException - if one of the other constraints described for each method parameter is not met
    • Method Detail

      • mayHaveUncoveredCombinations

        public boolean mayHaveUncoveredCombinations()
        Specified by:
        mayHaveUncoveredCombinations in interface CoverageMap
        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:
        markAsCovered in interface CoverageMap
        Parameters:
        combination - the combination to mark as covered. Must not be null
        Throws:
        NullPointerException - if combination is null
      • 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:
        computeGainsOfFixedParameter in interface CoverageMap
        Parameters:
        combination - the base combination in which the gains of the values for the fixed parameter shall be computed. Must not be null
        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 is null
      • getUncoveredCombination

        public Optional<int[]> getUncoveredCombination()
        Finds the next uncovered combination and returns it.
        Specified by:
        getUncoveredCombination in interface CoverageMap
        Returns:
        the next uncovered combination in all parameter combination coverage maps or an empty Optional if no combination is uncovered