int (AbsoluteSymbolPosition absolutePosition) { if (absolutePosition == null || pagesInDocument.size() == 0) { return 0; } if (absolutePosition.pageNumber < getFirstPage().getPageNumber()) { return 0; } if (absolutePosition.pageNumber > getLastPage().getPageNumber()) { return myDocument.getTextLength(); } for (int i = 0; i < pagesInDocument.size(); i++) { if (absolutePosition.pageNumber == pagesInDocument.get(i).getPageNumber()) { return getSymbolOffsetToStartOfPage(i) + absolutePosition.symbolOffsetInPage; } } // unreachable code LOG.warn(new UnsupportedOperationException("absolutePosition=" + absolutePosition + " document.length=" + myDocument.getTextLength() + " pagesInDocument.size=" + pagesInDocument.size())); return 0; }