Esempio n. 1
0
        public Boolean IsMatch(IEnumerable <SourceTableAggregation> items, SourceTableAggregation input)
        {
            List <SourceTableAggregation> allItems = items.ToList();

            allItems.Add(input);

            var existing = allItems.Select(x => x.Features).ToList();
            //existing.Add(input.Features);

            var common = existing.GetCrossSection <SourceTableCase>();

            if (!common.ContainsAll(Required))
            {
                return(false);
            }

            SourceTableAggregation last = null;

            foreach (SourceTableAggregation item in allItems)
            {
                if (last == null)
                {
                    last = item;
                }
                else
                {
                    foreach (Func <SourceTableAggregation, SourceTableAggregation, Boolean> criterion in ExtraCriteria)
                    {
                        if (!criterion(last, item))
                        {
                            return(false);
                        }
                    }
                }
            }
            return(true);
        }
        public SpanTransformationRule Add(SourceTableAggregation input, SpanTransformationRuleSet ruleSet)
        {
            SpanTransformationRule matchedRule = null;

            foreach (SpanTransformationRule rule in ruleSet.items)
            {
                if (rule.IsMatch(currentSpan.items, input))
                {
                    matchedRule = rule;
                }
            }

            if (matchedRule == null)
            {
                Close();
            }
            else
            {
                currentSpan.items.Add(input);
                currentSpan.MatchedRule = matchedRule;
            }

            return(matchedRule);
        }