- /* 
-  * Cancel.java 
-  * The package functions contains the different class executing the different functions of the FlightSystem Reservation. 
-  */ 
- package reservation.system.functions; 
-   
- import java.util.HashSet; 
- import java.util.Set; 
-   
- /** 
-  * This class hold Cancel structure. This object allows to cancel a reservation for different person or for a whole of person by calling the methods <CODE>cancel</CODE> in {@link reservation.system.FlightSystem}. 
-  * @author Texier Mathieu and Frederic Bidon 
-  */ 
- public class Cancel extends Functions { 
-      
-      /** 
-      * Cancel several person or a whole of person if the command <CODE>cancel</CODE> and their arguments are correct. 
-      * @throws Exception if a person name is duplicated or if the person are not canceled. 
-      * @return a confimation's message if the person(s) or the bookingNumber are canceled. 
-      */ 
-         boolean valid; 
-         if (arg.length > 1) { 
-             for (int i = 1; i< arg.length; i++) 
-                 setPersonNames.add (arg[i]); 
-              
-             if (setPersonNames.size () != arg.length-1) 
-                 throw new Exception ("no duplicate name are allowed in reserve comande"); 
-             valid  =-  fs. cancel (Integer- . parseInt (- arg [0])- , setPersonNames );
-         } 
-         else 
-             valid  =-  fs. cancel (Integer- . parseInt (- arg [0]));
-          
-         if (valid) { 
-             return "Flight canceled \r\n" + 
-             "We are Sorry, if our compagny does not fully satified you and we hope to see you soon.\r\n"; 
-         } else {throw new Exception ("The person are not succesfully canceled");} 
-     } 
-      
-      /** 
-      * 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 
-      */ 
-         try { 
-         CheckFlightListNotEmpty (); 
-         CheckBookingListNotEmpty (); 
-         ArgumentIsValid (arg, 1, (short) NUMBER_ARGUMENT_MAX); 
-         if (!checkInteger (arg[0], 1, fs.getBookingNumberMax ())) 
-             throw new Exception ("The argument booking number has to be an integer"); 
-             throw new Exception (- e. getMessage ()+ "\r\n" +-  usage  ());
 
-         } 
-     } 
-      
-     /** 
-     * Display the usage for the command <CODE>cancel</code>. 
-     * @return the usage. 
-     */ 
-     static public String-  usage  () {
 
-         String-  usage  = " Usage command cancel: cancel <bookingNumber> [personName1] [personName2] [...]\n\r";
 
-         usage += " - The <bookingNumber> is a number and cannot be inferior to 0. \r\n"; 
-         usage += " - The arguments <personNameX> which follow correspond to the name of the \n\r"; 
-         usage += "  different persons that you want to register on the flight.\r\n"; 
-         usage += "\t The first letter of each passenger must be in  uppercase and \n\r"; 
-         usage += " all the other in lowercase.\n\r "; 
-         usage += "\t The number of name cannot be superior to the free place of the plane.\n"; 
-         return usage; 
-     } 
- } 
-