public void addString(String str) { char[] array = str.toCharArray(); strings.add(new TreeString(strings.size(), array)); logger.log(Level.INFO, String.format("Adding string \"%s\"", str)); ukkonenExtendSuffixTree(strings.size() - 1); // naiveExtendSuffixTree(strings.size()-1); }
// Returns boolean values: PASSED or FAILED private static boolean checkNames( Vector<String> expNames, Vector<String> retNames, String failMsg) { boolean status = PASSED; if (expNames.size() != retNames.size()) { status = FAILED; } else { boolean checked[] = new boolean[retNames.size()]; for (int i = 0; i < expNames.size(); i++) { int j = 0; for (; j < retNames.size(); j++) { if (!checked[j] && expNames.elementAt(i).equals(retNames.elementAt(j))) { checked[j] = true; break; } } if (j >= retNames.size()) { status = FAILED; break; } } } if (!status) { printFailMsg(expNames, retNames, failMsg); } return status; }
public synchronized TaskReport[] getReduceTaskReports(String jobid) { JobInProgress job = (JobInProgress) jobs.get(jobid); if (job == null) { return new TaskReport[0]; } else { Vector reports = new Vector(); Vector completeReduceTasks = job.reportTasksInProgress(false, true); for (Iterator it = completeReduceTasks.iterator(); it.hasNext(); ) { TaskInProgress tip = (TaskInProgress) it.next(); reports.add(tip.generateSingleReport()); } Vector incompleteReduceTasks = job.reportTasksInProgress(false, false); for (Iterator it = incompleteReduceTasks.iterator(); it.hasNext(); ) { TaskInProgress tip = (TaskInProgress) it.next(); reports.add(tip.generateSingleReport()); } return (TaskReport[]) reports.toArray(new TaskReport[reports.size()]); } }
public void loadNetwork() throws IOException { logger.log(Level.INFO, "Loading metabolism network..."); File file = props.getNetworkFile(); Mapper<String, MetabolicEntry> entryMapper = new MetabolicEntry.MetabolicMapper(); Parser<MetabolicEntry> parser = new Parser<MetabolicEntry>(file, entryMapper); while (parser.hasNext()) { MetabolicEntry entry = parser.next(); entries.add(entry); Rxn rxn = new Rxn( props, entry.getReaction(), entry.getAbbreviation(), entry.getReactionName(), entry.getORF()); reactions.put(entry.getAbbreviation(), rxn); locations.add(rxn.getLocation()); LogicalORFTree lot = new LogicalORFTree(entry.getORF()); ORFSet os = new ORFSet(entry.getORF()); totalORFs.addAll(os.getORFs()); orfSets.put(entry.getAbbreviation(), lot); } logger.log(Level.FINE, String.format("Loaded %d entries.", entries.size())); abbrevs = new MetabolismAbbreviations(props); abbrevs.loadAbbreviations(); logger.log(Level.FINEST, "Loaded abbrevations."); }
private static void printFailMsg( Vector<String> expNames, Vector<String> retNames, String failMsg) { out.println(); out.println(failMsg); if (expNames.size() == 0) { out.println("# there are NO expected logger names"); } else { out.println("# expected logger names (" + expNames.size() + "):"); for (int i = 0; i < expNames.size(); i++) { out.println(" expNames[" + i + "] = " + expNames.elementAt(i)); } } if (retNames.size() == 0) { out.println("# there are NO returned logger names"); } else { out.println("# returned logger names (" + retNames.size() + "):"); for (int i = 0; i < retNames.size(); i++) { out.println(" retNames[" + i + "] = " + retNames.elementAt(i)); } } }
public int size() { return strings.size(); }