Skip to content

Commit 4229741

Browse files
committed
Javadoc
1 parent bbe118f commit 4229741

17 files changed

+1838
-2017
lines changed

src/main/java/org/apache/commons/text/AlphabetConverter.java

Lines changed: 35 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ public final class AlphabetConverter {
8282
/**
8383
* Creates new String that contains just the given code point.
8484
*
85-
* @param i code point
86-
* @return a new string with the new code point
85+
* @param i code point.
86+
* @return a new string with the new code point.
8787
* @see "http://www.oracle.com/us/technologies/java/supplementary-142654.html"
8888
*/
8989
private static String codePointToString(final int i) {
@@ -96,8 +96,8 @@ private static String codePointToString(final int i) {
9696
/**
9797
* Converts characters to integers.
9898
*
99-
* @param chars array of characters
100-
* @return an equivalent array of integers
99+
* @param chars array of characters.
100+
* @return an equivalent array of integers.
101101
*/
102102
private static Integer[] convertCharsToIntegers(final Character[] chars) {
103103
if (ArrayUtils.isEmpty(chars)) {
@@ -109,22 +109,19 @@ private static Integer[] convertCharsToIntegers(final Character[] chars) {
109109
}
110110

111111
/**
112-
* Creates an alphabet converter, for converting from the original alphabet,
113-
* to the encoded alphabet, while leaving
114-
* the characters in <em>doNotEncode</em> as they are (if possible).
112+
* Creates an alphabet converter, for converting from the original alphabet, to the encoded alphabet, while leaving the characters in <em>doNotEncode</em>
113+
* as they are (if possible).
115114
*
116-
* <p>Duplicate letters in either original or encoding will be ignored.</p>
115+
* <p>
116+
* Duplicate letters in either original or encoding will be ignored.
117+
* </p>
117118
*
118-
* @param original an array of ints representing the original alphabet in
119-
* code points
120-
* @param encoding an array of ints representing the alphabet to be used for
121-
* encoding, in code points
122-
* @param doNotEncode an array of ints representing the chars to be encoded
123-
* using the original alphabet - every char
124-
* here must appear in both the previous params
125-
* @return The AlphabetConverter
126-
* @throws IllegalArgumentException if an AlphabetConverter cannot be
127-
* constructed
119+
* @param original an array of ints representing the original alphabet in code points.
120+
* @param encoding an array of ints representing the alphabet to be used for encoding, in code points.
121+
* @param doNotEncode an array of ints representing the chars to be encoded using the original alphabet - every char here must appear in both the previous
122+
* params.
123+
* @return The AlphabetConverter.
124+
* @throws IllegalArgumentException if an AlphabetConverter cannot be constructed.
128125
*/
129126
public static AlphabetConverter createConverter(
130127
final Integer[] original,
@@ -251,8 +248,8 @@ public static AlphabetConverter createConverterFromChars(
251248
/**
252249
* Creates a new converter from a map.
253250
*
254-
* @param originalToEncoded a map returned from getOriginalToEncoded()
255-
* @return The reconstructed AlphabetConverter
251+
* @param originalToEncoded a map returned from getOriginalToEncoded().
252+
* @return The reconstructed AlphabetConverter.
256253
* @see AlphabetConverter#getOriginalToEncoded()
257254
*/
258255
public static AlphabetConverter createConverterFromMap(final Map<Integer, String> originalToEncoded) {
@@ -290,9 +287,9 @@ public static AlphabetConverter createConverterFromMap(final Map<Integer, String
290287
/**
291288
* Hidden constructor for alphabet converter. Used by static helper methods.
292289
*
293-
* @param originalToEncoded original string to be encoded
294-
* @param encodedToOriginal encoding alphabet
295-
* @param encodedLetterLength length of the encoded letter
290+
* @param originalToEncoded original string to be encoded.
291+
* @param encodedToOriginal encoding alphabet.
292+
* @param encodedLetterLength length of the encoded letter.
296293
*/
297294
private AlphabetConverter(final Map<Integer, String> originalToEncoded,
298295
final Map<String, String> encodedToOriginal,
@@ -306,11 +303,11 @@ private AlphabetConverter(final Map<Integer, String> originalToEncoded,
306303
/**
307304
* Recursive method used when creating encoder/decoder.
308305
*
309-
* @param level at which point it should add a single encoding
310-
* @param currentEncoding current encoding
311-
* @param encoding letters encoding
312-
* @param originals original values
313-
* @param doNotEncodeMap map of values that should not be encoded
306+
* @param level at which point it should add a single encoding.
307+
* @param currentEncoding current encoding.
308+
* @param encoding letters encoding.
309+
* @param originals original values.
310+
* @param doNotEncodeMap map of values that should not be encoded.
314311
*/
315312
private void addSingleEncoding(final int level,
316313
final String currentEncoding,
@@ -363,11 +360,9 @@ private void addSingleEncoding(final int level,
363360
/**
364361
* Decodes a given string.
365362
*
366-
* @param encoded a string that has been encoded using this
367-
* AlphabetConverter
368-
* @return The decoded string, {@code null} if the given string is null
369-
* @throws UnsupportedEncodingException if unexpected characters that
370-
* cannot be handled are encountered
363+
* @param encoded a string that has been encoded using this AlphabetConverter.
364+
* @return The decoded string, {@code null} if the given string is null.
365+
* @throws UnsupportedEncodingException if unexpected characters that cannot be handled are encountered.
371366
*/
372367
public String decode(final String encoded)
373368
throws UnsupportedEncodingException {
@@ -409,10 +404,9 @@ public String decode(final String encoded)
409404
/**
410405
* Encodes a given string.
411406
*
412-
* @param original the string to be encoded
413-
* @return The encoded string, {@code null} if the given string is null
414-
* @throws UnsupportedEncodingException if chars that are not supported are
415-
* encountered
407+
* @param original the string to be encoded.
408+
* @return The encoded string, {@code null} if the given string is null.
409+
* @throws UnsupportedEncodingException if chars that are not supported are encountered.
416410
*/
417411
public String encode(final String original)
418412
throws UnsupportedEncodingException {
@@ -462,22 +456,18 @@ public boolean equals(final Object obj) {
462456
}
463457

464458
/**
465-
* Gets the length of characters in the encoded alphabet that are necessary
466-
* for each character in the original
467-
* alphabet.
459+
* Gets the length of characters in the encoded alphabet that are necessary for each character in the original alphabet.
468460
*
469-
* @return The length of the encoded char
461+
* @return The length of the encoded char.
470462
*/
471463
public int getEncodedCharLength() {
472464
return encodedLetterLength;
473465
}
474466

475467
/**
476-
* Gets the mapping from integer code point of source language to encoded
477-
* string. Use to reconstruct converter from
478-
* serialized map.
468+
* Gets the mapping from integer code point of source language to encoded string. Use to reconstruct converter from serialized map.
479469
*
480-
* @return The original map
470+
* @return The original map.
481471
*/
482472
public Map<Integer, String> getOriginalToEncoded() {
483473
return Collections.unmodifiableMap(originalToEncoded);

src/main/java/org/apache/commons/text/CharacterPredicate.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17+
1718
package org.apache.commons.text;
1819

1920
/**
20-
* A predicate for selecting code points. Implementations of this interface must
21-
* be thread safe.
21+
* A predicate for selecting code points. Implementations of this interface must be thread safe.
2222
*
2323
* @since 1.0
2424
*/
@@ -27,10 +27,8 @@ public interface CharacterPredicate {
2727
/**
2828
* Tests the code point with this predicate.
2929
*
30-
* @param codePoint
31-
* the code point to test
32-
* @return {@code true} if the code point matches the predicate,
33-
* {@code false} otherwise
30+
* @param codePoint the code point to test.
31+
* @return {@code true} if the code point matches the predicate, {@code false} otherwise.
3432
* @since 1.0
3533
*/
3634
boolean test(int codePoint);

src/main/java/org/apache/commons/text/CompositeFormat.java

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ public class CompositeFormat extends Format {
4747
* Constructs a format that points its parseObject method to one implementation
4848
* and its format method to another.
4949
*
50-
* @param parser implementation
51-
* @param formatter implementation
50+
* @param parser implementation.
51+
* @param formatter implementation.
5252
*/
5353
public CompositeFormat(final Format parser, final Format formatter) {
5454
this.parser = parser;
@@ -58,10 +58,10 @@ public CompositeFormat(final Format parser, final Format formatter) {
5858
/**
5959
* Formats the input.
6060
*
61-
* @param obj the object to format
62-
* @param toAppendTo the {@link StringBuffer} to append to
63-
* @param pos the FieldPosition to use (or ignore).
64-
* @return {@code toAppendTo}
61+
* @param obj the object to format.
62+
* @param toAppendTo the {@link StringBuffer} to append to.
63+
* @param pos the FieldPosition to use (or ignore).
64+
* @return {@code toAppendTo}.
6565
* @see Format#format(Object, StringBuffer, FieldPosition)
6666
*/
6767
@Override // Therefore has to use StringBuffer
@@ -91,11 +91,9 @@ public Format getParser() {
9191
/**
9292
* Parses the input.
9393
*
94-
* @param source the String source
95-
* @param pos the ParsePosition containing the position to parse from, will
96-
* be updated according to parsing success (index) or failure
97-
* (error index)
98-
* @return The parsed Object
94+
* @param source the String source.
95+
* @param pos the ParsePosition containing the position to parse from, will be updated according to parsing success (index) or failure (error index).
96+
* @return The parsed Object.
9997
* @see Format#parseObject(String, ParsePosition)
10098
*/
10199
@Override
@@ -106,9 +104,9 @@ public Object parseObject(final String source, final ParsePosition pos) {
106104
/**
107105
* Parses and then reformats a String.
108106
*
109-
* @param input String to reformat
110-
* @return A reformatted String
111-
* @throws ParseException thrown by parseObject(String) call
107+
* @param input String to reformat.
108+
* @return A reformatted String.
109+
* @throws ParseException thrown by parseObject(String) call.
112110
*/
113111
public String reformat(final String input) throws ParseException {
114112
return format(parseObject(input));

0 commit comments

Comments
 (0)