Package com.mapr.baseutils.utils
Class GenericSorter<T>
- java.lang.Object
-
- com.mapr.baseutils.utils.GenericSorter<T>
-
public abstract class GenericSorter<T> extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description GenericSorter()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description intcompareBoolean(java.lang.Boolean b1, java.lang.Boolean b2)intcompareLong(java.lang.Long l1, java.lang.Long l2)intcompareString(java.lang.String s1, java.lang.String s2)intcompareStringIgnoreCase(java.lang.String s1, java.lang.String s2)protected abstract java.util.List<T>getFreshList(com.mapr.fs.cldb.proto.CLDBProto.ListSortKey sortingKey)Child class shall implement logic of creating list.java.util.List<T>getSortedList(com.mapr.fs.cldb.proto.CLDBProto.ListSortKey sortingKey)Returns list sorted by requested key.protected abstract intgetSortedListRefreshSeconds()protected voidlogMessage(java.lang.String str)booleanpurgeExpiredList()Method to be called by PurgeExecutor for purging old entries.abstract voidsortList(java.util.List<T> list, com.mapr.fs.cldb.proto.CLDBProto.ListSortKey sortingKey)Child class shall implement logic of sorting given list by specified order.
-
-
-
Method Detail
-
sortList
public abstract void sortList(java.util.List<T> list, com.mapr.fs.cldb.proto.CLDBProto.ListSortKey sortingKey)
Child class shall implement logic of sorting given list by specified order.
-
getFreshList
protected abstract java.util.List<T> getFreshList(com.mapr.fs.cldb.proto.CLDBProto.ListSortKey sortingKey)
Child class shall implement logic of creating list.
-
getSortedListRefreshSeconds
protected abstract int getSortedListRefreshSeconds()
-
getSortedList
public java.util.List<T> getSortedList(com.mapr.fs.cldb.proto.CLDBProto.ListSortKey sortingKey)
Returns list sorted by requested key. Maintains SortedListMap by storing list against create time. Returns list from SortedListMap if the list was recently sorted, else returns a freshly sorted list, after storing it in SortedListMap.
-
logMessage
protected void logMessage(java.lang.String str)
-
compareLong
public int compareLong(java.lang.Long l1, java.lang.Long l2)
-
compareString
public int compareString(java.lang.String s1, java.lang.String s2)
-
compareBoolean
public int compareBoolean(java.lang.Boolean b1, java.lang.Boolean b2)
-
compareStringIgnoreCase
public int compareStringIgnoreCase(java.lang.String s1, java.lang.String s2)
-
purgeExpiredList
public boolean purgeExpiredList()
Method to be called by PurgeExecutor for purging old entries. If the list has out lived its validity threshold, it is purged not otherwise.
-
-