//determine frequency of particular Dewey Decimal ranges public ArrayList loadTransactions() { ArrayList transactions = new ArrayList(); String[] lines = loadStrings("splxmldata.txt"); for (int i = 0; i < lines.length; i++) { transactions.add(parseTransaction(lines[i])); } return transactions; } // This function returns all the files in a directory as an array of File objects // This is useful if you want more info about the file public File[] listFiles(String dir) { File file = new File(dir); if (file.isDirectory()) { File[] files = file.listFiles(); return files; } else { // If it's not a directory return null; } } //create a new transaction obejct from a comma separated line. public Transaction parseTransaction(String line) { no.put("how", ""); no.put("our", ""); no.put("where", ""); no.put("its", ""); no.put("this", ""); no.put("whats", ""); no.put("for", ""); no.put("you", ""); no.put("new", ""); no.put("when", ""); no.put("case", ""); no.put("say", ""); no.put("like", ""); no.put("just", ""); no.put("but", ""); no.put("they", ""); no.put("see", ""); no.put("her", ""); no.put("his", ""); no.put("the", ""); no.put("all", ""); no.put("into", ""); no.put("and", ""); no.put("our", ""); no.put("from", ""); no.put("what", ""); no.put("with", ""); no.put("there", ""); no.put("that", ""); no.put("your", ""); no.put("every", ""); no.put("their", ""); no.put("book", ""); no.put("first", ""); no.put("introduction", ""); no.put("lifes", ""); no.put("version", ""); no.put("times", ""); no.put("can", ""); no.put("making", ""); no.put("108", ""); String sections[] = split(line, ","); Transaction t = new Transaction(); //store all fields // t.itemNumber = sections[0]; // t.bibNumber = sections[1]; // t.ckodate = sections[0]; // t.ckotime = sections[3]; // t.ckidate = sections[4]; // t.ckitime = sections[5]; // t.collcode = sections[6]; // t.itemtype = sections[1]; // t.barcode = sections[8]; t.title = sections[0]; // t.callNumber = sections[10]; t.deweyClass = sections[1]; //add this to the hashmap containing the titles //if(hm.size() < 1000){ if(!titleStrings.containsKey(t.title)){ hm.put(t.title,t.deweyClass); titleStrings.put(t.title, 0); }else{ int count = int(titleStrings.get(t.title).toString()); titleStrings.put(t.title, ++count); } //} return t; }