Skip to content
Snippets Groups Projects
Commit a3b24571 authored by Christopher Schankula's avatar Christopher Schankula :earth_africa:
Browse files

first success processing entire dataset -- still null pointers

parent 4d522b2b
No related branches found
No related tags found
No related merge requests found
......@@ -13,7 +13,7 @@ public class BioTree {
private static BST<String, Integer> incorrectNames = new BST<String, Integer>();
public static void main(String[] args) throws IOException, ParseException {
BioTree.processRecord("Catostomus commersoni");
BioTree.processRecord("Micropterus dolomieui");
}
/**
......@@ -69,6 +69,7 @@ public class BioTree {
*/
public static Integer processRecord(String scientificName) throws IOException, ParseException {
//reverse lookup based on name, try adding the found taxonId.
System.out.println("Processing " + scientificName);
TaxonNode res = strNodes.get(scientificName);
if (res == null) {
System.out.println("Not already found.");
......@@ -77,6 +78,7 @@ public class BioTree {
res = idNodes.get(incorrectNameId);
}
Integer taxonId = null;
//if the taxonId was not found in the local database
if (res == null) {
try {
taxonId = WormsAPI.nameToID(scientificName);
......@@ -84,15 +86,17 @@ public class BioTree {
taxonId = WormsAPI.nameToRecordID(scientificName);
if (taxonId != null)
incorrectNames.put(scientificName, taxonId);
else
else {
incorrectNames.put(scientificName, -1);
}
}
if (taxonId == -999)
taxonId = WormsAPI.fuzzyNameToID(scientificName);
}
else
taxonId = res.getTaxonId();
if (taxonId == null) return null;
if (taxonId == -999)
taxonId = WormsAPI.fuzzyNameToID(scientificName);
if (processTaxonId(taxonId)) return null;
return taxonId;
}
......
......@@ -74,6 +74,9 @@ public class FileProcessor {
s.close();//Testing ONLY
br.close();
fr.close();
Scanner sc = new Scanner(System.in);
int j = sc.nextInt();
}
catch (IOException e) {
e.printStackTrace();
......
......@@ -74,8 +74,6 @@ public class KDT<KeyVal extends Comparable<KeyVal>> {
MergeSort.sort(keyvals, lo, hi, axes.get(axis));
KeyVal median = (KeyVal) keyvals[mid];
System.out.println(median);
//TODO: fix size
Node newNode = new Node(median, 0);
newNode.left = buildTree(keyvals, lo, mid - 1, depth + 1);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment