/*static void Main() { }*/ public void addCheckin(int time, int index, List<Personnel> personnel) { string line = ""; String[] lineSplit = new String[2]; System.IO.StreamReader file = new System.IO.StreamReader("../../../Files/scenario.txt"); while ((line = file.ReadLine()) != null) { if (line.Equals("BAGS")) { while ((line = file.ReadLine()) != null) { if (line.Trim().Length == 0) { continue; } if (line.Equals("-")) break; lineSplit = line.Split(' '); } break; } } int numberOfBags = Convert.ToInt32(lineSplit[0]); int lambda = Convert.ToInt32(lineSplit[1]); Statistics gen = new Statistics(); List<Tuple<int, LuggageBag>> luggageAndDequeueDelta = new List<Tuple<int, LuggageBag>>(); List<int> bags = Statistics.GetBags(numberOfBags, lambda); int dest; foreach (int elem in bags) { dest = Statistics.Runner(index); luggageAndDequeueDelta.Add(new Tuple<int, LuggageBag>(elem, new LuggageBag(airplanes[dest]))); //System.Threading.Thread.Sleep(1000); } checkins.Add(new CheckInCounter(luggageAndDequeueDelta, new List<IProblem> { new Stuck(Statistics.FailProbability("CHECKIN"), new PersonnelController(personnel)), new StopWorking(Statistics.FailProbability("CHECKIN")) }, index)); }
public static List<int> GetBags(int time, double lambda) { List<int> bags = new List<int>(); int tala; int sum = 0; Statistics bla = new Statistics(); while (sum < time) { tala = Statistics.GetPoisson(lambda); sum += tala; bags.Add(sum); System.Threading.Thread.Sleep(100); } return bags; }