Class WikiText.Token

java.lang.Object
org.getalp.dbnary.wiki.WikiText.Token
All Implemented Interfaces:
Visitable
Direct Known Subclasses:
WikiText.Heading, WikiText.HTMLComment, WikiText.IndentedItem, WikiText.Link, WikiText.NoWiki, WikiText.Template, WikiText.Text, WikiText.WikiContent, WikiText.WikiSection
Enclosing class:
WikiText

public abstract class WikiText.Token extends Object implements Visitable
  • Field Details

  • Constructor Details

    • Token

      public Token()
  • Method Details

    • addToken

      protected abstract void addToken(WikiText.Token t)
    • setEndOffset

      protected void setEndOffset(int endOffset)
    • addFlattenedTokens

      protected void addFlattenedTokens(WikiText.Token t)
    • getWikiText

      public WikiText getWikiText()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getText

      public String getText()
      returns the content as a String. All tokens will be rendered as their source text, without any html comments that were present in the wiki source. NOTE: the toString() method will return the wikiSource WITH comments and nowiki tags.
      Returns:
      a list of tokens (either text or wikiTokens)
    • fillText

      protected abstract void fillText(StringBuilder s)
    • getFullContent

      public String getFullContent()
      returns the full source content that support the wikiText as its specified offsets.
      Returns:
      the MediaWiki source String
    • getBeginIndex

      public int getBeginIndex()
      get the index at which this token starts in its WikiText FullContent.
      Returns:
      the begin index, relative to the WikiText source content
    • getEndIndex

      public int getEndIndex()
      get the index at which this token ends in its WikiText FullContent.
      Returns:
      the end index, relative to the WikiText source content
    • asExternalLink

      public WikiText.ExternalLink asExternalLink()
    • asHeading

      public WikiText.Heading asHeading()
    • asHTMLComment

      public WikiText.HTMLComment asHTMLComment()
    • asNoWiki

      public WikiText.NoWiki asNoWiki()
    • asInternalLink

      public WikiText.InternalLink asInternalLink()
    • asLink

      public WikiText.Link asLink()
    • asIndentedItem

      public WikiText.IndentedItem asIndentedItem()
    • asIndentation

      public WikiText.Indentation asIndentation()
    • asItem

      public WikiText.Item asItem()
    • asListItem

      public WikiText.ListItem asListItem()
    • asNumberedListItem

      public WikiText.NumberedListItem asNumberedListItem()
    • asTemplate

      public WikiText.Template asTemplate()
    • asText

      public WikiText.Text asText()
    • asWikiContent

      public WikiText.WikiContent asWikiContent()
    • asWikiSection

      public WikiText.WikiSection asWikiSection()