import java.io.*; import java.util.*; class Project2_1 { // str to put the input from the keyboard private static String str = new String(); public static BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); public static CompoundFile root = new CompoundFile(null,"root"); public static void main(String argv[]){ // when start the program, start a new file system, FileSystem file_system = new FileSystem(root); for (;;) { System.out.print("$>"); System.out.flush(); try{ str = in.readLine(); } catch(IOException e) { System.err.println(e); } Parser a_parser = new Parser(); a_parser.parse(str, "&"); int numberOfCommand = a_parser.getTokens().size(); // creat threads below Thread t[] = new Thread[numberOfCommand]; for (int i = 0; i < numberOfCommand; i ++) { String comd = (String)a_parser.getTokens().get(i); Command cThread = new Command(comd,file_system); t[i] = new Thread(cThread); t[i].start(); } for (int i = 0; i < numberOfCommand; i ++) { try { t[i].join(); } catch (InterruptedException e) { System.err.println(e); } } }// end of for(;;) }// end of main(); }// end of class Project1.2.