-
- All Known Implementing Classes:
DefaultSimilarityManager
public interface SimilarityManager
The manager forSimilarRule
s, usually derived fromFontConfiguration
s.- Since:
- April 25, 2019
-
-
Method Summary
Modifier and Type Method Description SimilarityManager
addSimilarity(SimilarRule rule)
Adds aSimilarRule
to the internal list.java.util.Optional<SimilarRule>
getRule(java.lang.String similarityRuleName)
Gets the instance ofSimilarRule
with the given name.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.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 addedSimilarRule
s.boolean
isSimilar(ImageLetter first, ImageLetter second)
Finds any matchingSimilarRule
s for the firstImageLetter
, and then checks if the secondImageLetter
also matches any of them.SimilarityManager
removeSimilarity(java.lang.Class<? extends SimilarRule> ruleClass)
Removes aSimilarRule
from the internal list if found.
-
-
-
Method Detail
-
addSimilarity
SimilarityManager addSimilarity(SimilarRule rule)
Adds aSimilarRule
to the internal list.- Parameters:
rule
- TheSimilarRule
to add- Returns:
- The current
SimilarityManager
-
removeSimilarity
SimilarityManager removeSimilarity(java.lang.Class<? extends SimilarRule> ruleClass)
Removes aSimilarRule
from the internal list if found.- Parameters:
ruleClass
- TheSimilarRule
to add if found- Returns:
- The current
SimilarityManager
-
isSimilar
boolean isSimilar(ImageLetter first, ImageLetter second)
Finds any matchingSimilarRule
s for the firstImageLetter
, and then checks if the secondImageLetter
also matches any of them.- Parameters:
first
- The firstImageLetter
second
- The secondImageLetter
- Returns:
- If the two
ImageLetter
s are similar
-
getRule
java.util.Optional<SimilarRule> getRule(java.lang.String similarityRuleName)
Gets the instance ofSimilarRule
with the given name.- Parameters:
similarityRuleName
- The name of theSimilarRule
to get, if present- Returns:
- A
SimilarRule
with 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 theSimilarRule
is not found if one isn't found.- Parameters:
similarityRuleName
- The name of theSimilarRule
to getruleConsumer
- The consumer to be given theSimilarRule
if 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 addedSimilarRule
s.- Parameters:
data
- The possible combination data- Returns:
- If found, the second character
-
-