Exemplo n.º 1
0
        public void Run(NodeLinkedList list)
        {
            Node currentNode = list.First;
            NextNodeVisitor visitor = new NextNodeVisitor(this);

            while(currentNode != null)
            {
                AbstractFunctionCallNode node = currentNode as AbstractFunctionCallNode;

                if(node != null)
                {
                    string name = node.Parameters[0];
                    Commands[name].Execute(this, node.Parameters);
                }

                currentNode.Accept(visitor);
                currentNode = visitor.NextNode;

                if (this.IsDebug)
                {
                    System.Threading.Thread.Sleep(100);
                }

            }
        }
Exemplo n.º 2
0
        // From powerpoint:
        public void Run(NodeLinkedList list)
        {
            Node            currentNode = list.getFirst();
            NextNodeVisitor visitor     = new NextNodeVisitor();

            while (currentNode != null)
            {
                // Do something with the current node
                NodeAbstractFunction aNode = currentNode as NodeAbstractFunction;
                if (aNode != null)
                {
                    // TODO: Powerpoint niet duidelijk HIER!
                }

                // Get next Node
                currentNode.accept(visitor);
                currentNode = visitor.nextNode;
            }
        }
        public void Run(DoubleLinkedList list)
        {
            var currentNode = list.First;
            NextNodeVisitor visitor = new NextNodeVisitor (this);

            while (currentNode != null) {
                AbstractFunctionCall functionNode = currentNode as AbstractFunctionCall;
                if (functionNode != null) {
                    BaseCommand foundCommand = Commands.GetValue(functionNode.Identifier);
                    if (foundCommand != null) {
                        foundCommand.Execute (this, functionNode.Parameters);
                    } else {
                        Console.WriteLine ("No function named: " + functionNode.Identifier);
                    }
                }
                currentNode.Accept (visitor);
                currentNode = visitor.NextNode;
            }
            Console.WriteLine ("##End of code!##");
        }