Answers a tuple with the page number (pn, index), if the page can be found and there are multiple. Pages are organized as dict of lists (allowing multiple pages on the same page number) {1:[page, page, ...], 2} TODO: Make a reversed table if this squential search sh
(self, page)
| 1161 | return None # No previous page found. |
| 1162 | |
| 1163 | def getPageNumber(self, page): |
| 1164 | """Answers a tuple with the page number (pn, index), if the page can |
| 1165 | be found and there are multiple. Pages are organized as dict of lists |
| 1166 | (allowing multiple pages on the same page number) |
| 1167 | |
| 1168 | {1:[page, page, ...], 2} |
| 1169 | |
| 1170 | TODO: Make a reversed table if this squential search shows to be slow |
| 1171 | in the future with large docs. |
| 1172 | """ |
| 1173 | for pn, pnPages in sorted(self.pages.items()): |
| 1174 | for index, pg in enumerate(pnPages): |
| 1175 | if page is pg: |
| 1176 | return (pn, 0) |
| 1177 | return None # Cannot find this page |
| 1178 | |
| 1179 | def getPageIndex(self, page): |
| 1180 | """Answer the index number of the page, if the page can be found |
no outgoing calls
no test coverage detected