示例#1
0
        private static void ConstructElementsGraph(RunElementTreeNode[][] elementGroups)
        {
            RunElementTreeNode[] lastGroup = null;
            foreach (var thisGroup in elementGroups)
            {
                for (int i = 1; i < thisGroup.Length; ++i)
                {
                    thisGroup[i - 1].Next = thisGroup[i];
                }

                if (lastGroup != null)
                {
                    foreach (var one in lastGroup)
                    {
                        one.FirstChild = thisGroup[0];
                    }
                }

                lastGroup = thisGroup;
            }
        }
示例#2
0
        private static void ConstructsFrames(RunElementTreeNode thisNode, Stack <RunElementTreeNode> stack, Collection <RunFrame> frames, AbstractRunFrameFactory runFrameFactory)
        {
            if (thisNode == null)
            {
                throw new System.ArgumentNullException("thisNode");
            }

            if (stack == null)
            {
                throw new ArgumentNullException("stack");
            }

            if (frames == null)
            {
                throw new ArgumentNullException("frames");
            }

            if (runFrameFactory == null)
            {
                throw new ArgumentNullException("runFrameFactory");
            }

            stack.Push(thisNode);

            if (thisNode.FirstChild == null)
            {
                frames.Add(runFrameFactory.CreateFrame(stack.Select(node => node.Element)));
            }
            else
            {
                ConstructsFrames(thisNode.FirstChild, stack, frames, runFrameFactory);
            }

            stack.Pop();
            if (thisNode.Next != null)
            {
                ConstructsFrames(thisNode.Next, stack, frames, runFrameFactory);
            }
        }
示例#3
0
        private static void ConstructsFrames(RunElementTreeNode thisNode, Stack<RunElementTreeNode> stack, Collection<RunFrame> frames, AbstractRunFrameFactory runFrameFactory)
        {
            if (thisNode == null)
            {
                throw new System.ArgumentNullException("thisNode");
            }

            if (stack == null)
            {
                throw new ArgumentNullException("stack");
            }

            if (frames == null)
            {
                throw new ArgumentNullException("frames");
            }

            if (runFrameFactory == null)
            {
                throw new ArgumentNullException("runFrameFactory");
            }

            stack.Push(thisNode);

            if (thisNode.FirstChild == null)
            {
                frames.Add(runFrameFactory.CreateFrame(stack.Select(node => node.Element)));
            }
            else
            {
                ConstructsFrames(thisNode.FirstChild, stack, frames, runFrameFactory);
            }

            stack.Pop();
            if (thisNode.Next != null)
            {
                ConstructsFrames(thisNode.Next, stack, frames, runFrameFactory);
            }
        }