From 9f619b8de8f2c5da9dff170e2e351cfe57eaebc8 Mon Sep 17 00:00:00 2001 From: bculkin2442 Date: Tue, 11 Apr 2017 12:16:49 -0400 Subject: Remove old splitters --- .../parserutils/splitter/TwoLevelSplitter.java | 125 --------------------- 1 file changed, 125 deletions(-) delete mode 100644 BJC-Utils2/src/main/java/bjc/utils/parserutils/splitter/TwoLevelSplitter.java (limited to 'BJC-Utils2/src/main/java/bjc/utils/parserutils/splitter/TwoLevelSplitter.java') diff --git a/BJC-Utils2/src/main/java/bjc/utils/parserutils/splitter/TwoLevelSplitter.java b/BJC-Utils2/src/main/java/bjc/utils/parserutils/splitter/TwoLevelSplitter.java deleted file mode 100644 index 92b9de0..0000000 --- a/BJC-Utils2/src/main/java/bjc/utils/parserutils/splitter/TwoLevelSplitter.java +++ /dev/null @@ -1,125 +0,0 @@ -package bjc.utils.parserutils.splitter; - -import java.util.ArrayList; -import java.util.List; -import java.util.regex.Pattern; - -/** - * Implementation of a splitter that runs in two passes. - * - * This is useful because {@link SimpleTokenSplitter} doesn't like handling both - * <= and = without mangling them. - * - * The first pass splits on compound operators, which are built up from simple - * operators. - * - * The second pass removes simple operators. - * - * @author EVE - * - */ -@Deprecated -public class TwoLevelSplitter implements TokenSplitter { - private final SimpleTokenSplitter high; - private final SimpleTokenSplitter low; - - /** - * Create a new two level splitter. - */ - public TwoLevelSplitter() { - high = new SimpleTokenSplitter(); - low = new SimpleTokenSplitter(); - } - - @Override - public String[] split(final String inp) { - final List ret = new ArrayList<>(); - - final String[] partials = high.split(inp); - - for (final String partial : partials) { - final String[] finals = low.split(partial); - - for (final String fin : finals) { - ret.add(fin); - } - } - - return ret.toArray(new String[ret.size()]); - } - - /** - * Adds compound operators to split on. - * - * @param delims - * The compound operators to split on. - */ - public void addCompoundDelim(final String... delims) { - for (final String delim : delims) { - high.addDelimiter(delim); - - low.addNonMatcher(Pattern.quote(delim)); - } - } - - /** - * Adds simple operators to split on. - * - * @param delims - * The simple operators to split on. - */ - public void addSimpleDelim(final String... delims) { - for (final String delim : delims) { - low.addDelimiter(delim); - } - } - - /** - * Adds repeated compound operators to split on. - * - * @param delims - * The repeated compound operators to split on. - */ - public void addCompoundMulti(final String... delims) { - for (final String delim : delims) { - high.addMultiDelimiter(delim); - - low.addNonMatcher("(?:" + delim + ")+"); - } - } - - /** - * Adds simple compound operators to split on. - * - * @param delims - * The repeated simple operators to split on. - */ - public void addSimpleMulti(final String... delims) { - for (final String delim : delims) { - low.addMultiDelimiter(delim); - } - } - - /** - * Exclude strings matching a regex from both splits. - * - * @param exclusions - * The regexes to exclude matches for. - */ - public void exclude(final String... exclusions) { - for (final String exclusion : exclusions) { - high.addNonMatcher(exclusion); - - low.addNonMatcher(exclusion); - } - } - - /** - * Ready the splitter for use. - */ - public void compile() { - high.compile(); - - low.compile(); - } -} -- cgit v1.2.3