@Test public void testPassesTargetFamilyAsNonFirstFamily() { byte[] fam = Bytes.toBytes("fam"); byte[] fam2 = Bytes.toBytes("fam2"); byte[] fam3 = Bytes.toBytes("way_after_family"); FamilyOnlyFilter filter = new FamilyOnlyFilter(fam2); KeyValue kv = new KeyValue(row, fam, qual, 10, val); ReturnCode code = filter.filterKeyValue(kv); assertEquals("Didn't filter out non-matching family!", ReturnCode.SKIP, code); kv = new KeyValue(row, fam2, qual, 10, val); code = filter.filterKeyValue(kv); assertEquals("Didn't pass matching family", ReturnCode.INCLUDE, code); kv = new KeyValue(row, fam3, qual, 10, val); code = filter.filterKeyValue(kv); assertEquals("Didn't filter out non-matching family!", ReturnCode.SKIP, code); }
@Override public ReturnCode filterKeyValue(KeyValue v) { if (done) { return ReturnCode.SKIP; } ReturnCode code = super.filterKeyValue(v); if (previousMatchFound) { if (code.equals(ReturnCode.SKIP)) { done = true; } } else { if (code.equals(ReturnCode.INCLUDE)) { previousMatchFound = true; } } return code; }
FamilyOnlyFilter extends FamilyFilter { @Override public ReturnCode filterKeyValue(KeyValue v) { if (done) { return ReturnCode.SKIP; } ReturnCode code = super.filterKeyValue(v); if (previousMatchFound) { if (code.equals(ReturnCode.SKIP)) { done = true; } } else { if (code.equals(ReturnCode.INCLUDE)) { previousMatchFound = true; } } return code; } }
FamilyOnlyFilter extends FamilyFilter { @Override public ReturnCode filterKeyValue(KeyValue v) { if (done) { return ReturnCode.SKIP; } ReturnCode code = super.filterKeyValue(v); if (previousMatchFound) { if (code.equals(ReturnCode.SKIP)) { done = true; } } else { if (code.equals(ReturnCode.INCLUDE)) { previousMatchFound = true; } } return code; } FamilyOnlyFilter(final byte[] family);  FamilyOnlyFilter(final WritableByteArrayComparable familyComparator); }
FamilyOnlyFilter extends FamilyFilter { @Override public ReturnCode filterKeyValue(KeyValue v) { if (done) { return ReturnCode.SKIP; } ReturnCode code = super.filterKeyValue(v); if (previousMatchFound) { if (code.equals(ReturnCode.SKIP)) { done = true; } } else { if (code.equals(ReturnCode.INCLUDE)) { previousMatchFound = true; } } return code; } FamilyOnlyFilter(final byte[] family);  FamilyOnlyFilter(final WritableByteArrayComparable familyComparator); @Override boolean filterAllRemaining(); @Override void reset(); @Override ReturnCode filterKeyValue(KeyValue v); }
FamilyOnlyFilter extends FamilyFilter { @Override public ReturnCode filterKeyValue(KeyValue v) { if (done) { return ReturnCode.SKIP; } ReturnCode code = super.filterKeyValue(v); if (previousMatchFound) { if (code.equals(ReturnCode.SKIP)) { done = true; } } else { if (code.equals(ReturnCode.INCLUDE)) { previousMatchFound = true; } } return code; } FamilyOnlyFilter(final byte[] family);  FamilyOnlyFilter(final WritableByteArrayComparable familyComparator); @Override boolean filterAllRemaining(); @Override void reset(); @Override ReturnCode filterKeyValue(KeyValue v);  }