public SimpleFeature next() throws IOException, IllegalArgumentException, NoSuchElementException { return delegate.next(); }
public SimpleFeature next() { if (!hasNext()) { throw new NoSuchElementException(); } try { return reader.next(); } catch (Exception e) { throw new RuntimeException("Reader failed", e); } }
SimpleFeature f = reader.next(); features.add(f); count++;
private void assertSortedOnDateAsc(SimpleFeatureReader fr) throws IllegalArgumentException, NoSuchElementException, IOException { Date prev = null; while (fr.hasNext()) { SimpleFeature f = fr.next(); Date curr = (Date) f.getAttribute("date"); if (prev != null) { assertTrue(prev.compareTo(curr) <= 0); } prev = curr; } }
private void assertSortedOnPeopleAsc(SimpleFeatureReader fr) throws IllegalArgumentException, NoSuchElementException, IOException { double prev = -1; while (fr.hasNext()) { SimpleFeature f = fr.next(); int curr = (Integer) f.getAttribute("PERSONS"); if (prev > 0) { assertTrue(curr >= prev); } prev = curr; } }
public SimpleFeature next() throws IOException, IllegalArgumentException, NoSuchElementException { return delegate.next(); }
@Test public void testSortNatural() throws IOException { // make it so that we are not going to hit the disk SimpleFeatureReader sr = null; try { sr = new SortedFeatureReader(fr, fidAsc, 1000); String prev = null; while (sr.hasNext()) { SimpleFeature f = sr.next(); String id = f.getID(); if (prev != null) { assertTrue(id.compareTo(prev) >= 0); } prev = id; } } finally { if (sr != null) { sr.close(); } } }
@Test public void testSortDescending() throws IOException { // make it so that we are not going to hit the disk SimpleFeatureReader sr = null; try { sr = new SortedFeatureReader(fr, peopleDesc, 1000); double prev = -1; while (sr.hasNext()) { SimpleFeature f = sr.next(); int curr = (Integer) f.getAttribute("PERSONS"); if (prev > 0) { assertTrue(curr <= prev); } prev = curr; } } finally { if (sr != null) { sr.close(); } } }
@Test public void testSortNaturalPartialLastPage() throws IOException { // make it so that we are not going to hit the disk, but // some of the data won't fit in the last page, used to be // left in memory and forgotten SimpleFeatureReader sr = null; try { final int PRIME = 173; sr = new SortedFeatureReader(fr, fidAsc, PRIME); String prev = null; int count = 0; while (sr.hasNext()) { SimpleFeature f = sr.next(); String id = f.getID(); if (prev != null) { assertTrue(id.compareTo(prev) >= 0); } prev = id; count++; } assertEquals(fc.size(), count); } finally { if (sr != null) { sr.close(); } } }
public SimpleFeature next() { if (!hasNext()) { throw new NoSuchElementException(); } try { return reader.next(); } catch (Exception e) { throw new RuntimeException("Reader failed", e); } }
SimpleFeature f = reader.next(); features.add(f); count++;