// Compare filters in statement with filters in segmented context, addendum filter compilation
        private static void GetAddendumFilters(
            IDictionary <FilterSpecCompiled, FilterValueSetParam[][]> addendums,
            ContextDetailCategoryItem category,
            ContextDetailCategory categorySpec,
            IList <FilterSpecCompiled> filters,
            ContextControllerStatementDesc statement)
        {
            // determine whether create-named-window
            var isCreateWindow = statement != null && statement.Statement.StatementSpec.CreateWindowDesc != null;

            if (!isCreateWindow)
            {
                foreach (var filtersSpec in filters)
                {
                    var typeOrSubtype = EventTypeUtility.IsTypeOrSubTypeOf(filtersSpec.FilterForEventType, categorySpec.FilterSpecCompiled.FilterForEventType);
                    if (!typeOrSubtype)
                    {
                        continue;       // does not apply
                    }
                    AddAddendums(addendums, filtersSpec, category, categorySpec);
                }
            }
            // handle segmented context for create-window
            else
            {
                var declaredAsName = statement.Statement.StatementSpec.CreateWindowDesc.AsEventTypeName;
                if (declaredAsName != null)
                {
                    foreach (var filtersSpec in filters)
                    {
                        AddAddendums(addendums, filtersSpec, category, categorySpec);
                    }
                }
            }
        }
 public ContextControllerCategoryFactoryImpl(
     ContextControllerFactoryContext factoryContext,
     ContextDetailCategory categorySpec,
     IList <FilterSpecCompiled> filtersSpecsNestedContexts)
     : base(factoryContext, categorySpec, filtersSpecsNestedContexts)
 {
     _binding = factoryContext.StateCache.GetBinding(typeof(int));        // the integer ordinal of the category
 }
 public ContextControllerCategoryFactory(ContextControllerFactoryContext factoryContext, ContextDetailCategory categorySpec, IList <FilterSpecCompiled> filtersSpecsNestedContexts, ContextStateCache stateCache)
     : base(factoryContext)
 {
     _categorySpec = categorySpec;
     _filtersSpecsNestedContexts = filtersSpecsNestedContexts;
     _stateCache = stateCache;
     _binding    = stateCache.GetBinding(typeof(int)); // the integer ordinal of the category
 }
        private static void AddAddendums(
            IDictionary <FilterSpecCompiled, FilterValueSetParam[][]> addendums,
            FilterSpecCompiled filtersSpec,
            ContextDetailCategoryItem category,
            ContextDetailCategory categorySpec)
        {
            FilterValueSetParam[][] categoryEventFilters = categorySpec.FilterParamsCompiled;
            FilterValueSetParam[][] categoryItemFilters  = category.CompiledFilterParam;

            FilterValueSetParam[][] addendum = ContextControllerAddendumUtil.MultiplyAddendum(categoryEventFilters, categoryItemFilters);

            FilterValueSetParam[][] existingFilters = addendums.Get(filtersSpec);
            if (existingFilters != null)
            {
                addendum = ContextControllerAddendumUtil.MultiplyAddendum(existingFilters, addendum);
            }

            addendums[filtersSpec] = addendum;
        }
 protected ContextControllerCategoryFactoryBase(ContextControllerFactoryContext factoryContext, ContextDetailCategory categorySpec, IList <FilterSpecCompiled> filtersSpecsNestedContexts)
     : base(factoryContext)
 {
     _categorySpec = categorySpec;
     _filtersSpecsNestedContexts = filtersSpecsNestedContexts;
 }