You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2017/10/16 12:43:37 UTC
[isis] 12/26: ISIS-1742: deletes unused methods in StringExtensions
This is an automated email from the ASF dual-hosted git repository.
danhaywood pushed a commit to branch dev/2.0.0/ISIS-1742-remove-deprecations
in repository https://gitbox.apache.org/repos/asf/isis.git
commit 55e957491491395b73559f3f5f71ac0133e5f545
Author: Dan Haywood <da...@haywood-associates.co.uk>
AuthorDate: Mon Oct 16 12:07:57 2017 +0100
ISIS-1742: deletes unused methods in StringExtensions
---
.../isis/core/commons/lang/StringExtensions.java | 101 ---------------------
1 file changed, 101 deletions(-)
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/commons/lang/StringExtensions.java b/core/metamodel/src/main/java/org/apache/isis/core/commons/lang/StringExtensions.java
index 53a0bfd..2f791a5 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/commons/lang/StringExtensions.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/commons/lang/StringExtensions.java
@@ -331,108 +331,7 @@ public final class StringExtensions {
// copied in from Apache Commons
// //////////////////////////////////////
-
- public static final String EMPTY = "";
- /**
- * <p>The maximum size to which the padding constant(s) can expand.</p>
- */
- private static final int PAD_LIMIT = 8192;
-
- /**
- * <p>Repeat a String <code>repeat</code> times to form a
- * new String.</p>
- *
- * <pre>
- * StringUtils.repeat(null, 2) = null
- * StringUtils.repeat("", 0) = ""
- * StringUtils.repeat("", 2) = ""
- * StringUtils.repeat("a", 3) = "aaa"
- * StringUtils.repeat("ab", 2) = "abab"
- * StringUtils.repeat("a", -2) = ""
- * </pre>
- *
- * @param extendee the String to repeat, may be null
- * @param repeat number of times to repeat str, negative treated as zero
- * @return a new String consisting of the original String repeated,
- * <code>null</code> if null String input
- */
- public static String repeat(final String extendee, int repeat) {
- // Performance tuned for 2.0 (JDK1.4)
- if (extendee == null) {
- return null;
- }
- if (repeat <= 0) {
- return EMPTY;
- }
- int inputLength = extendee.length();
- if (repeat == 1 || inputLength == 0) {
- return extendee;
- }
- if (inputLength == 1 && repeat <= PAD_LIMIT) {
- return padding(repeat, extendee.charAt(0));
- }
-
- int outputLength = inputLength * repeat;
- switch (inputLength) {
- case 1 :
- char ch = extendee.charAt(0);
- char[] output1 = new char[outputLength];
- for (int i = repeat - 1; i >= 0; i--) {
- output1[i] = ch;
- }
- return new String(output1);
- case 2 :
- char ch0 = extendee.charAt(0);
- char ch1 = extendee.charAt(1);
- char[] output2 = new char[outputLength];
- for (int i = repeat * 2 - 2; i >= 0; i--, i--) {
- output2[i] = ch0;
- output2[i + 1] = ch1;
- }
- return new String(output2);
- default :
- StringBuilder buf = new StringBuilder(outputLength);
- for (int i = 0; i < repeat; i++) {
- buf.append(extendee);
- }
- return buf.toString();
- }
- }
-
- /**
- * <p>Returns padding using the specified delimiter repeated
- * to a given length.</p>
- *
- * <pre>
- * StringUtils.padding(0, 'e') = ""
- * StringUtils.padding(3, 'e') = "eee"
- * StringUtils.padding(-2, 'e') = IndexOutOfBoundsException
- * </pre>
- *
- * <p>Note: this method doesn't not support padding with
- * <a href="http://www.unicode.org/glossary/#supplementary_character">Unicode Supplementary Characters</a>
- * as they require a pair of <code>char</code>s to be represented.
- * If you are needing to support full I18N of your applications
- * consider using {@link #repeat(String, int)} instead.
- * </p>
- *
- * @param repeat number of times to repeat delim
- * @param padChar character to repeat
- * @return String with repeated character
- * @throws IndexOutOfBoundsException if <code>repeat < 0</code>
- * @see #repeat(String, int)
- */
- private static String padding(int repeat, char padChar) throws IndexOutOfBoundsException {
- if (repeat < 0) {
- throw new IndexOutOfBoundsException("Cannot pad a negative amount: " + repeat);
- }
- final char[] buf = new char[repeat];
- for (int i = 0; i < buf.length; i++) {
- buf[i] = padChar;
- }
- return new String(buf);
- }
public static boolean startsWith(final String extendee, final String prefix) {
final int length = prefix.length();
--
To stop receiving notification emails like this one, please contact
"commits@isis.apache.org" <co...@isis.apache.org>.