コード例 #1
0
        public static IDictionary<FilterSpecActivatable, FilterValueSetParam[][]> ComputeAddendumForStatement(
            ContextControllerStatementDesc statementDesc,
            ContextControllerFactory[] controllerFactories,
            object[] allPartitionKeys,
            AgentInstanceContext agentInstanceContextCreate)
        {
            IDictionary<int, FilterSpecActivatable> filters =
                statementDesc.Lightweight.StatementContext.FilterSpecActivatables;
            IDictionary<FilterSpecActivatable, FilterValueSetParam[][]> map =
                new IdentityDictionary<FilterSpecActivatable, FilterValueSetParam[][]>();
            foreach (var filter in filters) {
                var addendum = ComputeAddendum(
                    allPartitionKeys,
                    filter.Value,
                    true,
                    statementDesc,
                    controllerFactories,
                    agentInstanceContextCreate);
                if (addendum != null && addendum.Length > 0) {
                    map.Put(filter.Value, addendum);
                }
            }

            return map;
        }
コード例 #2
0
        public void SaveEnumerationMethodLastValue(Object node, Object result)
        {
            var snapshot = _lastValueCacheStack.ToArray();
            var entry    = new ExpressionResultCacheEntry <long[], Object>(snapshot, result);

            _enumMethodCache.Put(node, new compat.WeakReference <ExpressionResultCacheEntry <long[], Object> >(entry));
        }
コード例 #3
0
        /// <summary>Find elements matching selector.</summary>
        /// <param name="query">CSS selector</param>
        /// <param name="roots">root elements to descend into</param>
        /// <returns>matching elements, empty if none</returns>
        public static Elements Select(String query, IEnumerable <iText.StyledXmlParser.Jsoup.Nodes.Element> roots)
        {
            Validate.NotEmpty(query);
            Validate.NotNull(roots);
            Evaluator evaluator = QueryParser.Parse(query);
            List <iText.StyledXmlParser.Jsoup.Nodes.Element> elements = new List <iText.StyledXmlParser.Jsoup.Nodes.Element
                                                                                  >();
            IdentityDictionary <iText.StyledXmlParser.Jsoup.Nodes.Element, bool?> seenElements = new IdentityDictionary
                                                                                                 <iText.StyledXmlParser.Jsoup.Nodes.Element, bool?>();

            // dedupe elements by identity, not equality
            foreach (iText.StyledXmlParser.Jsoup.Nodes.Element root in roots)
            {
                Elements found = Select(evaluator, root);
                foreach (iText.StyledXmlParser.Jsoup.Nodes.Element el in found)
                {
                    if (!seenElements.ContainsKey(el))
                    {
                        elements.Add(el);
                        seenElements.Put(el, true);
                    }
                }
            }
            return(new Elements(elements));
        }
コード例 #4
0
        /// <summary>
        ///     Ctor.
        /// </summary>
        /// <param name="rootStream">is the stream supplying the lookup event</param>
        /// <param name="rootStreamName">is the name of the stream supplying the lookup event</param>
        /// <param name="numStreams">is the number of streams</param>
        /// <param name="lookupInstructions">is a list of lookups to perform</param>
        /// <param name="requiredPerStream">indicates which streams are required and which are optional in the lookup</param>
        /// <param name="assemblyInstructionFactories">factories for assembly</param>
        public LookupInstructionExecNode(
            int rootStream,
            string rootStreamName,
            int numStreams,
            LookupInstructionExec[] lookupInstructions,
            bool[] requiredPerStream,
            BaseAssemblyNodeFactory[] assemblyInstructionFactories)
        {
            this._rootStream = rootStream;
            this._rootStreamName = rootStreamName;
            this._numStreams = numStreams;
            this._lookupInstructions = lookupInstructions;
            this._requiredPerStream = requiredPerStream;

            // We have a list of factories that are pointing to each other in a tree, i.e.:
            // F1 (=>F3), F2 (=>F3), F3
            IDictionary<BaseAssemblyNodeFactory, BaseAssemblyNode> nodes =
                new IdentityDictionary<BaseAssemblyNodeFactory, BaseAssemblyNode>();
            foreach (var factory in assemblyInstructionFactories) {
                var node = factory.MakeAssemblerUnassociated();
                nodes.Put(factory, node);
            }

            // re-associate each node after allocation
            foreach (var nodeWithFactory in nodes) {
                var parentFactory = nodeWithFactory.Key.ParentNode;
                if (parentFactory != null) {
                    var parent = nodes.Get(parentFactory);
                    nodeWithFactory.Value.ParentAssembler = parent;
                }

                foreach (var childNodeFactory in nodeWithFactory.Key.ChildNodes) {
                    var child = nodes.Get(childNodeFactory);
                    nodeWithFactory.Value.AddChild(child);
                }
            }

            _assemblyInstructions = new BaseAssemblyNode[assemblyInstructionFactories.Length];
            for (var i = 0; i < assemblyInstructionFactories.Length; i++) {
                _assemblyInstructions[i] = nodes.Get(assemblyInstructionFactories[i]);
            }

            _myResultAssembler = new MyResultAssembler(rootStream);
            _assemblyInstructions[_assemblyInstructions.Length - 1].ParentAssembler = _myResultAssembler;

            // Determine up to which instruction we are dealing with optional results.
            // When dealing with optional results we don't do fast exists if we find no lookup results
            _requireResultsInstruction = 1; // we always require results from the very first lookup
            for (var i = 1; i < lookupInstructions.Length; i++) {
                var fromStream = lookupInstructions[i].FromStream;
                if (requiredPerStream[fromStream]) {
                    _requireResultsInstruction =
                        i + 1; // require results as long as the from-stream is a required stream
                }
                else {
                    break;
                }
            }
        }
コード例 #5
0
        public void SaveDeclaredExpressionLastColl(Object node, EventBean[] eventsPerStream, ICollection <EventBean> result)
        {
            var copy = new EventBean[eventsPerStream.Length];

            Array.Copy(eventsPerStream, 0, copy, 0, copy.Length);
            var entry = new ExpressionResultCacheEntry <EventBean[], ICollection <EventBean> >(copy, result);

            _exprDeclCacheCollection.Put(node, new compat.WeakReference <ExpressionResultCacheEntry <EventBean[], ICollection <EventBean> > >(entry));
        }