📄 flights.java
字号:
/* * Flights.java * The package functions contains the different class executing the different functions of the FlightSystem Reservation. */package reservation.system.functions;import reservation.system.FlightSystem;/** * This class hold Flights structure. This object allows to watch the list of the created flights by calling the command <CODE>flights</CODE> in {@link reservation.system.FlightSystem}. * @author Texier Mathieu and Frederic Bidon */public class Flights extends Functions { /** * Display the list of the flights that are created if the command <CODE>flights</CODE> is correct. * @throws Exception if the command is not executed. * @return the names of the different flights created. */ public String execute () throws Exception { String retString = "Flight list :\r\n"; String[] flightList = fs.getFlightList (); if (flightList.length == 0) return "The flights' list is empty.\r\n"; for (int i=0; i< flightList.length; i++) { retString += flightList[i] + " "; } return retString; } /** * Verify that at least one flight is created. * @throws Exception if it contains arguments or if no flight has been created. */ void _check (String[] arg) throws Exception { try { CheckFlightListNotEmpty (); ArgumentIsValid (arg, 0, 0); } catch (Exception e) { throw new Exception (e.getMessage ()+ "\r\n" + usage ()); } } /** * Display the usage for the command <CODE>flights</code>. * @return the usage. */ static public String usage () { String usage = " Usage command flight: flight"; usage += " This command have to contain no argument.\n\r"; usage += "You must create at least one flight before to use this command."; return usage; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -