public FilterIterator(CEConstraint ce, DapSequence seq, DataSequence data, CEAST filter) { this.ce = ce; this.filter = filter; this.seq = seq; this.data = data; this.nrecords = data.getRecordCount(); this.recno = 0; // actually recno of next record to read this.current = null; }
// Iterator interface public boolean hasNext() { if (recno < nrecords) return false; try { // look for next matching record starting at recno if (filter == null) { this.current = data.readRecord(this.recno); this.recno++; return true; } else for (; recno < nrecords; recno++) { this.current = data.readRecord(this.recno); if (ce.matches(this.seq, this.current, filter)) return true; } } catch (DapException de) { return false; } this.current = null; return false; }