summaryrefslogtreecommitdiff
path: root/BJC-Utils2/src/main/java/bjc/utils/funcutils/TokenDeaffixer.java
diff options
context:
space:
mode:
authorEVE <EVE@EVE-PC>2017-03-15 19:06:48 -0400
committerEVE <EVE@EVE-PC>2017-03-15 19:06:48 -0400
commit72e8de605598f62efbd63c17897e80cec181ff2b (patch)
tree7925a4fba447f213bc69bb14a56848e047f21239 /BJC-Utils2/src/main/java/bjc/utils/funcutils/TokenDeaffixer.java
parent9201148259345c3a48bf2b46cd9badddf44a77e9 (diff)
Remove old splitter code, and swap naming to match.
Diffstat (limited to 'BJC-Utils2/src/main/java/bjc/utils/funcutils/TokenDeaffixer.java')
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/funcutils/TokenDeaffixer.java47
1 files changed, 0 insertions, 47 deletions
diff --git a/BJC-Utils2/src/main/java/bjc/utils/funcutils/TokenDeaffixer.java b/BJC-Utils2/src/main/java/bjc/utils/funcutils/TokenDeaffixer.java
deleted file mode 100644
index f550b65..0000000
--- a/BJC-Utils2/src/main/java/bjc/utils/funcutils/TokenDeaffixer.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package bjc.utils.funcutils;
-
-import bjc.utils.funcdata.FunctionalList;
-import bjc.utils.funcdata.IList;
-
-import java.util.function.BiFunction;
-
-final class TokenDeaffixer implements BiFunction<String, String, IList<String>> {
- private String token;
-
- public TokenDeaffixer(String tok) {
- token = tok;
- }
-
- @Override
- public IList<String> apply(String operatorName, String operatorRegex) {
- if(operatorName == null)
- throw new NullPointerException("Operator name must not be null");
- else if(operatorRegex == null) throw new NullPointerException("Operator regex must not be null");
-
- if(StringUtils.containsOnly(token, operatorRegex))
- return new FunctionalList<>(token);
- else if(token.startsWith(operatorName)) {
- if(token.endsWith(operatorName))
- return new FunctionalList<>(operatorName, token.split(operatorRegex)[1], operatorName);
-
- return new FunctionalList<>(operatorName, token.split(operatorRegex)[1]);
- } else if(token.endsWith(operatorName))
- return new FunctionalList<>(token.split(operatorRegex)[0], operatorName);
- else if(token.contains(operatorName)) {
- String[] tokenParts = token.split(operatorRegex);
-
- IList<String> returned = new FunctionalList<>();
-
- for(int i = 0; i < tokenParts.length; i++) {
- returned.add(tokenParts[i]);
-
- if(i < tokenParts.length - 1) {
- returned.add(operatorName);
- }
- }
-
- return returned;
- } else
- return new FunctionalList<>(token);
- }
-}