Beispiel #1
0
 /// <summary>
 /// Prints out a single action string
 /// </summary>
 /// <param name="actionString">Action String to print out</param>
 /// <param name="finalState">Specifies the Final Time or State in the Elevator System</param>
 public static void PrintValidActionString(string actionString, int finalState)
 {
     //Check if the Action String is valid before printing
     if (BuildingUtilityClass.IsValidActionString(actionString, finalState))
     {
         Console.WriteLine(actionString);
     }
     else
     {
         Console.Error.WriteLine("No Solution");
     }
 }
Beispiel #2
0
        /// <summary>
        /// Prints out all action strings in the ValidActionStringsList Collection
        /// </summary>
        /// <param name="validActionStringsList">Specifies a Collection of valid action strings</param>
        /// <param name="finalState">Specifies the Final Time or State in the Elevator System</param>
        public static void PrintValidActionStrings(ArrayList validActionStringsList, int finalState)
        {
            if (validActionStringsList.Count == 0)
            {
                throw new Exception("No Solution");
            }

            foreach (string actionString in validActionStringsList)
            {
                //Check if the Action String is valid before printing
                if (BuildingUtilityClass.IsValidActionString(actionString, finalState))
                {
                    Console.WriteLine(actionString);
                }
                else
                {
                    Console.Error.WriteLine("No Solution");
                }
            }
        }