예제 #1
0
        public static IFigures Query(this IFigures figures, int stage = 1, FilterTerms filter = null, SortTerms sort = null, bool saveonly = false, bool clearonend = false)
        {
            FigureFilter Filter = figures.Filter;
            FigureSort   Sort   = figures.Sort;

            if (filter != null)
            {
                Filter.Terms.AddNewRange(filter.AsEnumerable().ToArray());
            }
            if (sort != null)
            {
                Sort.Terms.AddNewRange(sort.AsEnumerable().ToArray());
            }
            if (!saveonly)
            {
                IFigures result = ResolveQuery(figures, Filter, Sort, stage);
                if (clearonend)
                {
                    figures.Filter.Terms.Clear();
                    figures.Filter.Evaluator = null;
                    figures.Exposition.Query = null;
                }
                return(result);
            }
            return(null);
        }
 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());
 }
 public Expression <Func <IFigure, bool> > GetExpression(int stage = 1)
 {
     termsReducer.Clear();
     termsReducer.AddRange(Reducer.AsEnumerable().Concat(Terms.AsEnumerable()).ToArray());
     expression.Conditions = termsReducer;
     termsBuffer           = termsReducer;
     return(expression.CreateExpression(stage));
 }
 public FigureFilter(IFigures collection)
 {
     Collection   = collection;
     expression   = new FilterExpression();
     Reducer      = new FilterTerms(collection);
     Terms        = new FilterTerms(collection);
     termsBuffer  = expression.Conditions;
     termsReducer = new FilterTerms(collection);
 }
예제 #5
0
        public FilterTerms Clone()
        {
            FilterTerms ft = new FilterTerms();

            foreach (FilterTerm t in this)
            {
                FilterTerm _t = new FilterTerm(t.RubricName, t.Operand, t.Value, t.Logic, t.Stage);
                ft.Add(_t);
            }
            return(ft);
        }
예제 #6
0
 public FilterExpression()
 {
     Conditions = new FilterTerms();
     nfi.NumberDecimalSeparator = ".";
     Stage = 1;
 }