Formatter
SpanGradientFormatter
public class GradientFormatter extends Object implements Formatter
Modifier and Type | Field | Description |
---|---|---|
protected boolean |
highlightBackground |
|
protected boolean |
highlightForeground |
Constructor | Description |
---|---|
GradientFormatter(float maxScore,
String minForegroundColor,
String maxForegroundColor,
String minBackgroundColor,
String maxBackgroundColor) |
Sets the color range for the IDF scores
|
Modifier and Type | Method | Description |
---|---|---|
protected String |
getBackgroundColorString(float score) |
|
protected String |
getForegroundColorString(float score) |
|
static int |
hexToInt(String hex) |
Converts a hex string into an int.
|
String |
highlightTerm(String originalText,
TokenGroup tokenGroup) |
protected boolean highlightForeground
protected boolean highlightBackground
public GradientFormatter(float maxScore, String minForegroundColor, String maxForegroundColor, String minBackgroundColor, String maxBackgroundColor)
maxScore
- The score (and above) displayed as maxColor (See QueryScorer.getMaxWeight
which can be used to calibrate scoring scale)minForegroundColor
- The hex color used for representing IDF scores of zero eg
#FFFFFF (white) or null if no foreground color requiredmaxForegroundColor
- The largest hex color used for representing IDF scores eg
#000000 (black) or null if no foreground color requiredminBackgroundColor
- The hex color used for representing IDF scores of zero eg
#FFFFFF (white) or null if no background color requiredmaxBackgroundColor
- The largest hex color used for representing IDF scores eg
#000000 (black) or null if no background color requiredpublic String highlightTerm(String originalText, TokenGroup tokenGroup)
highlightTerm
in interface Formatter
originalText
- The section of text being considered for markuptokenGroup
- contains one or several overlapping Tokens along with
their scores and positions.protected String getForegroundColorString(float score)
protected String getBackgroundColorString(float score)
public static final int hexToInt(String hex)
hex
- A string in capital or lower case hex, of no more then 16
characters.NumberFormatException
- if the string is more than 16 characters long, or if any
character is not in the set [0-9a-fA-f]Copyright © 2000-2018 Apache Software Foundation. All Rights Reserved.