Exemple #1
0
        public override IMatches Match(IAction action, object[] arguments, int localMaxMatches, bool special, List <FilterCall> filters)
        {
            int curMaxMatches = (localMaxMatches > 0) ? localMaxMatches : MaxMatches;

#if DEBUGACTIONS || MATCHREWRITEDETAIL // spread over multiple files now, search for the corresponding defines to reactivate
            PerformanceInfo.StartLocal();
#endif
            IMatches matches = action.Match(this, curMaxMatches, arguments);
#if DEBUGACTIONS || MATCHREWRITEDETAIL
            PerformanceInfo.StopMatch();
#endif
            PerformanceInfo.MatchesFound += matches.Count;

            if (matches.Count > 0)
            {
                PreMatched(matches);
            }

            for (int i = 0; i < filters.Count; ++i)
            {
                FilterCall filterCall = filters[i];
                if (filterCall is FilterCallWithLambdaExpression)
                {
                    FilterCallWithLambdaExpression lambdaExpressionFilterCall = (FilterCallWithLambdaExpression)filterCall;
                    Filter(matches, lambdaExpressionFilterCall);
                }
                else
                {
                    FilterCallWithArguments filterCallWithArguments = (FilterCallWithArguments)filterCall;
                    action.Filter(this, matches, filterCallWithArguments);
                }
            }

            if (matches.Count > 0) // ensure that Matched is only called when a match exists
            {
                Matched(matches, null, special);
            }

            return(matches);
        }
Exemple #2
0
 protected virtual void OnFilterCall(ConvolutionMatrix filterKernel)
 {
     FilterCall?.Invoke(this, new FilterEventArgs(workingCopy, filterKernel));
 }