Class WikiCharSequence
java.lang.Object
org.getalp.dbnary.wiki.WikiCharSequence
- All Implemented Interfaces:
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 Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionWikiCharSequence(WikiText.WikiContent content) WikiCharSequence(WikiText.WikiContent content, Function<WikiText.Token, WikiSequenceFiltering.Action> filter) -
Method Summary
Modifier and TypeMethodDescriptioncharcharAt(int index) intcodePointAt(int index) Returns the character (Unicode code point) at the specified index.intintcodePointCount(int beginIndex, int endIndex) getToken(int c) intlength()mutateString(Function<String, String> mutator) /// UTILITY FUNCTIONS //////////////////subSequence(int beginIndex) subSequence(int beginIndex, int endIndex) toString()Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface CharSequence
chars, codePoints, getChars, isEmpty
-
Field Details
-
LISTS_RANGE
-
TEMPLATES_RANGE
-
EXTERNAL_LINKS_RANGE
-
INTERNAL_LINKS_RANGE
-
HEADERS_RANGE
-
-
Constructor Details
-
WikiCharSequence
-
WikiCharSequence
-
WikiCharSequence
-
WikiCharSequence
public WikiCharSequence(WikiText.WikiContent content, Function<WikiText.Token, WikiSequenceFiltering.Action> filter)
-
-
Method Details
-
length
public int length()- Specified by:
lengthin interfaceCharSequence
-
charAt
public char charAt(int index) - Specified by:
charAtin interfaceCharSequence
-
codePointAt
public int codePointAt(int index) Returns the character (Unicode code point) at the specified index. The index refers tocharvalues (Unicode code units) and ranges from0tolength()- 1.If the
charvalue specified at the given index is in the high-surrogate range, the following index is less than the length of thisWikiCharSequence, and thecharvalue at the following index is in the low-surrogate range, then the supplementary code point corresponding to this surrogate pair is returned. Otherwise, thecharvalue at the given index is returned.- Parameters:
index- the index to thecharvalues- Returns:
- the code point value of the character at the
index - Throws:
IndexOutOfBoundsException- if theindexargument is negative or not less than the length of this string.
-
codePointCount
public int codePointCount() -
codePointCount
public int codePointCount(int beginIndex, int endIndex) -
toString
- Specified by:
toStringin interfaceCharSequence- Overrides:
toStringin classObject
-
subSequence
- Specified by:
subSequencein interfaceCharSequence
-
subSequence
-
getSourceContent
-
getSourceContent
-
getToken
-
getToken
-
mutateString
/// UTILITY FUNCTIONS ////////////////// -
toCentent
-