LexoRank class

A LexoRank for generating lexicographical sort for efficient reordering list between to rank

Constructors

LexoRank({int alphabetSize = 26, bool reorderPosition = false})
Create a LexoRank instance that can be used to generate rank using specified alphabetSize
const

Properties

alphabetSize int
The size of all letters used to generate the rank
final
hashCode int
The hash code for this object.
no setterinherited
reorderPosition bool
This indicate that if first rank must be lower that second or not. if true then it will swap first with the second rank so that the first rank will lower rank if false then the first rank should be lower than the second rank otherwise throw exception
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

generateInitialRank({required int sizeOfItems, int rankLength = 5, String startRankLetter = 'a', String endRankLetter = 'z'}) List<String>
Generate a list of initial rank for re-balancing items
getRankBetween({required String firstRank, required String secondRank}) String
Generate a lexo rank between two rank.
nextLexo(String current) String
Generates the next lexicographically ranked string based on the input string.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
prevLexo(String current) String
Generates the previous lexicographically ranked string based on the input string.
shouldRebalanced(List<String> items, {required int maxRankLength, double maxThreshold = 0.5}) LexoRankItemsStat
Check if a list should be re-balanced or not depend on max rank length that exceed the maxThreshold of total items.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited