public class SpecialTokens extends Object
Modifier and Type | Class and Description |
---|---|
static class |
SpecialTokens.SpecialToken
An immutable special token
|
Modifier and Type | Field and Description |
---|---|
private int |
currentMaximumLength |
private boolean |
frozen |
private static Logger |
log |
private String |
name |
private List<SpecialTokens.SpecialToken> |
specialTokens |
Constructor and Description |
---|
SpecialTokens()
Creates a null list of special tokens
|
SpecialTokens(String name) |
Modifier and Type | Method and Description |
---|---|
void |
addSpecialToken(String token,
String replace)
Adds a special token to this
|
private boolean |
caseIndependentLength(String token) |
private void |
ensureNotFrozen() |
void |
freeze() |
String |
getName()
Returns the name of this special tokens list
|
int |
size()
Returns the number of special tokens in this
|
private boolean |
tokenEndsAt(int position,
String string) |
SpecialTokens.SpecialToken |
tokenize(String string,
boolean substring)
Returns the special token starting at the start of the given string, or null if no
special token starts at this string
|
private static final Logger log
private String name
private List<SpecialTokens.SpecialToken> specialTokens
private boolean frozen
private int currentMaximumLength
public SpecialTokens()
public SpecialTokens(String name)
public String getName()
public void addSpecialToken(String token, String replace)
token
- the special token string to addreplace
- the token to replace instances of the special token with,
or null to keep the tokenprivate boolean caseIndependentLength(String token)
public SpecialTokens.SpecialToken tokenize(String string, boolean substring)
string
- the string to search for a special token at the start positionsubstring
- true to allow the special token to be followed by a character which does not
mark the end of a tokenprivate boolean tokenEndsAt(int position, String string)
public int size()
private void ensureNotFrozen()
public void freeze()
Copyright © 2018. All rights reserved.