//Main Entry Point of the Elevator System Console Application static void Main(string[] args) { try { ArrayList validActionStringsList = new ArrayList(); ParseCommandLineArgs(args); //The Command to Invoke the Program must be called InvokeProgram if (InvokeProgramCommand.Equals("InvokeProgram")) { /*Create an object encasulating elevator states representative of the *correctly formatted Input File*/ ElevatorState elevatorStateCollection = new ElevatorState(ElevatorSystemFilePath); //Get a list of valid action strings validActionStringsList = elevatorStateCollection.FindValidActionStrings(StartingElevator, FinalFloor, FinalTime); /*If there were valid action strings that were found print them out * Otherwise, throw an exception since no input matched the Command Line arguments*/ if (validActionStringsList != null) { BuildingUtilityClass.PrintValidActionStrings(validActionStringsList, FinalTime); } else { throw new Exception("No Solution"); } } else { throw new Exception("No Solution"); } } catch (Exception ex) { //If there is no solution, print out "No Solution" to stderr or Console.Error and nothing to Console.WriteLine Console.Error.WriteLine("No Solution"); } }
//Main Entry Point of the Elevator System Console Application static void Main(string[] args) { try { ArrayList validActionStringsList = new ArrayList(); ParseCommandLineArgs(args); //The Command to Invoke the Program must be called InvokeProgram if (InvokeProgramCommand.Equals("InvokeProgram")) { /*Create an object encasulating elevator states representative of the * correctly formatted Input File*/ ElevatorState elevatorStateCollection = new ElevatorState(ElevatorSystemFilePath); //Get a list of valid action strings validActionStringsList = elevatorStateCollection.FindValidActionStrings(StartingElevator, FinalFloor, FinalTime); /*If there were valid action strings that were found print them out * Otherwise, throw an exception since no input matched the Command Line arguments*/ if (validActionStringsList != null) { BuildingUtilityClass.PrintValidActionStrings(validActionStringsList, FinalTime); } else { throw new Exception("No Solution"); } } else { throw new Exception("No Solution"); } } catch (Exception ex) { //If there is no solution, print out "No Solution" to stderr or Console.Error and nothing to Console.WriteLine Console.Error.WriteLine("No Solution"); } }