/// <summary> /// The Query. /// </summary> /// <param name="stage">The stage<see cref="int"/>.</param> /// <returns>The <see cref="IFigure[]"/>.</returns> public IFigure[] Query(int stage = 1) { termsReducer.Clear(); termsReducer.Add(Reducer.AsEnumerable().Concat(Terms.AsEnumerable()).ToArray()); expression.Conditions = termsReducer; termsBuffer = termsReducer; return(figures.AsEnumerable().AsQueryable().Where(expression.CreateExpression(stage).Compile()).ToArray()); }
/// <summary> /// The GetExpression. /// </summary> /// <param name="stage">The stage<see cref="int"/>.</param> /// <returns>The <see cref="Expression{Func{IFigure, bool}}"/>.</returns> public Expression <Func <IFigure, bool> > GetExpression(int stage = 1) { termsReducer.Clear(); termsReducer.Add(Reducer.AsEnumerable().Concat(Terms.AsEnumerable()).ToArray()); expression.Conditions = termsReducer; termsBuffer = termsReducer; return(expression.CreateExpression(stage)); }
public IFigure[] Filter(ICollection <IFigure> toFilter, int stage = 1) { termsReducer.Clear(); termsReducer.AddRange(Reducer.AsEnumerable().Concat(Terms.AsEnumerable()).ToArray()); expression.Conditions = termsReducer; termsBuffer = termsReducer; return(toFilter.AsQueryable().Where(expression.CreateExpression(stage).Compile()).ToArray()); }