FilteredConstraint extends Constraint { @Override public SeekingCurrentIterator getResultIterator() { return new FilteringIterator(this.subconstraint.getResultIterator(), this.filter); } FilteredConstraint();  FilteredConstraint(Constraint subconstraint, Filter filter); @Override void readFields(DataInput in); @Override void write(DataOutput out); @Override SeekingCurrentIterator getResultIterator();  }
@Test public void testGetResultIterator() { TableAdapter table = new InMemoryTable(); List<CKeyValue> values = new ArrayList<CKeyValue>(); values.add(new CKeyValue(new byte[] { 1 })); values.add(new CKeyValue(new byte[] { 2 }, new byte[] { 3 }, new byte[] { 4 })); values.add(new CKeyValue(new byte[] { 3 }, new byte[] { 4 }, new byte[] { 5 }, 0, new byte[] { 6 })); table.put(new Put(values)); FilteredConstraint filter = new FilteredConstraint(new ResultFilter(table), new Filter()); Utils.testResultIterator(filter.getResultIterator(), 3, 3); SeekingCurrentIterator iter = filter.getResultIterator(); assertTrue(iter.current() == null); iter.seek(new byte[] { 2 }); assertTrue(iter.current() != null); assertTrue(iter.hasNext()); assertArrayEquals(new byte[] { 3 }, iter.next().getRecordId()); filter = new FilteredConstraint(new ResultFilter(table), new AcceptNoneFilter()); Utils.testResultIterator(filter.getResultIterator(), 0, 0); }