T - the type for the rank comparisonpublic class RankingHelper<T> extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
RankingHelper.RankTester<T>
Helper callback interface for rank testing.
|
| Modifier and Type | Field and Description |
|---|---|
static double |
DEFAULT_INITIAL_RANK
Value used to initialize the rank comparison in case no initialRank value is passed.
|
| Constructor and Description |
|---|
RankingHelper(Class<?> elementClass,
double initialRank)
Constructor which disables ignore rank feature.
|
RankingHelper(Class<?> elementClass,
double initialRank,
Double ignoreRankValue)
The main constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected String |
createWarning(List<T> highestRankingElements,
double rank)
Create warning about clashing priorities.
|
T |
getHighestRankingElement(Collection<T> elements,
RankingHelper.RankTester<T> rankTester)
Determine the highest ranking element by iterating over all elements and calling rankTester.getRank().
|
protected void |
reportClashingPriorities(String warningMessage)
Report clashing priorities using ReportService.
|
public static final double DEFAULT_INITIAL_RANK
public RankingHelper(Class<?> elementClass, double initialRank)
elementClass - the class the prioritization is based on, required for logging purposesinitialRank - the initialization value for the rank comparison (see INITIAL_RANK)public RankingHelper(Class<?> elementClass, double initialRank, Double ignoreRankValue)
elementClass - the class the prioritization is based on, required for logging purposesinitialRank - the initialization value for the rank comparison (see INITIAL_RANK)ignoreRankValue - a specific value which will result in the given element being omitted.
Must be non-null otherwise this feature is not enabled.public T getHighestRankingElement(Collection<T> elements, RankingHelper.RankTester<T> rankTester)
elements - the elements to considerrankTester - the tester instance to fetch a rank/priority for a given elementprotected String createWarning(List<T> highestRankingElements, double rank)
highestRankingElements - list of clashing elementsrank - the rank of the elementsprotected void reportClashingPriorities(String warningMessage)
warningMessage - the warning messageCopyright © 2019. All rights reserved.