import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.file.FileSystemException;


public class DatabaseApp {

	private String tmpDir;
	
	public static void main(String[] args) {
		DatabaseApp app = new DatabaseApp();
		try {
			app.setup();
			app.run();
		} catch (FileSystemException e) {
			System.err.println(e.getMessage());
		} finally {
			app.cleanup();
		}
	}
	
	public void setup() throws FileSystemException {
		if (System.getProperty("os.name").startsWith("Windows")) {
			tmpDir = "C:\\tmp\\sajust_db";
		} else {
			tmpDir = "/tmp/sajust_dir";
		}
		
		File tDirFile = new File(tmpDir);
		if (tDirFile.exists()) tDirFile.delete();
		
		if (!(new File(tmpDir)).mkdirs()) {
			throw new FileSystemException("Failed to create temp folder");
		}
	}
	
	public void run() {
		/** Display the main menu, prompt the user for which db type is being used
		 * 
		 */
		while (true) {
			System.out.println("CMPUT 291 Project 2");
			System.out.println("-------------------");
			System.out.println("Select Test Option");
			System.out.println("1) btree");
			System.out.println("2) hash");
			System.out.println("3) indexfile");
			System.out.println("0) Exit");
			
			BufferedReader br = null;
			br = new BufferedReader(new InputStreamReader(System.in));
			Integer inputnumber = 0;
			try {
				String input = br.readLine();
				inputnumber = Integer.parseInt(input);
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (NumberFormatException e) {
				System.out.println("Invalid Entry, please try again");
				continue;
			}
			
			switch(inputnumber) {
			case 1: break;
			case 2: break;
			case 3: break;
			}
			
		}
		
	}
	
	public void cleanup() {
		File tDirFile = new File(tmpDir);
		if (tDirFile.exists()) tDirFile.delete();
	}

}

@@ -178,17 +178,16 @@
 seApp %7B%0A
-%0A
 %09private
@@ -203,16 +203,33 @@
 mpDir;%0A%09
+Integer mode = 0;
 %0A%09public
@@ -323,16 +323,20 @@
 p.setup(
+args
 );%0A%09%09%09ap
@@ -656,1126 +656,480 @@
 %09%7D%0A%09
-%09%0A%09%09File tDirFile = new File(tmpDir);%0A%09%09if (tDirFile.exists()) tDirFile.delete();%0A%09%09%0A%09%09if (!(new File(tmpDir)).mkdirs()) %7B%0A%09%09%09throw new FileSystemException(%22Failed to create temp folder%22);%0A%09%09%7D%0A%09%7D%0A%09%0A%09public void run() %7B%0A%09%09/** Display the main menu, prompt the user for which db type is being used
+public void setup(String%5B%5D args) %7B%0A%09%09/** Select the appropriate mode based on commandline arguments
 %0A%09%09 *
- %0A%09%09 */%0A%09%09while (true) %7B%0A%09%09%09System.out.println(%22CMPUT 291 Project 2%22);%0A%09%09%09System.out.println(%22-------------------%22);%0A%09%09%09System.out.println(%22Select Test Option%22);%0A%09%09%09System.out.println(%221) btree%22);%0A%09%09%09System.out.println(%222) hash%22);%0A%09%09%09System.out.println(%223) indexfile%22);%0A%09%09%09System.out.println(%220) Exit%22)
+/%0A%09%09%0A%09%09if (args%5B0%5D.equals(%22btree%22)) this.mode = 1;%0A%09%09if (args%5B0%5D.equals(%22hash%22)) this.mode = 2;%0A%09%09if (args%5B0%5D.equals(%22indexfile%22)) this.mode = 3
 ;%0A%09%09
-%09
 %0A%09%09
-%09BufferedReader br = null;%0A%09%09%09br = new BufferedReader(new InputStreamReader(System.in));%0A%09%09%09Integer inputnumber = 0;%0A%09%09%09try %7B%0A%09%09%09%09String input = br.readLin
+File tDirFile = new File(tmpDir);%0A%09%09if (tDirFile.exists()) tDirFile.delet
 e();%0A%09%09
+%0A
 %09%09i
-nputnumber = Integer.parseInt(input);%0A%09%09%09%7D catch (IOException e) %7B%0A%09%09%09%09// TODO Auto-generated catch block%0A%09%09%09%09e.printStackTrace();%0A%09%09%09%7D catch (NumberFormatException e) %7B%0A%09%09%09%09System.out.println(%22Invalid Entry, please try again%22);%0A%09%09%09%09continue;%0A%09%09%09%7D%0A%09%09%09%0A%09%09%09switch(inputnumber) %7B%0A%09%09%09case 1: break;%0A%09%09%09case 2: break;%0A%09%09%09case 3: break;%0A%09%09%09%7D%0A%09%09%09%0A%09%09%7D
+f (!(new File(tmpDir)).mkdirs()) %7B%0A%09%09%09throw new FileSystemException(%22Failed to create temp folder%22);%0A%09%09%7D%0A%09%7D%0A%09%0A%09public void run() %7B%0A%09%09
 %0A%09%09%0A

Resolve merge conflict