@Environment(value=CLIENT) public class TextVisitFactory extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
TextVisitFactory.CharacterVisitor
A visitor for single characters in a string.
|
| Modifier and Type | Field and Description |
|---|---|
private static Optional<Object> |
VISIT_TERMINATED |
| Constructor and Description |
|---|
TextVisitFactory() |
| Modifier and Type | Method and Description |
|---|---|
static String |
validateSurrogates(String text)
Returns a new string that has all surrogate characters within validated
from an original string.
|
static boolean |
visitBackwards(String text,
Style style,
TextVisitFactory.CharacterVisitor visitor)
Visits the code points of a string in backward (right to left) direction.
|
static boolean |
visitFormatted(String text,
int startIndex,
Style startingStyle,
Style resetStyle,
TextVisitFactory.CharacterVisitor visitor)
Visits the code points of a string, applying the formatting codes within.
|
static boolean |
visitFormatted(String text,
int startIndex,
Style style,
TextVisitFactory.CharacterVisitor visitor)
Visits the code points of a string, applying the formatting codes within.
|
static boolean |
visitFormatted(StringRenderable text,
Style style,
TextVisitFactory.CharacterVisitor visitor)
Visits the code points for every literal string and the formatting codes
supplied by the renderable.
|
static boolean |
visitFormatted(String text,
Style style,
TextVisitFactory.CharacterVisitor visitor)
Visits the code points of a string, applying the formatting codes within.
|
static boolean |
visitForwards(String text,
Style style,
TextVisitFactory.CharacterVisitor visitor)
Visits the code points of a string in forward (left to right) direction.
|
private static boolean |
visitRegularCharacter(Style style,
TextVisitFactory.CharacterVisitor visitor,
int index,
char c) |
private static boolean visitRegularCharacter(Style style, TextVisitFactory.CharacterVisitor visitor, int index, char c)
public static boolean visitForwards(String text, Style style, TextVisitFactory.CharacterVisitor visitor)
text - the stringstyle - the style of the stringvisitor - the visitor of characterstrue if the full string was visited, or false indicating
the visitor terminated half-waypublic static boolean visitBackwards(String text, Style style, TextVisitFactory.CharacterVisitor visitor)
text - the stringstyle - the style of the stringvisitor - the visitortrue if the full string was visited, or false indicating
the visitor terminated half-waypublic static boolean visitFormatted(String text, Style style, TextVisitFactory.CharacterVisitor visitor)
The visit is in forward direction.
text - the string visitedstyle - the style of the stringvisitor - the visitortrue if the full string was visited, or false indicating
the visitor terminated half-waypublic static boolean visitFormatted(String text, int startIndex, Style style, TextVisitFactory.CharacterVisitor visitor)
The visit is in forward direction.
text - the string visitedstartIndex - the starting index of the visitstyle - the style of the stringtrue if the full string was visited, or false indicating
the visitor terminated half-waypublic static boolean visitFormatted(String text, int startIndex, Style startingStyle, Style resetStyle, TextVisitFactory.CharacterVisitor visitor)
The visit is in forward direction.
text - the string visitedstartIndex - the starting index of the visitstartingStyle - the style of the string when the visit startsresetStyle - the style to reset to when a §r formatting code is encounteredvisitor - the visitortrue if the full string was visited, or false indicating
the visitor terminated half-waypublic static boolean visitFormatted(StringRenderable text, Style style, TextVisitFactory.CharacterVisitor visitor)
The visit is in forward direction.
true if the full string was visited, or false indicating
the visitor terminated half-wayStringRenderable.visit(StringRenderable.StyledVisitor, Style)