Пример #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="node"></param>
        /// <param name="ll"></param>
        /// <returns>The node where the branch was added</returns>
        // this will consolodate the tails of this linkied list with the linked list
        // that is being added
        public Node AddBranch(Node node, BrigitGraph ll)
        {
            node.Next.Add(ll.Head);

            foreach (Node n in ll.Tails)
            {
                this.Tails.Add(n);
            }

            return(node);
        }
Пример #2
0
        /// <summary>
        /// Adds another LinkedList to the end of this Linked List and set's the additional linked list's
        /// tails to the tail of this linked list
        /// </summary>
        /// <param name="ll"></param>
        public void AddGraph(BrigitGraph ll)
        {
            // this means that this linked list is
            // empty
            if (this.Head == null)
            {
                this.Head = ll.Head;
            }
            else
            {
                foreach (Node n in this.Tails)
                {
                    n.Next.Add(ll.Head);
                }
            }

            this.Tails = ll.Tails;
        }
Пример #3
0
        /// <summary>
        /// Adds a graph between give node and it's tails
        /// </summary>
        /// <param name="node"></param>
        /// <param name="ll"></param>
        // TODO fix this. It's is not working the way it's intended to
        // it's creating too many tails
        // I have to know what the "tail" is in this case.
        // this makes the graphs next nodes all of the nodes or choices that were previously added
        public void AddInBetween(Node node, BrigitGraph ll)
        {
            if (node == null || ll == null)
            {
                throw new ArgumentNullException();
            }
            // adding tail first
            // adding the head last so the next list isn't messed up
            foreach (Node n in ll.Tails)
            {
                foreach (Node n2 in node.Next)
                {
                    n.Next.Add(n2);
                }
            }

            node.Next.Add(ll.Head);
        }
Пример #4
0
        public void AddInBetween(Node node, List <Node> tails, BrigitGraph ll)
        {
            if (node == null || ll == null)
            {
                throw new ArgumentNullException();
            }

            // make it availble to the node
            node.Next.Add(ll.Head);

            // the tail will be the next node of the nodes
            foreach (Node n in ll.Tails)
            {
                foreach (Node n2 in tails)
                {
                    n.Next.Add(n2);
                }
            }
        }