Beispiel #1
0
        public IRangeClauseFilter FilterUnreachableClauses(IRangeClauseFilter filter)
        {
            if (filter is null)
            {
                throw new ArgumentNullException();
            }

            if (!(filter is RangeClauseFilter <T>))
            {
                throw new ArgumentException($"Argument is not of type UCIRangeClauseFilter<{typeof(T).ToString()}>", "filter");
            }

            var filteredCoverage = _filterFactory.Create(TypeName, _valueFactory);

            filteredCoverage = (RangeClauseFilter <T>)MemberwiseClone();
            if (!ContainsFilters || filter.FiltersAllValues)
            {
                return(_filterFactory.Create(TypeName, _valueFactory));
            }

            if (!filter.ContainsFilters && !_hasExtents)
            {
                return(filteredCoverage);
            }

            filteredCoverage = RemoveClausesCoveredBy((RangeClauseFilter <T>)filteredCoverage, (RangeClauseFilter <T>)filter);
            return(filteredCoverage);
        }
Beispiel #2
0
        public void Add(IRangeClauseFilter filter)
        {
            var newFilter = (RangeClauseFilter <T>)filter;

            if (newFilter.TryGetIsLTValue(out T isLT))
            {
                AddIsClauseImpl(isLT, LogicSymbols.LT);
            }
            if (newFilter.TryGetIsGTValue(out T isGT))
            {
                AddIsClauseImpl(isGT, LogicSymbols.GT);
            }

            foreach (var tuple in newFilter.RangeValues)
            {
                AddValueRangeImpl(tuple.Item1, tuple.Item2);
            }

            foreach (var val in newFilter.VariableRanges)
            {
                _variableRanges.Add(val);
            }

            foreach (var op in newFilter.RelationalOps)
            {
                AddRelationalOpImpl(op);
            }

            foreach (var val in newFilter.SingleValues)
            {
                AddSingleValueImpl(val);
            }

            foreach (var val in newFilter.VariableSingleValues)
            {
                VariableSingleValues.Add(val);
            }
            _descriptorIsDirty = true;
        }