@Test public void extractIdsFromTree() { TestTaxonListener listener = new TestTaxonListener(); InputStream inputStream = getClass().getResourceAsStream("/otl.tre"); assertThat(inputStream, is(notNullValue())); OpenTreeUtil.extractIdsFromTree(listener, inputStream); assertThat(listener.getCount(), is(2628157)); }
public static void extractIdsFromTree(TaxonListener listener, InputStream inputStream) { Pattern idPattern = Pattern.compile("_ott[0-9]+"); Scanner scanner = new Scanner(inputStream, "UTF-8"); scanner.useDelimiter("[\\),]"); String taxonId; while ((taxonId = scanner.findWithinHorizon(idPattern, 0)) != null) { listener.addTaxonId(taxonId); } }
OpenTreeUtil { public static void extractIdsFromTree(TaxonListener listener, InputStream inputStream) { Pattern idPattern = Pattern.compile("_ott[0-9]+"); Scanner scanner = new Scanner(inputStream, "UTF-8"); scanner.useDelimiter("[\\),]"); String taxonId; while ((taxonId = scanner.findWithinHorizon(idPattern, 0)) != null) { listener.addTaxonId(taxonId); } } }
OpenTreeUtil { public static void extractIdsFromTree(TaxonListener listener, InputStream inputStream) { Pattern idPattern = Pattern.compile("_ott[0-9]+"); Scanner scanner = new Scanner(inputStream, "UTF-8"); scanner.useDelimiter("[\\),]"); String taxonId; while ((taxonId = scanner.findWithinHorizon(idPattern, 0)) != null) { listener.addTaxonId(taxonId); } }  }
OpenTreeUtil { public static void extractIdsFromTree(TaxonListener listener, InputStream inputStream) { Pattern idPattern = Pattern.compile("_ott[0-9]+"); Scanner scanner = new Scanner(inputStream, "UTF-8"); scanner.useDelimiter("[\\),]"); String taxonId; while ((taxonId = scanner.findWithinHorizon(idPattern, 0)) != null) { listener.addTaxonId(taxonId); } }  static void readTaxonomy(OpenTreeListener listener, InputStream inputStream); static void extractIdsFromTree(TaxonListener listener, InputStream inputStream); }
OpenTreeUtil { public static void extractIdsFromTree(TaxonListener listener, InputStream inputStream) { Pattern idPattern = Pattern.compile("_ott[0-9]+"); Scanner scanner = new Scanner(inputStream, "UTF-8"); scanner.useDelimiter("[\\),]"); String taxonId; while ((taxonId = scanner.findWithinHorizon(idPattern, 0)) != null) { listener.addTaxonId(taxonId); } }  static void readTaxonomy(OpenTreeListener listener, InputStream inputStream); static void extractIdsFromTree(TaxonListener listener, InputStream inputStream);  }