/** * Returns the index of the given page, or -1 if it does not exist. * * @param page The page to search for. * @return the zero-based index of the given page, or -1 if the page is not found. */ public int indexOf(PDPage page) { SearchContext context = new SearchContext(page); if (findPage(context, root)) { return context.index; } return -1; }
private boolean findPage(SearchContext context, COSDictionary node) { for (COSDictionary kid : getKids(node)) { if (context.found) { break; } if (isPageTreeNode(kid)) { findPage(context, kid); } else { context.visitPage(kid); } } return context.found; }
/** * Returns the index of the given page, or -1 if it does not exist. * * @param page The page to search for. * @return the zero-based index of the given page, or -1 if the page is not found. */ public int indexOf(PDPage page) { SearchContext context = new SearchContext(page); if (findPage(context, root)) { return context.index; } return -1; }
/** * Returns the index of the given page, or -1 if it does not exist. * * @param page The page to search for. * @return the zero-based index of the given page, or -1 if the page is not found. */ public int indexOf(PDPage page) { SearchContext context = new SearchContext(page); if (findPage(context, root)) { return context.index; } return -1; }
private boolean findPage(SearchContext context, COSDictionary node) { for (COSDictionary kid : getKids(node)) { if (context.found) { break; } if (isPageTreeNode(kid)) { findPage(context, kid); } else { context.visitPage(kid); } } return context.found; }
private boolean findPage(SearchContext context, COSDictionary node) { for (COSDictionary kid : getKids(node)) { if (context.found) { break; } if (isPageTreeNode(kid)) { findPage(context, kid); } else { context.visitPage(kid); } } return context.found; }