|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.twitter.HitHighlighter
public class HitHighlighter
A class for adding HTML highlighting in Tweet text (such as would be returned from a Search)
Field Summary | |
---|---|
static java.lang.String |
DEFAULT_HIGHLIGHT_TAG
Default HTML tag for highlight hits |
protected java.lang.String |
highlightTag
the current HTML tag used for hit highlighting |
Constructor Summary | |
---|---|
HitHighlighter()
Create a new HitHighlighter object. |
Method Summary | |
---|---|
java.lang.String |
getHighlightTag()
Get the current HTML tag used for phrase highlighting. |
java.lang.String |
highlight(java.lang.String text,
java.util.List<java.util.List<java.lang.Integer>> hits)
Surround the hits in the provided text with an HTML tag. |
void |
setHighlightTag(java.lang.String highlightTag)
Set the current HTML tag used for phrase highlighting. |
protected java.lang.String |
tag(boolean closeTag)
Format the current highlightTag by adding < and >. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String DEFAULT_HIGHLIGHT_TAG
protected java.lang.String highlightTag
Constructor Detail |
---|
public HitHighlighter()
Method Detail |
---|
public java.lang.String highlight(java.lang.String text, java.util.List<java.util.List<java.lang.Integer>> hits)
hits
in the provided text
with an HTML tag. This is used with offsets
from the search API to support the highlighting of query terms.
text
- of the Tweet to highlighthits
- A List of highlighting offsets (themselves lists of two elements)
protected java.lang.String tag(boolean closeTag)
highlightTag
by adding < and >. If closeTag
is true
then the tag returned will include a /
to signify a closing tag.
true
- if this is a closing tag, false otherwisepublic java.lang.String getHighlightTag()
public void setHighlightTag(java.lang.String highlightTag)
new
- HTML tag (without < or >)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |