@Test public void testAccept_ServerSpecifiedTimeRange() throws Exception { TimeRangeFilter filter = new TimeRangeFilter(new JCheckBox()); filter.startDate = new GregorianCalendar(2010, 0, 1).getTime(); filter.endDate = new GregorianCalendar(2010, 0, 2).getTime(); OpendapLeaf leaf = createLeaf(); assertFalse(filter.accept(leaf)); filter.startDate = new GregorianCalendar(2010, 0, 1).getTime(); filter.endDate = new GregorianCalendar(2011, 0, 2).getTime(); assertTrue(filter.accept(leaf)); filter.startDate = new GregorianCalendar(2010, 0, 2).getTime(); filter.endDate = null; assertFalse(filter.accept(leaf)); filter.startDate = null; filter.endDate = new GregorianCalendar(2010, 11, 31).getTime(); assertFalse(filter.accept(leaf)); filter.startDate = new GregorianCalendar(2009, 11, 31).getTime(); filter.endDate = null; assertTrue(filter.accept(leaf)); filter.startDate = null; filter.endDate = new GregorianCalendar(2011, 11, 31).getTime(); assertTrue(filter.accept(leaf)); }
@Override public boolean accept(OpendapLeaf leaf) { DateRange timeCoverage = leaf.getDataset().getTimeCoverage(); if (timeCoverage != null) { return fitsToServerSpecifiedTimeRange(timeCoverage); } return timeStampExtractor == null || fitsToUserSpecifiedTimeRange(leaf); }
TimeRangeFilter implements FilterComponent { @Override public boolean accept(OpendapLeaf leaf) { DateRange timeCoverage = leaf.getDataset().getTimeCoverage(); if (timeCoverage != null) { return fitsToServerSpecifiedTimeRange(timeCoverage); } return timeStampExtractor == null || fitsToUserSpecifiedTimeRange(leaf); } }
TimeRangeFilter implements FilterComponent { @Override public boolean accept(OpendapLeaf leaf) { DateRange timeCoverage = leaf.getDataset().getTimeCoverage(); if (timeCoverage != null) { return fitsToServerSpecifiedTimeRange(timeCoverage); } return timeStampExtractor == null || fitsToUserSpecifiedTimeRange(leaf); } TimeRangeFilter(final JCheckBox filterCheckBox); }
TimeRangeFilter implements FilterComponent { @Override public boolean accept(OpendapLeaf leaf) { DateRange timeCoverage = leaf.getDataset().getTimeCoverage(); if (timeCoverage != null) { return fitsToServerSpecifiedTimeRange(timeCoverage); } return timeStampExtractor == null || fitsToUserSpecifiedTimeRange(leaf); } TimeRangeFilter(final JCheckBox filterCheckBox); @Override JComponent getUI(); @Override boolean accept(OpendapLeaf leaf); @Override void addFilterChangeListener(FilterChangeListener listener); }
TimeRangeFilter implements FilterComponent { @Override public boolean accept(OpendapLeaf leaf) { DateRange timeCoverage = leaf.getDataset().getTimeCoverage(); if (timeCoverage != null) { return fitsToServerSpecifiedTimeRange(timeCoverage); } return timeStampExtractor == null || fitsToUserSpecifiedTimeRange(leaf); } TimeRangeFilter(final JCheckBox filterCheckBox); @Override JComponent getUI(); @Override boolean accept(OpendapLeaf leaf); @Override void addFilterChangeListener(FilterChangeListener listener); static final Logger LOG; }