Repository: incubator-streams Updated Branches: refs/heads/master b273496c9 -> cd3d5d41e
Removed unused org.apache.streams.util.RegexUtils Project: http://git-wip-us.apache.org/repos/asf/incubator-streams/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-streams/commit/1b682566 Tree: http://git-wip-us.apache.org/repos/asf/incubator-streams/tree/1b682566 Diff: http://git-wip-us.apache.org/repos/asf/incubator-streams/diff/1b682566 Branch: refs/heads/master Commit: 1b682566463d092f58a3affe413132f20f88a81d Parents: 11e3a0f Author: Joey Frazee <[email protected]> Authored: Fri Oct 21 12:16:42 2016 -0500 Committer: Joey Frazee <[email protected]> Committed: Fri Oct 21 12:16:42 2016 -0500 ---------------------------------------------------------------------- .../org/apache/streams/util/RegexUtils.java | 96 -------------------- 1 file changed, 96 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/1b682566/streams-util/src/main/java/org/apache/streams/util/RegexUtils.java ---------------------------------------------------------------------- diff --git a/streams-util/src/main/java/org/apache/streams/util/RegexUtils.java b/streams-util/src/main/java/org/apache/streams/util/RegexUtils.java deleted file mode 100644 index 2831df5..0000000 --- a/streams-util/src/main/java/org/apache/streams/util/RegexUtils.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.streams.util; - -import java.util.ArrayList; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.apache.commons.lang3.tuple.Pair; - -/** - * RegexUtils contains methods for applying regular expressions to strings. - */ -public class RegexUtils { - - public static boolean matches(String line, String regEx) { - - boolean regExpMatches = false; - - if (StringUtils.isNotBlank(line) && StringUtils.isNotBlank(regEx)) { - if (line.matches(regEx)) { - regExpMatches = true; - } - } - return regExpMatches; - } - - public static List<String> getMatches(String line, String regEx, int group){ - Pattern pattern = Pattern.compile(regEx); - Matcher matcher = pattern.matcher(line); - List<String> matches = new ArrayList<String>(); - - while (matcher.find()) { - - matches.add(matcher.group(group)); - } - - return matches; - } - - public static List<Pair<String,String>> getTwoMatchedGroupsList(List<String> lines, String regEx){ - List<Pair<String,String>> matches = new ArrayList<Pair<String,String>>(); - - for( String line : lines ) { - - Pair<String,String> match = getTwoMatchedGroups(line, regEx); - if( match != null ) - matches.add(match); - - } - return matches; - } - - public static Pair<String,String> getTwoMatchedGroups(String line, String regEx){ - Pattern pattern = Pattern.compile(regEx); - Matcher matcher = pattern.matcher(line); - Pair<String,String> match = null; - - while (matcher.find()) { - Pair<String,String> pair = new ImmutablePair<String,String>(matcher.group(0), matcher.group(1)); - match = pair; - } - - return match; - } - - public static String getMatchedContent(String line, String regEx){ - Pattern pattern = Pattern.compile(regEx); - Matcher matcher = pattern.matcher(line); - String matchedContent = null; - if (matcher.find()) { - matchedContent = matcher.group(); - } - - return matchedContent; - } -}
