diff options
| author | bculkin2442 <bjculkin@mix.wvu.edu> | 2017-04-11 12:16:49 -0400 |
|---|---|---|
| committer | bculkin2442 <bjculkin@mix.wvu.edu> | 2017-04-11 12:16:49 -0400 |
| commit | 9f619b8de8f2c5da9dff170e2e351cfe57eaebc8 (patch) | |
| tree | 796c698c23a30541701d3330530978362052b8d1 /BJC-Utils2/src/main/java/bjc/utils/parserutils/splitter/TwoLevelSplitter.java | |
| parent | 2cc559513eda04aabbc140c2024ebf650631bccb (diff) | |
Remove old splitters
Diffstat (limited to 'BJC-Utils2/src/main/java/bjc/utils/parserutils/splitter/TwoLevelSplitter.java')
| -rw-r--r-- | BJC-Utils2/src/main/java/bjc/utils/parserutils/splitter/TwoLevelSplitter.java | 125 |
1 files changed, 0 insertions, 125 deletions
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<String> 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(); - } -} |
