/** * Returns the next element in the iteration. * * @return the next element in the iteration * @throws java.util.NoSuchElementException if the iteration has no more elements. */ // PointFeatureIterator.next() doesn't actually specify the behavior of next() when there are no more elements, // but we can define a stronger contract. @Override public PointFeature next() throws NoSuchElementException { if (!hasNext()) { throw new NoSuchElementException("This iterator has no more elements."); } assert pointFeature != null; PointFeature ret = pointFeature; calcBounds(ret); pointFeature = null; // Feature has been consumed. return ret; }
public boolean hasNext() throws IOException { pointFeature = nextFilteredDataPoint(); boolean done = (pointFeature == null); if (done) finish(); return !done; }
/** * Returns {@code true} if the iteration has more elements. (In other words, returns {@code true} if {@link #next} * would return an element rather than throwing an exception.) * <p/> * This method is <i>idempotent</i>, meaning that when it is called repeatedly without an intervening * {@link #next}, calls after the first will have no effect. * * @return {@code true} if the iteration has more elements */ // PointFeatureIterator.hasNext() doesn't guarantee idempotency, but we do. @Override public boolean hasNext() { if (pointFeature != null) { return true; // pointFeature hasn't yet been consumed. } pointFeature = nextFilteredDataPoint(); if (pointFeature == null) { close(); return false; } else { return true; } }
@Override public PointFeatureIterator getPointFeatureIterator() throws IOException { return new PointIteratorFiltered(from.getPointFeatureIterator(), filter_bb, filter_date); } }
public void finish() { if (finished) return; orgIter.finish(); finishCalcBounds(); finished = true; }
public PointFeature next() throws IOException { if (pointFeature == null) return null; calcBounds(pointFeature); return pointFeature; }
private PointFeature nextFilteredDataPoint() throws IOException { if ( orgIter == null) return null; if (!orgIter.hasNext()) return null; PointFeature pdata = orgIter.next(); while (!filter(pdata)) { if (!orgIter.hasNext()) return null; pdata = orgIter.next(); } return pdata; }
public PointFeatureIterator getPointFeatureIterator(int bufferSize) throws IOException { return new PointIteratorFiltered(from.getPointFeatureIterator(bufferSize), this.boundingBox, this.dateRange); } }
@Override public void close() { origIter.close(); finishCalcBounds(); }
public PointFeature next() throws IOException { if (pointFeature == null) return null; calcBounds(pointFeature); return pointFeature; }
private PointFeature nextFilteredDataPoint() throws IOException { if ( orgIter == null) return null; if (!orgIter.hasNext()) return null; PointFeature pdata = orgIter.next(); while (!filter(pdata)) { if (!orgIter.hasNext()) return null; pdata = orgIter.next(); } return pdata; }
@Override public PointFeatureIterator getPointFeatureIterator(int bufferSize) throws IOException { return new PointIteratorFiltered(from.getPointFeatureIterator(bufferSize), null, this.dateRange); }
public boolean hasNext() throws IOException { pointFeature = nextFilteredDataPoint(); boolean done = (pointFeature == null); if (done) finish(); return !done; }
public void finish() { if (finished) return; orgIter.finish(); finishCalcBounds(); finished = true; }
public PointFeatureIterator getPointFeatureIterator(int bufferSize) throws IOException { return new PointIteratorFiltered(from.getPointFeatureIterator(bufferSize), this.boundingBox, this.dateRange); } }
@Override public PointFeatureIterator getPointFeatureIterator() throws IOException { return new PointIteratorFiltered(from.getPointFeatureIterator(), null, filter_date); }
public PointFeatureIterator getPointFeatureIterator(int bufferSize) throws IOException { return new PointIteratorFiltered(from.getPointFeatureIterator(bufferSize), null, this.dateRange); }