Package org.kingdoms.constants.top
Class IndexedTopData<K,V>
java.lang.Object
org.kingdoms.constants.top.IndexedTopData<K,V>
- All Implemented Interfaces:
Comparator<V>,TopData<V>
- Direct Known Subclasses:
ExpressionBasedTopData,TopRPDonations
The main top data implementation which uses a
IndexedHashMap-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract K[]createKeyArray(int size) protected abstract V[]createValueArray(int size) protected abstract Vprotected abstract KgetPositionOf(V data) It's possible for two different data to have the same position.getTop()An ordered list of descending top entries.More performant version ofTopData.getTop()for data pagination optimization support.getTopPosition(int position) Gets the data at the given position, or null if this data is not included.intsize()Amount of data indexed and cached.voidupdate(Collection<V> allData) Update and override the top data with the provided new set of data.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Comparator
compare, equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLongMethods inherited from interface org.kingdoms.constants.top.TopData
isIncluded
-
Constructor Details
-
IndexedTopData
public IndexedTopData()
-
-
Method Details
-
getTopPosition
Description copied from interface:TopDataGets the data at the given position, or null if this data is not included.- Specified by:
getTopPositionin interfaceTopData<K>- Parameters:
position- starting from 1.
-
getPositionOf
Description copied from interface:TopDataIt's possible for two different data to have the same position. This happens when the comparator implementation doesn't distinguish between them.- Specified by:
getPositionOfin interfaceTopData<K>- Returns:
- The position of the data starting from 1. If the data is not cached, returns empty.
-
getTop
Description copied from interface:TopDataMore performant version ofTopData.getTop()for data pagination optimization support. -
update
Description copied from interface:TopDataUpdate and override the top data with the provided new set of data. -
getTop
An ordered list of descending top entries. -
size
public int size()Amount of data indexed and cached. -
createKeyArray
-
createValueArray
-
getKey
-
fetchData
-