ExtractPagesParameters extends MultiplePdfSourceMultipleOutputParameters implements PageRangeSelection,
        PagesSelection, OptimizableOutputTaskParameters, DiscardableOutlineTaskParameters { @Override public Set<Integer> getPages(int upperLimit) { Set<Integer> pages = new NullSafeSet<Integer>(); if (predefinedSetOfPages != PredefinedSetOfPages.NONE) { pages = predefinedSetOfPages.getPages(upperLimit); } else { for (PageRange range : pageSelection) { pages.addAll(range.getPages(upperLimit)); } } if (!invertSelection) { return pages; } Set<Integer> invertedPages = new NullSafeSet<Integer>(); for (int i = 1; i <= upperLimit; i++) { if (!pages.contains(i)) { invertedPages.add(i); } } return invertedPages; } ExtractPagesParameters();  ExtractPagesParameters(PredefinedSetOfPages predefinedSetOfPages); void addPageRange(PageRange range); void addAllPageRanges(Collection<PageRange> ranges); PredefinedSetOfPages getPredefinedSetOfPages(); @Override Set<PageRange> getPageSelection(); @Override Set<Integer> getPages(int upperLimit); List<Set<Integer>> getPagesSets(int upperLimit); @Override OptimizationPolicy getOptimizationPolicy(); @Override void setOptimizationPolicy(OptimizationPolicy optimizationPolicy); @Override boolean discardOutline(); @Override void discardOutline(boolean discardOutline); boolean isInvertSelection(); void setInvertSelection(boolean invertSelection); boolean isSeparateFileForEachRange(); void setSeparateFileForEachRange(boolean separateFileForEachRange); @Override int hashCode(); @Override boolean equals(Object other);  }
@Test public void getPages() { ExtractPagesParameters victim = new ExtractPagesParameters(PredefinedSetOfPages.EVEN_PAGES); assertEquals(5, victim.getPages(10).size()); ExtractPagesParameters victim2 = new ExtractPagesParameters(); victim2.addPageRange(new PageRange(12)); assertEquals(4, victim2.getPages(15).size()); }