示例#1
0
        /// <include file='Resources/DocComments.xml' path='DocComments/Member[@name="BatchLoader.Add"]/*' />
        public void Add(string atomName, string expression, ExpressionContext context)
        {
            Utility.AssertNotNull(atomName, "atomName");
            Utility.AssertNotNull(expression, "expression");
            Utility.AssertNotNull(context, "context");

            BatchLoadInfo info = new BatchLoadInfo(atomName, expression, context);

            MyNameInfoMap.Add(atomName, info);
            MyDependencies.AddTail(atomName);

            ICollection <string> references = this.GetReferences(expression, context);

            foreach (string reference in references)
            {
                MyDependencies.AddTail(reference);
                MyDependencies.AddDepedency(reference, atomName);
            }
        }
        private void AddTemporaryHead(string headName)
        {
            GenericExpressionResultPair <int> pair = new GenericExpressionResultPair <int>();

            pair.SetName(headName);

            if (MyNameNodeMap.ContainsKey(headName) == false)
            {
                MyDependencies.AddTail(pair);
                MyNameNodeMap.Add(headName, pair);
            }
            else
            {
                throw new ArgumentException(string.Format("An expression already exists at '{0}'", headName));
            }
        }
示例#3
0
        private void CloneDependentsInternal(T tail, DependencyManager <T> target, IDictionary <T, object> seenNodes)
        {
            if (seenNodes.ContainsKey(tail) == true)
            {
                // We've already added this node so just return
                return;
            }
            else
            {
                // Haven't seen this node yet; mark it as visited
                seenNodes.Add(tail, null);
                target.AddTail(tail);
            }

            IDictionary <T, object> innerDict = this.GetInnerDictionary(tail);

            // Do the recursive add
            foreach (T head in innerDict.Keys)
            {
                target.AddDepedency(tail, head);
                this.CloneDependentsInternal(head, target, seenNodes);
            }
        }