public class PGtokenizer
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected java.util.List<java.lang.String> |
tokens |
| Constructor and Description |
|---|
PGtokenizer(java.lang.String string,
char delim)
Create a tokeniser.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getSize() |
java.lang.String |
getToken(int n) |
void |
remove(java.lang.String l,
java.lang.String t)
This removes the lead/trailing strings from all tokens.
|
static java.lang.String |
remove(java.lang.String s,
java.lang.String l,
java.lang.String t)
This removes the lead/trailing strings from a string.
|
void |
removeAngle()
Removes < and > from the beginning and end of all tokens.
|
static java.lang.String |
removeAngle(java.lang.String s)
Removes < and > from the beginning and end of a string.
|
void |
removeBox()
Removes [ and ] from the beginning and end of all tokens.
|
static java.lang.String |
removeBox(java.lang.String s)
Removes [ and ] from the beginning and end of a string.
|
void |
removeCurlyBrace()
Removes < and > from the beginning and end of all tokens.
|
static java.lang.String |
removeCurlyBrace(java.lang.String s)
Removes curly braces { and } from the beginning and end of a string.
|
void |
removePara()
Removes ( and ) from the beginning and end of all tokens.
|
static java.lang.String |
removePara(java.lang.String s)
Removes ( and ) from the beginning and end of a string.
|
int |
tokenize(java.lang.String string,
char delim)
This resets this tokenizer with a new string and/or delimiter.
|
PGtokenizer |
tokenizeToken(int n,
char delim)
This returns a new tokenizer based on one of our tokens.
|
public PGtokenizer(java.lang.String string,
char delim)
Create a tokeniser.
We could have used StringTokenizer to do this, however, we needed to handle nesting of '(' ')' '[' ']' '<' and '>' as these are used by the geometric data types.
string - containing tokensdelim - single character to split the tokenspublic int tokenize(java.lang.String string,
char delim)
string - containing tokensdelim - single character to split the tokenspublic int getSize()
public java.lang.String getToken(int n)
n - Token number ( 0 ... getSize()-1 )public PGtokenizer tokenizeToken(int n, char delim)
This returns a new tokenizer based on one of our tokens.
The geometric datatypes use this to process nested tokens (usually PGpoint).
n - Token number ( 0 ... getSize()-1 )delim - The delimiter to usepublic static java.lang.String remove(java.lang.String s,
java.lang.String l,
java.lang.String t)
s - Source stringl - Leading string to removet - Trailing string to removepublic void remove(java.lang.String l,
java.lang.String t)
l - Leading string to removet - Trailing string to removepublic static java.lang.String removePara(java.lang.String s)
s - String to remove frompublic void removePara()
public static java.lang.String removeBox(java.lang.String s)
s - String to remove frompublic void removeBox()
public static java.lang.String removeAngle(java.lang.String s)
s - String to remove frompublic void removeAngle()
public static java.lang.String removeCurlyBrace(java.lang.String s)
s - String to remove frompublic void removeCurlyBrace()