Exemple #1
0
        static public Node GetNodeInteractive()
        {
            Node   node;
            string nodeName = "";

            while (nodeName == "")
            {
                Console.Write("Please enter node name: ");
                nodeName = Console.ReadLine();
            }

            while (true)
            {
                Console.Write("Please enter node mode (map or reduce): ");
                var line = Console.ReadLine();
                if (line == "map")
                {
                    node = new MapNode(nodeName);
                    break;
                }
                else if (line == "reduce")
                {
                    node = new ReduceNode(nodeName);
                    break;
                }
            }
            return(node);
        }
Exemple #2
0
        static public Node GetNode(string[] args)
        {
            Node   node;
            string nodeName = args[0];
            var    mode     = args[1];

            if (mode == "map")
            {
                node = new MapNode(nodeName);
            }
            else if (mode == "reduce")
            {
                node = new ReduceNode(nodeName);
            }
            else
            {
                Console.WriteLine("Invalid mode.");
                throw new Exception("Invalid mode");
            }
            return(node);
        }