Exemple #1
0
        public void CompleteTheSubring()
        {
            SubringParameters p = new SubringParameters();

            string[] args = "-b=.2 -c --secure_edges -s=25 --subring=10".Split(' ');
            Assert.AreNotEqual(-1, p.Parse(args), "Unable to parse" + p.ErrorMessage);
            SubringSimulator sim = new SubringSimulator(p);

            _sim = sim;
            Assert.IsTrue(sim.Complete(true), "Simulation failed to complete the ring");
        }
Exemple #2
0
        public static int Main(string [] args)
        {
#if SUBRING
            SubringParameters p = new SubringParameters();
#else
            Parameters p = new Parameters("Simulator", "Simulator - Brunet Time Based Simulator");
#endif
            if (p.Parse(args) != 0)
            {
                Console.WriteLine(p.ErrorMessage);
                p.ShowHelp();
                return(-1);
            }
            else if (p.Help)
            {
                p.ShowHelp();
                return(-1);
            }

#if SUBRING
            SubringSimulator sim = new SubringSimulator(p);
#else
            Simulator sim = new Simulator(p);
#endif

            if (p.Complete)
            {
                sim.Complete(false);
            }
            else if (p.Broadcast > -2)
            {
                Broadcast(sim, p.Broadcast, p.Output);
            }
            else if (p.HeavyChurn > 0)
            {
                HeavyChurn(sim, p.HeavyChurn);
            }
            else if (p.Evaluation)
            {
                Evaluate(sim, p);
            }
            else
            {
                Commands(sim);
            }
            return(0);
        }