com.twitter.twittertext

## Class HitHighlighter

- java.lang.Object
- - com.twitter.twittertext.HitHighlighter

-     public class HitHighlighter
      extends java.lang.Object

  A class for adding HTML highlighting in Tweet text (such as would be returned from a Search)

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `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

    Constructors
    Constructor and Description
    `HitHighlighter()` Create a new HitHighlighter object.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `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

    - #### DEFAULT_HIGHLIGHT_TAG

          public static final java.lang.String DEFAULT_HIGHLIGHT_TAG

      Default HTML tag for highlight hits
      See Also:
        Constant Field Values

    - #### highlightTag

          protected java.lang.String highlightTag

      the current HTML tag used for hit highlighting

  - ### Constructor Detail

    - #### HitHighlighter

          public HitHighlighter()

      Create a new HitHighlighter object.

  - ### Method Detail

    - #### highlight

          public 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. This is used with offsets from the search API to support the highlighting of query terms.
      Parameters:
        `text` - of the Tweet to highlight
        `hits` - A List of highlighting offsets (themselves lists of two elements)
      Returns:
        text with highlight HTML added

    - #### tag

          protected java.lang.String tag(boolean closeTag)

      Format the current `highlightTag` by adding < and >. If `closeTag` is `true` then the tag returned will include a `/` to signify a closing tag.
      Parameters:
        `closeTag` - true if this is a closing tag, false otherwise
      Returns:
        reformed tag

    - #### getHighlightTag

          public java.lang.String getHighlightTag()

      Get the current HTML tag used for phrase highlighting.
      Returns:
        current HTML tag (without < or >)

    - #### setHighlightTag

          public void setHighlightTag(java.lang.String highlightTag)

      Set the current HTML tag used for phrase highlighting.
      Parameters:
        `highlightTag` - sets highlighting tag