Class WikiCharSequence

java.lang.Object
org.getalp.dbnary.wiki.WikiCharSequence
All Implemented Interfaces:
CharSequence, Cloneable

public class WikiCharSequence extends Object implements CharSequence, Cloneable
A WikiCharSequence is a special character sequence that transforms a mediawiki code according to a filter function.

The character sequence will reflect a cut in the wikitext tree. The cut is specified by a filter function that takes nodes and decide if

  • the node source is to be added to the sequence
  • the node is to be ignored
  • the node is to be added as an atomic character (from unicode private use blocks)
  • the node is to be added as a sequence beginning/ending with specific open/close characters and containing a cut of its descendants forest
.

Default filter function is ...

Created by serasset on 28/01/16.

  • Field Details

    • LISTS_RANGE

      public static final CharRange LISTS_RANGE
    • TEMPLATES_RANGE

      public static final CharRange TEMPLATES_RANGE
    • HEADERS_RANGE

      public static final CharRange HEADERS_RANGE
  • Constructor Details

  • Method Details

    • length

      public int length()
      Specified by:
      length in interface CharSequence
    • charAt

      public char charAt(int index)
      Specified by:
      charAt in interface CharSequence
    • codePointAt

      public int codePointAt(int index)
      Returns the character (Unicode code point) at the specified index. The index refers to char values (Unicode code units) and ranges from 0 to length() - 1.

      If the char value specified at the given index is in the high-surrogate range, the following index is less than the length of this WikiCharSequence, and the char value at the following index is in the low-surrogate range, then the supplementary code point corresponding to this surrogate pair is returned. Otherwise, the char value at the given index is returned.

      Parameters:
      index - the index to the char values
      Returns:
      the code point value of the character at the index
      Throws:
      IndexOutOfBoundsException - if the index argument is negative or not less than the length of this string.
    • codePointCount

      public int codePointCount()
    • codePointCount

      public int codePointCount(int beginIndex, int endIndex)
    • toString

      public String toString()
      Specified by:
      toString in interface CharSequence
      Overrides:
      toString in class Object
    • subSequence

      public WikiCharSequence subSequence(int beginIndex, int endIndex)
      Specified by:
      subSequence in interface CharSequence
    • subSequence

      public WikiCharSequence subSequence(int beginIndex)
    • getSourceContent

      public String getSourceContent(CharSequence s)
    • getSourceContent

      public String getSourceContent()
    • getToken

      public WikiText.Token getToken(String c)
    • getToken

      public WikiText.Token getToken(int c)
    • mutateString

      public WikiCharSequence mutateString(Function<String,String> mutator)
      /// UTILITY FUNCTIONS //////////////////
    • toCentent

      public WikiText.WikiContent toCentent()