-
- All Known Implementing Classes:
DefaultSimilarityManager
public interface SimilarityManagerThe manager forSimilarRules, usually derived fromFontConfigurations.- Since:
- April 25, 2019
-
-
Method Summary
Modifier and Type Method Description SimilarityManageraddSimilarity(SimilarRule rule)Adds aSimilarRuleto the internal list.java.util.Optional<SimilarRule>getRule(java.lang.String similarityRuleName)Gets the instance ofSimilarRulewith the given name.voidgetSafeRule(java.lang.String similarityRuleName, java.util.function.Consumer<SimilarRule> ruleConsumer)Gets a rule from the given name, and if found, sends it through the consumer.java.util.Optional<it.unimi.dsi.fastutil.objects.Object2DoubleMap.Entry<ImageLetter>>getSecondHighest(java.util.List<it.unimi.dsi.fastutil.objects.Object2DoubleMap.Entry<ImageLetter>> data)When given a list of the potential results of a character (Irrelevant what character it is), this will find the character lowest in the list that does not match the first character's letter and modifier to any of the addedSimilarRules.booleanisSimilar(ImageLetter first, ImageLetter second)Finds any matchingSimilarRules for the firstImageLetter, and then checks if the secondImageLetteralso matches any of them.SimilarityManagerremoveSimilarity(java.lang.Class<? extends SimilarRule> ruleClass)Removes aSimilarRulefrom the internal list if found.
-
-
-
Method Detail
-
addSimilarity
SimilarityManager addSimilarity(SimilarRule rule)
Adds aSimilarRuleto the internal list.- Parameters:
rule- TheSimilarRuleto add- Returns:
- The current
SimilarityManager
-
removeSimilarity
SimilarityManager removeSimilarity(java.lang.Class<? extends SimilarRule> ruleClass)
Removes aSimilarRulefrom the internal list if found.- Parameters:
ruleClass- TheSimilarRuleto add if found- Returns:
- The current
SimilarityManager
-
isSimilar
boolean isSimilar(ImageLetter first, ImageLetter second)
Finds any matchingSimilarRules for the firstImageLetter, and then checks if the secondImageLetteralso matches any of them.- Parameters:
first- The firstImageLettersecond- The secondImageLetter- Returns:
- If the two
ImageLetters are similar
-
getRule
java.util.Optional<SimilarRule> getRule(java.lang.String similarityRuleName)
Gets the instance ofSimilarRulewith the given name.- Parameters:
similarityRuleName- The name of theSimilarRuleto get, if present- Returns:
- A
SimilarRulewith the given name
-
getSafeRule
void getSafeRule(java.lang.String similarityRuleName, java.util.function.Consumer<SimilarRule> ruleConsumer)Gets a rule from the given name, and if found, sends it through the consumer. A message is sent saying theSimilarRuleis not found if one isn't found.- Parameters:
similarityRuleName- The name of theSimilarRuleto getruleConsumer- The consumer to be given theSimilarRuleif found
-
getSecondHighest
java.util.Optional<it.unimi.dsi.fastutil.objects.Object2DoubleMap.Entry<ImageLetter>> getSecondHighest(java.util.List<it.unimi.dsi.fastutil.objects.Object2DoubleMap.Entry<ImageLetter>> data)
When given a list of the potential results of a character (Irrelevant what character it is), this will find the character lowest in the list that does not match the first character's letter and modifier to any of the addedSimilarRules.- Parameters:
data- The possible combination data- Returns:
- If found, the second character
-
-