diff options
Diffstat (limited to 'bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/util/TextProcessor.java')
-rw-r--r-- | bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/util/TextProcessor.java | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/util/TextProcessor.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/util/TextProcessor.java index 4b6706597..f871c4c3c 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/util/TextProcessor.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/util/TextProcessor.java @@ -1,13 +1,13 @@ /******************************************************************************* * Copyright (c) 2006, 2012 IBM Corporation and others. * - * This program and the accompanying materials + * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at * https://www.eclipse.org/legal/epl-2.0/ * * SPDX-License-Identifier: EPL-2.0 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -27,7 +27,7 @@ import java.util.Locale; * its semantic meaning and conforms with the Unicode BiDi algorithm within each * segment. * </p> - * + * * @since 3.2 * @noextend This class is not intended to be subclassed by clients. */ @@ -71,7 +71,7 @@ public class TextProcessor { // whether or not processing is needed private static boolean IS_PROCESSING_NEEDED = false; - // constant used to indicate an LRM need not precede a delimiter + // constant used to indicate an LRM need not precede a delimiter private static final int INDEX_NOT_SET = 999999999; static { @@ -80,7 +80,7 @@ public class TextProcessor { if ("iw".equals(lang) || "he".equals(lang) || "ar".equals(lang) || "fa".equals(lang) || "ur".equals(lang)) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ String osName = System.getProperty("os.name").toLowerCase(); //$NON-NLS-1$ - if (osName.startsWith("windows") || osName.startsWith("linux") || osName.startsWith("mac")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + if (osName.startsWith("windows") || osName.startsWith("linux") || osName.startsWith("mac") || osName.startsWith("freebsd")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ IS_PROCESSING_NEEDED = true; } } @@ -91,7 +91,7 @@ public class TextProcessor { * substitution based on the locale. This is equivalent to calling * <code>process(String, String)</code> with the default set of * delimiters. - * + * * @param text * the text to be processed * @return the manipulated string @@ -144,7 +144,7 @@ public class TextProcessor { * <code>String.length()</code> called on the resulting string will not * return the same values as would be returned for the original string. * </p> - * + * * @param str * the text to process, if <code>null</code> return the string * as it was passed in @@ -171,7 +171,7 @@ public class TextProcessor { delimiter = delimiter == null ? getDefaultDelimiters() : delimiter; - StringBuffer target = new StringBuffer(); + StringBuilder target = new StringBuilder(); target.append(LRE); char ch; @@ -185,7 +185,7 @@ public class TextProcessor { } else if (Character.isDigit(ch)) { if (delimIndex != INDEX_NOT_SET) { // consecutive neutral and weak directional characters - // explicitly force direction to be LRM + // explicitly force direction to be LRM target.insert(delimIndex, LRM); delimIndex = INDEX_NOT_SET; isLastRTL = false; @@ -195,7 +195,7 @@ public class TextProcessor { isStringBidi = true; if (delimIndex != INDEX_NOT_SET) { // neutral character followed by strong right directional character - // explicitly force direction to be LRM + // explicitly force direction to be LRM target.insert(delimIndex, LRM); delimIndex = INDEX_NOT_SET; } @@ -211,10 +211,10 @@ public class TextProcessor { /* * TextProcessor is not aware of the orientation of the component owning * the processed string. Enclose the string in LRE/PDF in either of 2 - * cases: + * cases: * (1) The string contains BiDi characters - implying that the - * string appearance depends on the basic orientation - * (2) The runtime locale is BiDi AND either the string does not start with + * string appearance depends on the basic orientation + * (2) The runtime locale is BiDi AND either the string does not start with * an LTR character or it ends with LTR char or digit. */ if (isStringBidi || !Character.isLetter(str.charAt(0)) || isNeutral(str.charAt(str.length() - 1))) { @@ -226,12 +226,12 @@ public class TextProcessor { } /** - * Removes directional marker characters in the given string that were inserted by + * Removes directional marker characters in the given string that were inserted by * utilizing the <code>process(String)</code> or <code>process(String, String)</code> * methods. - * + * * @param str string with directional markers to remove - * @return string with no directional markers + * @return string with no directional markers * @see #process(String) * @see #process(String, String) * @since 3.3 @@ -240,7 +240,7 @@ public class TextProcessor { if (!IS_PROCESSING_NEEDED || str == null || str.length() <= 1) return str; - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); for (int i = 0; i < str.length(); i++) { char c = str.charAt(i); switch (c) { @@ -261,7 +261,7 @@ public class TextProcessor { /** * Return the string containing all the default delimiter characters to be * used to segment a given string. - * + * * @return delimiter string */ public static String getDefaultDelimiters() { @@ -275,11 +275,11 @@ public class TextProcessor { /* * Cannot use Character.getDirectionality() since the OSGi library can * be compiled with execution environments that pre-date that API. - * + * * The first range of characters is Unicode Hebrew and Arabic * characters. The second range of characters is Unicode Hebrew and * Arabic presentation forms. - * + * * NOTE: Farsi and Urdu fall within the Arabic scripts. */ return (((c >= 0x05d0) && (c <= 0x07b1)) || ((c >= 0xfb1d) && (c <= 0xfefc))); |