Dealing with some of the >120 length lines as per checkstyle. A few still need reducing.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@635447 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d678e4d298
commit
a705f50c7e
|
@ -2334,7 +2334,9 @@ public static String[] splitByWholeSeparatorPreserveAllTokens(String str, String
|
||||||
* @return an array of parsed Strings, <code>null</code> if null String input
|
* @return an array of parsed Strings, <code>null</code> if null String input
|
||||||
* @since 2.4
|
* @since 2.4
|
||||||
*/
|
*/
|
||||||
private static String[] splitByWholeSeparatorWorker(String str, String separator, int max, boolean preserveAllTokens) {
|
private static String[] splitByWholeSeparatorWorker(String str, String separator, int max,
|
||||||
|
boolean preserveAllTokens)
|
||||||
|
{
|
||||||
if (str == null) {
|
if (str == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -3566,20 +3568,20 @@ public static String replaceEach(String text, String[] searchList, String[] repl
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* StringUtils.replaceEach(null, *, *, *) = null
|
* StringUtils.replaceEach(null, *, *, *) = null
|
||||||
* StringUtils.replaceEach("", *, *, *) = ""
|
* StringUtils.replaceEach("", *, *, *) = ""
|
||||||
* StringUtils.replaceEach("aba", null, null, *) = "aba"
|
* StringUtils.replaceEach("aba", null, null, *) = "aba"
|
||||||
* StringUtils.replaceEach("aba", new String[0], null, *) = "aba"
|
* StringUtils.replaceEach("aba", new String[0], null, *) = "aba"
|
||||||
* StringUtils.replaceEach("aba", null, new String[0], *) = "aba"
|
* StringUtils.replaceEach("aba", null, new String[0], *) = "aba"
|
||||||
* StringUtils.replaceEach("aba", new String[]{"a"}, null, *) = "aba"
|
* StringUtils.replaceEach("aba", new String[]{"a"}, null, *) = "aba"
|
||||||
* StringUtils.replaceEach("aba", new String[]{"a"}, new String[]{""}, *) = "b"
|
* StringUtils.replaceEach("aba", new String[]{"a"}, new String[]{""}, *) = "b"
|
||||||
* StringUtils.replaceEach("aba", new String[]{null}, new String[]{"a"}, *) = "aba"
|
* StringUtils.replaceEach("aba", new String[]{null}, new String[]{"a"}, *) = "aba"
|
||||||
* StringUtils.replaceEach("abcde", new String[]{"ab", "d"}, new String[]{"w", "t"}, *) = "wcte"
|
* StringUtils.replaceEach("abcde", new String[]{"ab", "d"}, new String[]{"w", "t"}, *) = "wcte"
|
||||||
* (example of how it repeats)
|
* (example of how it repeats)
|
||||||
* StringUtils.replaceEach("abcde", new String[]{"ab", "d"}, new String[]{"d", "t"}, false) = "dcte"
|
* StringUtils.replaceEach("abcde", new String[]{"ab", "d"}, new String[]{"d", "t"}, false) = "dcte"
|
||||||
* StringUtils.replaceEach("abcde", new String[]{"ab", "d"}, new String[]{"d", "t"}, true) = "tcte"
|
* StringUtils.replaceEach("abcde", new String[]{"ab", "d"}, new String[]{"d", "t"}, true) = "tcte"
|
||||||
* StringUtils.replaceEach("abcde", new String[]{"ab", "d"}, new String[]{"d", "ab"}, true) = IllegalArgumentException
|
* StringUtils.replaceEach("abcde", new String[]{"ab", "d"}, new String[]{"d", "ab"}, true) = IllegalArgumentException
|
||||||
* StringUtils.replaceEach("abcde", new String[]{"ab", "d"}, new String[]{"d", "ab"}, false) = "dcabe"
|
* StringUtils.replaceEach("abcde", new String[]{"ab", "d"}, new String[]{"d", "ab"}, false) = "dcabe"
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @param text
|
* @param text
|
||||||
|
@ -3617,19 +3619,19 @@ public static String replaceEachRepeatedly(String text, String[] searchList, Str
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* StringUtils.replaceEach(null, *, *, *) = null
|
* StringUtils.replaceEach(null, *, *, *) = null
|
||||||
* StringUtils.replaceEach("", *, *, *) = ""
|
* StringUtils.replaceEach("", *, *, *) = ""
|
||||||
* StringUtils.replaceEach("aba", null, null, *) = "aba"
|
* StringUtils.replaceEach("aba", null, null, *) = "aba"
|
||||||
* StringUtils.replaceEach("aba", new String[0], null, *) = "aba"
|
* StringUtils.replaceEach("aba", new String[0], null, *) = "aba"
|
||||||
* StringUtils.replaceEach("aba", null, new String[0], *) = "aba"
|
* StringUtils.replaceEach("aba", null, new String[0], *) = "aba"
|
||||||
* StringUtils.replaceEach("aba", new String[]{"a"}, null, *) = "aba"
|
* StringUtils.replaceEach("aba", new String[]{"a"}, null, *) = "aba"
|
||||||
* StringUtils.replaceEach("aba", new String[]{"a"}, new String[]{""}, *) = "b"
|
* StringUtils.replaceEach("aba", new String[]{"a"}, new String[]{""}, *) = "b"
|
||||||
* StringUtils.replaceEach("aba", new String[]{null}, new String[]{"a"}, *) = "aba"
|
* StringUtils.replaceEach("aba", new String[]{null}, new String[]{"a"}, *) = "aba"
|
||||||
* StringUtils.replaceEach("abcde", new String[]{"ab", "d"}, new String[]{"w", "t"}, *) = "wcte"
|
* StringUtils.replaceEach("abcde", new String[]{"ab", "d"}, new String[]{"w", "t"}, *) = "wcte"
|
||||||
* (example of how it repeats)
|
* (example of how it repeats)
|
||||||
* StringUtils.replaceEach("abcde", new String[]{"ab", "d"}, new String[]{"d", "t"}, false) = "dcte"
|
* StringUtils.replaceEach("abcde", new String[]{"ab", "d"}, new String[]{"d", "t"}, false) = "dcte"
|
||||||
* StringUtils.replaceEach("abcde", new String[]{"ab", "d"}, new String[]{"d", "t"}, true) = "tcte"
|
* StringUtils.replaceEach("abcde", new String[]{"ab", "d"}, new String[]{"d", "t"}, true) = "tcte"
|
||||||
* StringUtils.replaceEach("abcde", new String[]{"ab", "d"}, new String[]{"d", "ab"}, *) = IllegalArgumentException
|
* StringUtils.replaceEach("abcde", new String[]{"ab", "d"}, new String[]{"d", "ab"}, *) = IllegalArgumentException
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @param text
|
* @param text
|
||||||
|
@ -3653,12 +3655,16 @@ public static String replaceEachRepeatedly(String text, String[] searchList, Str
|
||||||
* and/or size 0)
|
* and/or size 0)
|
||||||
* @since 2.4
|
* @since 2.4
|
||||||
*/
|
*/
|
||||||
private static String replaceEach(String text, String[] searchList, String[] replacementList, boolean repeat, int timeToLive) {
|
private static String replaceEach(String text, String[] searchList, String[] replacementList,
|
||||||
|
boolean repeat, int timeToLive)
|
||||||
|
{
|
||||||
|
|
||||||
// mchyzer Performance note: This creates very few new objects (one major goal)
|
// mchyzer Performance note: This creates very few new objects (one major goal)
|
||||||
// let me know if there are performance requests, we can create a harness to measure
|
// let me know if there are performance requests, we can create a harness to measure
|
||||||
|
|
||||||
if (text == null || text.length() == 0 || searchList == null || searchList.length == 0 || replacementList == null || replacementList.length == 0) {
|
if (text == null || text.length() == 0 || searchList == null ||
|
||||||
|
searchList.length == 0 || replacementList == null || replacementList.length == 0)
|
||||||
|
{
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3689,7 +3695,9 @@ private static String replaceEach(String text, String[] searchList, String[] rep
|
||||||
// index of replace array that will replace the search string found
|
// index of replace array that will replace the search string found
|
||||||
// NOTE: logic duplicated below START
|
// NOTE: logic duplicated below START
|
||||||
for (int i = 0; i < searchLength; i++) {
|
for (int i = 0; i < searchLength; i++) {
|
||||||
if (noMoreMatchesForReplIndex[i] || searchList[i] == null || searchList[i].length() == 0 || replacementList[i] == null) {
|
if (noMoreMatchesForReplIndex[i] || searchList[i] == null ||
|
||||||
|
searchList[i].length() == 0 || replacementList[i] == null)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
tempIndex = text.indexOf(searchList[i]);
|
tempIndex = text.indexOf(searchList[i]);
|
||||||
|
@ -3743,7 +3751,9 @@ private static String replaceEach(String text, String[] searchList, String[] rep
|
||||||
// find the next earliest match
|
// find the next earliest match
|
||||||
// NOTE: logic mostly duplicated above START
|
// NOTE: logic mostly duplicated above START
|
||||||
for (int i = 0; i < searchLength; i++) {
|
for (int i = 0; i < searchLength; i++) {
|
||||||
if (noMoreMatchesForReplIndex[i] || searchList[i] == null || searchList[i].length() == 0 || replacementList[i] == null) {
|
if (noMoreMatchesForReplIndex[i] || searchList[i] == null ||
|
||||||
|
searchList[i].length() == 0 || replacementList[i] == null)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
tempIndex = text.indexOf(searchList[i], start);
|
tempIndex = text.indexOf(searchList[i], start);
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
* and the formats supported by <code>java.text.MessageFormat</code> can be overridden
|
* and the formats supported by <code>java.text.MessageFormat</code> can be overridden
|
||||||
* at the format and/or format style level (see MessageFormat). A "format element"
|
* at the format and/or format style level (see MessageFormat). A "format element"
|
||||||
* embedded in the message pattern is specified (<b>()?</b> signifies optionality):<br />
|
* embedded in the message pattern is specified (<b>()?</b> signifies optionality):<br />
|
||||||
* <code>{</code<i>argument-number</i><b>(</b><code>,</code><i>format-name</i><b>(</b><code>,</code><i>format-style</i><b>)?</b><b>)?</b><code>}</code>
|
* <code>{</code><i>argument-number</i><b>(</b><code>,</code><i>format-name</i><b>(</b><code>,</code><i>format-style</i><b>)?)?</b><code>}</code>
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* <i>format-name</i> and <i>format-style</i> values are trimmed of surrounding whitespace
|
* <i>format-name</i> and <i>format-style</i> values are trimmed of surrounding whitespace
|
||||||
|
@ -192,7 +192,8 @@ public final void applyPattern(String pattern) {
|
||||||
toPattern = insertFormats(super.toPattern(), foundDescriptions);
|
toPattern = insertFormats(super.toPattern(), foundDescriptions);
|
||||||
if (containsElements(foundFormats)) {
|
if (containsElements(foundFormats)) {
|
||||||
Format[] origFormats = getFormats();
|
Format[] origFormats = getFormats();
|
||||||
//only loop over what we know we have, as MessageFormat on Java 1.3 seems to provide an extra format element:
|
// only loop over what we know we have, as MessageFormat on Java 1.3
|
||||||
|
// seems to provide an extra format element:
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (Iterator it = foundFormats.iterator(); it.hasNext(); i++) {
|
for (Iterator it = foundFormats.iterator(); it.hasNext(); i++) {
|
||||||
Format f = (Format) it.next();
|
Format f = (Format) it.next();
|
||||||
|
|
Loading…
Reference in New Issue