/// <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;
                }
            }
        }
示例#2
0
        public ExpressionResultCacheEntry <EventBean[], Object> GetDeclaredExpressionLastValue(Object node, EventBean[] eventsPerStream)
        {
            InitExprDeclaredCacheObject();
            var cacheRef = _exprDeclCacheObject.Get(node);

            if (cacheRef == null)
            {
                return(null);
            }
            var entry = cacheRef.Target;

            if (entry == null)
            {
                return(null);
            }
            var cacheEvents = entry.Reference;

            if (cacheEvents.Length != eventsPerStream.Length)
            {
                return(null);
            }
            for (int i = 0; i < cacheEvents.Length; i++)
            {
                if (cacheEvents[i] != eventsPerStream[i])
                {
                    return(null);
                }
            }
            return(entry);
        }
示例#3
0
        public ExpressionResultCacheEntry <long[], Object> GetEnumerationMethodLastValue(Object node)
        {
            InitEnumMethodCache();
            var cacheRef = _enumMethodCache.Get(node);

            if (cacheRef == null)
            {
                return(null);
            }
            ExpressionResultCacheEntry <long[], Object> entry = cacheRef.Target;

            if (entry == null)
            {
                return(null);
            }
            long[] required = entry.Reference;
            if (required.Length != _lastValueCacheStack.Count)
            {
                return(null);
            }
            IEnumerator <long> prov = _lastValueCacheStack.GetEnumerator();

            for (int i = 0; i < _lastValueCacheStack.Count; i++)
            {
                prov.MoveNext();
                if (!required[i].Equals(prov.Current))
                {
                    return(null);
                }
            }
            return(entry);
        }
示例#4
0
 public FilterValueSetParam[][] GetFilterAddendum(FilterSpecCompiled filterSpecCompiled)
 {
     return(_filterAddendum.Get(filterSpecCompiled));
 }
示例#5
0
 public FilterValueSetParam[][] GetAddendumFilters(FilterSpecCompiled filterSpec)
 {
     return(_addendumMap.Get(filterSpec));
 }