- /* 
-  * Command.java 
-  * The package reservation contains the different class allowing to choose the action to realise. 
-  */ 
- package reservation; 
- import reservation.system.functions.*; 
-   
- import java.util.StringTokenizer; 
- import java.io.InputStreamReader; 
- import java.io.BufferedReader; 
- import java.io.FileInputStream; 
- import java.io.FileNotFoundException; 
- import java.io.IOException; 
-   
- /** 
-  * This class hold Command structure. This object analyse the instruction written by the user and determine according to the first element the command to execute. 
-  * Then it instancie a new object which depends to the command and which will execute the instruction of the user. 
-  * @author Texier Mathieu and Frederic Bidon 
-  */ 
- public class Command implements Mode{ 
-      
-     /** Creates a new instance of Command */ 
-     public Command () { 
-     } 
-      
-     /** 
-      * Take over the instruction written by the user and also if it want execute the command in Verbose Mode 
-      * @param in The input stream from which the data are interpreted 
-      * @param VerboseMode the verbosity level (QUIET, NORMAL, DEBUG) 
-      */ 
-         this.in = in; 
-         this.VerboseMode = VerboseMode; 
-     } 
-      
-    /** 
-     * This method determine the number of element of the user's instruction and analyse the first element of this one. 
-     * If it corresponds to an available command of the system, it create a new object depending of the command. 
-     * This new object will execute the instruction with the other elements of the command.  
-     */ 
-     public void process () { 
-             boolean escape = false; 
-         do { 
-             boolean boolError = false; 
-             do { 
-                 try { 
-                     if (VerboseMode > QUIET) 
-                     String-  readLine  =-  in. readLine ();
 
-                     if (readLine == null) 
-                         return; 
-             } while (st.countTokens () < 1); 
-              
-             int AgumentNumber= st.countTokens ()-1; 
-             String-  Command  =-  st. nextToken ()- . toLowerCase ();
 
-              
-             for (int i = 0;st.hasMoreTokens (); i++) 
-                 line[i] = st.nextToken (); 
-   
-             try { 
-                 if (Command.equals ("create")) 
-                     action = new Create (); 
-                 else if (Command.equals ("reserve")) 
-                     action = new Reserve (); 
-                 else if (Command.equals ("list")) 
-                     action = new Lists (); 
-                 else if (Command.equals ("identify")) 
-                     action = new Identify (); 
-                 else if (Command.equals ("cancel")) 
-                     action = new Cancel (); 
-                 else if (Command.equals ("flights")) 
-                     action = new Flights (); 
-                 else if (Command.equals ("store")) 
-                     action = new Store (); 
-                 else if (Command.equals ("reload")) 
-                     action = new Reload (); 
-                 else if (Command.equals ("exit")) { 
-                     Functions.ArgumentIsValid (line, 0, 0); 
-                     escape = true; 
-                 } 
-                 else {throw new Exception ("This command doesn't exist.");} 
-                 System- . err- . println (- e. getMessage ());
 
-                 if (VerboseMode > HIGH) { 
-                         e.printStackTrace (); 
-                 } 
-                 boolError = true; 
-             } 
-             try { 
-                 if (!boolError && !escape) { 
-                     res = action.execute (line); 
-                 } 
-                 if (VerboseMode > QUIET) 
-                 if (VerboseMode > NORMAL) 
-                 System- . err- . println (- e. getMessage ());
 
-                 if (VerboseMode > HIGH) 
-                     e.printStackTrace (); 
-             } 
-         } while (!escape) ; 
-     } 
-      
-     private int VerboseMode = NORMAL; 
- } 
-