⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 identify.java

📁 This project developed in java leads us to realize a flight reservation system in order to emulate d
💻 JAVA
字号:
/* * Identify.java * The package functions contains the different class executing the different functions of the FlightSystem Reservation. */package reservation.system.functions;import reservation.system.Person;import java.util.Vector;/** * This class hold Lists structure. This object allows to see the person who are registered in one flight by calling the method <CODE>list</CODE> in {@link reservation.system.FlightSystem}. * @author Texier Mathieu and Frederic Bidon */public class Identify extends Functions {        /**     * Display the list of the persons who have got the bookingNumber written by the user if the command <CODE>identify</CODE> and their arguments are correct.     * @throws Exception the command is not executed.     * @return the names of the persons which correpond to this bookingNumber and their positions in the flight.     */    public String execute () throws Exception {        Vector groupePersonVector = fs.identify (Integer.parseInt (arg[0]));        if (groupePersonVector.isEmpty ())            return "The List is empty.\r\n";                String flightName = ((Person) groupePersonVector.get (0)).getFlight ().getFlightName ();        String retString = "Flight: Identify " + arg[0] + " (flght " + flightName +" )\r\n" ;        for (int i=0; i< groupePersonVector.size (); i++)            retString += (Person) groupePersonVector.get (i);        return retString;    }        /**     * Verify that at least one flight is created and also one reservation has been made.     * Verify invariants :     * <PRE>     * - Arguments not null     * - <CODE>bookingNumber</CODE> belongs to [1 <CODE>fs.getBookingNumberMax</CODE>]     * </PRE>     * @throws Exception if the invariants is violated     */    void _check (String[] arg) throws Exception {    	try {        CheckFlightListNotEmpty ();        CheckBookingListNotEmpty ();        ArgumentIsValid (arg, 1, 1);        if (!checkInteger (arg[0], 1, fs.getBookingNumberMax ()))            throw new Exception ("The argument booking number has to be an integer");         } catch (Exception e) {            throw new Exception (e.getMessage ()+ "\r\n" + usage ());        }    }        /**    * Display the usage for the command <CODE>identify</code>.    * @return the usage.    */    static public String usage () {        String usage = " Usage command identify: identify <bookingNumber>\n\r";        usage += " - The <bookingNumber> is a number and cannot be inferior to 0.\n";           return usage;    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -