Modifier and Type | Field and Description |
---|---|
private int |
end
Current positions of result and iterator.
|
private int |
index
Current positions of result and iterator.
|
private java.lang.CharSequence |
input
Data currently processed.
|
private static Logging |
LOG
Class logger.
|
private java.util.regex.Matcher |
matcher
Regular expression match helper.
|
static java.lang.String |
QUOTE_CHAR
Quote characters
|
private char[] |
quoteChars
Stores the quotation character
|
private boolean |
quoted
Whether the current token is a quoted string.
|
private int |
send
Substring to process.
|
private int |
start
Current positions of result and iterator.
|
Constructor and Description |
---|
Tokenizer(java.util.regex.Pattern colSep,
java.lang.String quoteChars)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
Tokenizer |
advance()
Moves the iterator forward to the next entry.
|
void |
cleanup()
Perform cleanup.
|
double |
getDouble()
Get current value as double.
|
int |
getEnd()
Get end of token.
|
int |
getIntBase10()
Get current value as int.
|
long |
getLongBase10()
Get current value as long.
|
int |
getStart()
Get start of token.
|
java.lang.String |
getStrippedSubstring()
Get the current part as substring
|
java.lang.String |
getSubstring()
Get the current part as substring
|
void |
initialize(java.lang.CharSequence input,
int begin,
int end)
Initialize parser with a new string.
|
boolean |
isEmpty()
Test for empty tokens; usually at end of line.
|
private char |
isQuote(int index)
Detect quote characters.
|
boolean |
isQuoted()
Test if the current string was quoted.
|
boolean |
valid()
Returns true if the iterator currently points to a valid object.
|
private static final Logging LOG
public static final java.lang.String QUOTE_CHAR
private char[] quoteChars
private java.util.regex.Matcher matcher
private java.lang.CharSequence input
private int send
private int start
private int end
private int index
private boolean quoted
public Tokenizer(java.util.regex.Pattern colSep, java.lang.String quoteChars)
colSep
- Column separator pattern.quoteChars
- Quotation character.public void initialize(java.lang.CharSequence input, int begin, int end)
input
- New string to parse.begin
- Beginend
- Endpublic boolean valid()
Iter
public Tokenizer advance()
Iter
public java.lang.String getSubstring()
public java.lang.String getStrippedSubstring()
public double getDouble() throws java.lang.NumberFormatException
java.lang.NumberFormatException
- when current value cannot be parsed as doublepublic int getIntBase10() throws java.lang.NumberFormatException
java.lang.NumberFormatException
- when current value cannot be parsed as int.public long getLongBase10() throws java.lang.NumberFormatException
java.lang.NumberFormatException
- when current value cannot be parsed as long.public boolean isEmpty()
private char isQuote(int index)
index
- Position1
when a quote character, 0
otherwise.public boolean isQuoted()
true
when quoted.public int getStart()
public int getEnd()
public void cleanup()
Copyright © 2019 ELKI Development Team. License information.