summaryrefslogtreecommitdiff
path: root/BJC-Utils2/src/main/java/bjc/utils/funcutils/NeoTokenSplitter.java
diff options
context:
space:
mode:
authorEVE <EVE@EVE-PC>2017-03-13 16:42:21 -0400
committerEVE <EVE@EVE-PC>2017-03-13 16:42:21 -0400
commit27bf571d6413c3cc6a5d664b5bddd38d21d7b1cd (patch)
tree847fb52acb091c1c613d37b8477094d5762c6988 /BJC-Utils2/src/main/java/bjc/utils/funcutils/NeoTokenSplitter.java
parentaa807a96cae2c47259fb38f710640883060339e9 (diff)
Formatting
Diffstat (limited to 'BJC-Utils2/src/main/java/bjc/utils/funcutils/NeoTokenSplitter.java')
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/funcutils/NeoTokenSplitter.java32
1 files changed, 18 insertions, 14 deletions
diff --git a/BJC-Utils2/src/main/java/bjc/utils/funcutils/NeoTokenSplitter.java b/BJC-Utils2/src/main/java/bjc/utils/funcutils/NeoTokenSplitter.java
index 91cbeb5..09c3ef7 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/funcutils/NeoTokenSplitter.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/funcutils/NeoTokenSplitter.java
@@ -11,9 +11,8 @@ public class NeoTokenSplitter {
/*
* This string is a format template for the delimiter matching regex
*
- * It does two things
- * 1. Match the provided delimiter by positive lookahead
- * 2. Match the provided delimiter by positive lookbehind
+ * It does two things 1. Match the provided delimiter by positive
+ * lookahead 2. Match the provided delimiter by positive lookbehind
*
* Thus, it will only match in places where the delimiter is, but won't
* actually match the delimiter, leaving split to put it into the stream
@@ -48,21 +47,24 @@ public class NeoTokenSplitter {
*
* The splitter must be compiled first.
*
- * @param inp The string to split.
+ * @param inp
+ * The string to split.
*
* @return The split string, including delimiters.
*
- * @throws IllegalStateException If the splitter isn't compiled.
+ * @throws IllegalStateException
+ * If the splitter isn't compiled.
*/
public String[] split(String inp) {
- if(compPatt == null) {
+ if (compPatt == null) {
throw new IllegalStateException("Token splitter has not been compiled yet");
}
/*
* Don't split something that matches only an operator
*/
- if(exclusionPatt.matcher(inp).matches()) return new String[] {inp};
+ if (exclusionPatt.matcher(inp).matches())
+ return new String[] { inp };
return compPatt.split(inp);
}
@@ -73,14 +75,15 @@ public class NeoTokenSplitter {
*
* The provided string is regex-escaped before being used.
*
- * @param delim The delimiter to match on.
+ * @param delim
+ * The delimiter to match on.
*/
public void addDelimiter(String delim) {
String quoteDelim = Pattern.quote(delim);
String delimPat = String.format(WITH_DELIM, quoteDelim);
- if(currPatt == null) {
- currPatt = new StringBuilder();
+ if (currPatt == null) {
+ currPatt = new StringBuilder();
currExclusionPatt = new StringBuilder();
currPatt.append("(?:" + delimPat + ")");
@@ -97,13 +100,14 @@ public class NeoTokenSplitter {
* The provided string should be a pattern to match one or more
* occurances of.
*
- * @param delim The delimiter to split on.
+ * @param delim
+ * The delimiter to split on.
*/
public void addMultiDelimiter(String delim) {
String delimPat = String.format(WITH_MULTI_DELIM, "(?:" + delim + ")");
- if(currPatt == null) {
- currPatt = new StringBuilder();
+ if (currPatt == null) {
+ currPatt = new StringBuilder();
currExclusionPatt = new StringBuilder();
currPatt.append("(?:" + delimPat + ")");
@@ -121,7 +125,7 @@ public class NeoTokenSplitter {
* Makes this splitter ready to use.
*/
public void compile() {
- compPatt = Pattern.compile(currPatt.toString());
+ compPatt = Pattern.compile(currPatt.toString());
exclusionPatt = Pattern.compile(currExclusionPatt.toString());
}
}