### Question:
SamRecordFilters extends AlignmentFilters<SAMRecord> { @Override public SamRecordFilters addMappingQualityFilter(int mappingQuality) { filters.add(samRecord -> samRecord.getMappingQuality() >= mappingQuality); return this; } SamRecordFilters();  SamRecordFilters(List<Predicate<SAMRecord>> filters); static SamRecordFilters create(); @Override SamRecordFilters addMappingQualityFilter(int mappingQuality); @Override SamRecordFilters addMaxNumberMismatchesFilter(int maxNumberMismatches); @Override SamRecordFilters addMaxNumberHitsFilter(int maxNumberHits); @Override SamRecordFilters addProperlyPairedFilter(); @Override SamRecordFilters addInsertSizeFilter(int maxInsertSize); @Override SamRecordFilters addUnmappedFilter(); @Override SamRecordFilters addDuplicatedFilter(); @Override SamRecordFilters addRegionFilter(Region region, boolean contained); @Override SamRecordFilters addRegionFilter(List<Region> regions, boolean contained);  }### Answer:
@Test public void testOR() throws Exception { Path inputPath = Paths.get(getClass().getResource("/HG00096.chrom20.small.bam").toURI()); BamManager BamManager = new BamManager(inputPath); AlignmentOptions options = new AlignmentOptions().setContained(false); SamRecordFilters alignmentFilters = new SamRecordFilters(); Region region = new Region("20", 60000, 65000); SamRecordFilters tmpFilters = new SamRecordFilters(); tmpFilters.addMappingQualityFilter(60); tmpFilters.addMappingQualityFilter(35); alignmentFilters.addFilterList(tmpFilters.getFilters(), true); List<SAMRecord> results = BamManager.query(region, alignmentFilters, options); System.out.println("Number of results: " + results.size()); assertEquals(108, results.size()); }
@Test public void testAND() throws Exception { Path inputPath = Paths.get(getClass().getResource("/HG00096.chrom20.small.bam").toURI()); BamManager BamManager = new BamManager(inputPath); AlignmentOptions options = new AlignmentOptions().setContained(false); SamRecordFilters alignmentFilters = new SamRecordFilters(); Region region = new Region("20", 60000, 65000); SamRecordFilters tmpFilters = new SamRecordFilters(); tmpFilters.addMappingQualityFilter(60); tmpFilters.addMappingQualityFilter(35); alignmentFilters.addFilterList(tmpFilters.getFilters(), false); List<SAMRecord> results = BamManager.query(region, alignmentFilters, options); System.out.println("Number of results: " + results.size()); assertEquals(96, results.size()); }