/// <summary> /// Add a sub-filter to this filter /// </summary> /// <param name="nextFilter">the next filter to add</param> public void AddFilter(IFilterAndPipe <T> nextFilter) { nextFilter.FilterCompleted += NextFilter_FilterCompleted; nextFilter.FilterExceptionEncountered += NextFilter_FilterExceptionEncountered; FilterList.Add(nextFilter); FilterList.Sort(); }
private void ExecutePipe(IFilterAndPipe <T> filter, T item) { try { if (filter.CanFilterItem(item)) { filter.Pipe(item); } } catch (Exception e) { FilterExceptionEventArgs eventArgs = new FilterExceptionEventArgs(Name) { Exception = e }; FilterExceptionEncountered?.Invoke(this, eventArgs); } }
/// <summary> /// Compare two filters and return difference is SortOrder /// </summary> /// <param name="x">filter</param> /// <param name="y">another filter</param> /// <returns></returns> public int Compare(IFilterAndPipe <T> x, IFilterAndPipe <T> y) { return(x.CompareTo(y)); }
/// <summary> /// The difference between this.SortOrder and the other.SortOrder /// </summary> /// <param name="other">the other filter</param> /// <returns>The difference between this.SortOrder and the other.SortOrder</returns> public int CompareTo(IFilterAndPipe <T> other) { return(SortOrder - other.SortOrder); }