boolean function ( int arg0 , PageText arg1 ) { WeakReference < PageText > loc0 = searchResultCache . get ( arg0 ) ; if ( loc0 == null ) { return false ; } PageText loc1 = loc0 . get ( ) ; return loc1 == null || ! loc1 . equals ( arg1 ) ; }
when we know a page has a hit but are n't sure if pagetext is still in a highlighted state we can use this method to check . if the weekreference for the pageindex exists we can compare it aginst the paramate pagetext . if the objects are equal there is no need to search again . if reference is null or not equal then we have to do the search again to get the highlight state back . pages searches in general are extremely fast and performs better then trying to keep everything in memory . concode_field_sep HashMap<Integer,WeakReference<PageText>> searchResultCache concode_elem_sep ArrayList<SearchTerm> searchTerms concode_field_sep void addPageSearchHit concode_elem_sep Set<Integer> getPageSearchHits concode_elem_sep void removeSearchTerm concode_elem_sep ArrayList<SearchTerm> getSearchTerms concode_elem_sep void clearSearchResults concode_elem_sep void clearSearchResults concode_elem_sep boolean isPageSearchHit concode_elem_sep PageText getPageTextHit concode_elem_sep void addSearchTerm