This is an automated email from the ASF dual-hosted git repository. jtulach pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/netbeans.git
The following commit(s) were added to refs/heads/master by this push: new 0a58de8 Efficient instead of effective new b4e2250 Merging additional Jan's fixes from branch 'jtulach/CharSequences' 0a58de8 is described below commit 0a58de8a9957b339c247613713d30515f73d4e0e Author: Jan Lahoda <jlah...@netbeans.org> AuthorDate: Wed May 22 08:50:19 2019 +0200 Efficient instead of effective --- platform/openide.util/arch.xml | 4 ++-- .../openide.util/src/org/openide/util/CharSequences.java | 16 ++++++++-------- .../unit/src/org/openide/util/CharSequencesTest.java | 8 ++++---- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/platform/openide.util/arch.xml b/platform/openide.util/arch.xml index f1a7abb..a8fcaae 100644 --- a/platform/openide.util/arch.xml +++ b/platform/openide.util/arch.xml @@ -71,8 +71,8 @@ <answer id="arch-usecases"> <p> Use-cases can be found in <a href="@org-openide-util-ui@/architecture-summary.html">org.openide.util.ui module</a> arch summary. - <usecase id="CharSequences" name="Effective char sequences"> - Effectively store character sequences in memory with the + <usecase id="CharSequences" name="Efficient char sequences"> + Efficiently store character sequences in memory with the help of <a href="@TOP@/org/openide/util/CharSequences.html">CharSequences</a> utility class. </usecase> diff --git a/platform/openide.util/src/org/openide/util/CharSequences.java b/platform/openide.util/src/org/openide/util/CharSequences.java index 318a1d4..b9fa71c 100644 --- a/platform/openide.util/src/org/openide/util/CharSequences.java +++ b/platform/openide.util/src/org/openide/util/CharSequences.java @@ -22,16 +22,16 @@ import java.util.Arrays; import java.util.Comparator; /** - * Effectively store {@link CharSequence strings} in memory. This + * Efficiently store {@link CharSequence strings} in memory. This * class provides useful {@code static} methods to create and * work with memory efficient {@link CharSequence} * implementations for strings using just a subsets of UTF characters. * <p> * Often the strings we deal with are based on simple English alphabet. Keeping - * them in memory as {@code char[]} isn't really effective as they may fit + * them in memory as {@code char[]} isn't really efficient as they may fit * in simple {@code byte[]}. This utility class does such <em>compression</em> * behind the scene. Use the here-in provided methods and your strings will be - * stored as effectively as possible. As can be seen from the following example, + * stored as efficiently as possible. As can be seen from the following example, * many languages benefit from the <em>compaction</em>: * <p> * {@codesnippet CharSequencesTest#createSample} @@ -43,7 +43,7 @@ import java.util.Comparator; * {@codesnippet CharSequencesTest#compareStrings} * <p> * Use {@link CharSequences#indexOf(java.lang.CharSequence, java.lang.CharSequence)} method - * to search the compacted strings effectively: + * to search the compacted strings efficiently: * <p> * {@codesnippet CharSequencesTest#indexOfSample} * <p> @@ -60,7 +60,7 @@ public final class CharSequences { /** * Creates new {@link CharSequence} instance representing the chars * in the array. The sequence contains its own copy of the array content - * represented in an effective (e.g. {@code byte[]}) way. + * represented in an efficient (e.g. {@code byte[]}) way. * * @param buf buffer to copy the characters from * @param start starting offset in the {@code buf} array @@ -112,12 +112,12 @@ public final class CharSequences { /** * Creates new {@link CharSequence} instance representing the content - * of another sequence or {@link String} effectively. + * of another sequence or {@link String} efficiently. * <p> * {@codesnippet CharSequencesTest#createSample} * <p> * @param s existing string or sequence of chars - * @return immutable char sequence effectively representing the data + * @return immutable char sequence efficiently representing the data */ public static CharSequence create(CharSequence s) { if (s == null) { @@ -1385,7 +1385,7 @@ public final class CharSequences { /** * compact char sequence implementation based on char[] array * size: 8 + 4 + 4 (= 16 bytes) + sizeof ('value') - * it is still more effective than String, because string stores length in field + * it is still more efficient than String, because string stores length in field * and it costs 20 bytes aligned into 24 */ private final static class CharBasedSequence implements CompactCharSequence, Comparable<CharSequence> { diff --git a/platform/openide.util/test/unit/src/org/openide/util/CharSequencesTest.java b/platform/openide.util/test/unit/src/org/openide/util/CharSequencesTest.java index d0b167b..2013b2d 100644 --- a/platform/openide.util/test/unit/src/org/openide/util/CharSequencesTest.java +++ b/platform/openide.util/test/unit/src/org/openide/util/CharSequencesTest.java @@ -289,13 +289,13 @@ public class CharSequencesTest { CharSequence englishText = CharSequences.create("English Text"); assertTrue("English text can be compacted", CharSequences.isCompact(englishText)); - CharSequence russianText = CharSequences.create("Русский Текст"); + CharSequence russianText = CharSequences.create("\u0420\u0443\u0441\u0441\u043A\u0438\u0439 \u0422\u0435\u043A\u0441\u0442"); assertTrue("Russian text can be compacted", CharSequences.isCompact(russianText)); - CharSequence germanText = CharSequences.create("Schlüssel"); + CharSequence germanText = CharSequences.create("Schl\u00FCssel"); assertTrue("German text can be compacted", CharSequences.isCompact(germanText)); - CharSequence czechText = CharSequences.create("Žluťoučký kůň"); + CharSequence czechText = CharSequences.create("\u017Dlu\u0165ou\u010Dk\u00FD k\u016F\u0148"); assertTrue("Czech text can be compacted", CharSequences.isCompact(czechText)); // END: CharSequencesTest#createSample } @@ -320,7 +320,7 @@ public class CharSequencesTest { @Test public void indexOfSample() { // BEGIN: CharSequencesTest#indexOfSample - CharSequence horseCarriesPepsi = CharSequences.create("Kůň veze Pepsi."); + CharSequence horseCarriesPepsi = CharSequences.create("K\u016F\u0148 veze Pepsi."); int findPepsi = CharSequences.indexOf(horseCarriesPepsi, "Pepsi"); assertEquals("Pepsi found in the sentence", 9, findPepsi); CharSequence pepsi = horseCarriesPepsi.subSequence(findPepsi, findPepsi + 5); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org For additional commands, e-mail: commits-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists