public static void SortAndDie(Queue <Token> input) { SortingStation st = new SortingStation(input); st.Sort(); input.Clear(); foreach (Token token in st.m_output_queue) { input.Enqueue(token); } }
public static void CalculateString(string s, bool debug_print = false) { var queue = StaticParser.Parse(s); Console.WriteLine(String.Format("Input: {0}", s)); if (queue == null) { Console.WriteLine("Could not parse input\n"); return; } if (debug_print) { Console.WriteLine("Parsed input:"); foreach (Token token in queue) { Console.WriteLine(String.Format("{0}", token.ToString())); } } SortingStation.SortAndDie(queue); if (debug_print) { Console.WriteLine("Sorted input:"); foreach (Token token in queue) { Console.WriteLine(String.Format("{0}", token.ToString())); } } double result = Calculator.CalculateAndDie(queue); Console.WriteLine(String.Format("Result: {0}\n", result)); }