Class ChronicleMapAdapter
java.lang.Object
org.opengrok.suggest.popular.impl.chronicle.ChronicleMapAdapter
- All Implemented Interfaces:
 AutoCloseable,PopularityCounter,PopularityMap
Adapter for 
ChronicleMap to expose only the necessary operations needed for most popular completion.- 
Constructor Summary
ConstructorsConstructorDescriptionChronicleMapAdapter(String name, double averageKeySize, int entries, File file)  - 
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the openedChronicleMap.intget(org.apache.lucene.util.BytesRef key) For the termkeyreturns the number the term was searched for.getPopularityData(int page, int pageSize) Returns the popularity data sorted according to their value.voidincrement(org.apache.lucene.util.BytesRef key, int value) Increment data for thekeybyvalue.voidRemoves the entries with key that meets the predicate.voidresize(int newMapSize, double newMapAvgKey) Resizes the underlyingChronicleMap. 
- 
Constructor Details
- 
ChronicleMapAdapter
public ChronicleMapAdapter(String name, double averageKeySize, int entries, File file) throws IOException - Throws:
 IOException
 
 - 
 - 
Method Details
- 
get
public int get(org.apache.lucene.util.BytesRef key) For the termkeyreturns the number the term was searched for.- Specified by:
 getin interfacePopularityCounter- Parameters:
 key- the term to retrieve data for- Returns:
 - number of times the 
keywas searched for 
 - 
increment
public void increment(org.apache.lucene.util.BytesRef key, int value) Increment data for thekeybyvalue.- Specified by:
 incrementin interfacePopularityMap- Parameters:
 key- term to increment data forvalue- positive value by which to increment the data
 - 
getPopularityData
public List<Map.Entry<org.apache.lucene.util.BytesRef,Integer>> getPopularityData(int page, int pageSize) Returns the popularity data sorted according to their value.- Specified by:
 getPopularityDatain interfacePopularityMap- Parameters:
 page- which page of data to retrievepageSize- number of results to return- Returns:
 - popularity data sorted according to their value
 
 - 
removeIf
Removes the entries with key that meets the predicate.- Parameters:
 predicate- predicate which tests which entries should be removed
 - 
resize
Resizes the underlyingChronicleMap.- Parameters:
 newMapSize- new entries countnewMapAvgKey- new average key size- Throws:
 IOException- if some error occurred
 - 
close
public void close()Closes the openedChronicleMap.- Specified by:
 closein interfaceAutoCloseable- Specified by:
 closein interfacePopularityMap
 
 -