Skip to content

Commit 4541fb8

Browse files
committed
Checkstyle fixes.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/codec/trunk@1378746 13f79535-47bb-0310-9956-ffa450edef68
1 parent 7ab7ec5 commit 4541fb8

4 files changed

Lines changed: 36 additions & 21 deletions

File tree

src/main/java/org/apache/commons/codec/language/bm/BeiderMorseEncoder.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
/**
2424
* Encodes strings into their Beider-Morse phonetic encoding.
2525
* <p>
26-
* Beider-Morse phonetic encodings are optimised for family names. However, they may be useful for a wide range of words.
26+
* Beider-Morse phonetic encodings are optimised for family names. However, they may be useful for a wide range
27+
* of words.
2728
* <p>
2829
* This encoder is intentionally mutable to allow dynamic configuration through bean properties. As such, it
2930
* is mutable, and may not be thread-safe. If you require a guaranteed thread-safe encoding then use
@@ -55,7 +56,7 @@
5556
* If multiple hyphenated words where found, or if the word may contain a name prefix, each encoded word is placed
5657
* in elipses and these blocks are then joined with hyphens. For example, "<code>d'ortley</code>" has a possible
5758
* prefix. The form without prefix encodes to "<code>ortlaj|ortlej</code>", while the form with prefix encodes to
58-
* "<code>dortlaj|dortlej</code>". Thus, the full, combined encoding is "<code>(ortlaj|ortlej)-(dortlaj|dortlej)</code>".
59+
* "<code>dortlaj|dortlej</code>". Thus, the full, combined encoding is "{@code (ortlaj|ortlej)-(dortlaj|dortlej)}".
5960
* <p>
6061
* The encoded forms are often quite a bit longer than the input strings. This is because a single input may have many
6162
* potential phonetic interpretations. For example, "<code>Renault</code>" encodes to
@@ -121,7 +122,8 @@ public boolean isConcat() {
121122
* Sets how multiple possible phonetic encodings are combined.
122123
*
123124
* @param concat
124-
* true if multiple encodings are to be combined with a '|', false if just the first one is to be considered
125+
* true if multiple encodings are to be combined with a '|', false if just the first one is
126+
* to be considered
125127
*/
126128
public void setConcat(boolean concat) {
127129
this.engine = new PhoneticEngine(this.engine.getNameType(),

src/main/java/org/apache/commons/codec/language/bm/Languages.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,10 @@
3636
* The format of these resources is the following:
3737
* <ul>
3838
* <li><b>Language:</b> a single string containing no whitespace</li>
39-
* <li><b>End-of-line comments:</b> Any occurance of '//' will cause all text following on that line to be discarded as a comment.</li>
40-
* <li><b>Multi-line comments:</b> Any line starting with '/*' will start multi-line commenting mode. This will skip all content until a
41-
* line ending in '*' and '/' is found.</li>
39+
* <li><b>End-of-line comments:</b> Any occurrence of '//' will cause all text following on that line to be
40+
* discarded as a comment.</li>
41+
* <li><b>Multi-line comments:</b> Any line starting with '/*' will start multi-line commenting mode.
42+
* This will skip all content until a line ending in '*' and '/' is found.</li>
4243
* <li><b>Blank lines:</b> All blank lines will be skipped.</li>
4344
* </ul>
4445
* <p>

src/main/java/org/apache/commons/codec/language/bm/PhoneticEngine.java

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -231,11 +231,16 @@ public boolean isFound() {
231231

232232
static {
233233
NAME_PREFIXES.put(NameType.ASHKENAZI,
234-
Collections.unmodifiableSet(new HashSet<String>(Arrays.asList("bar", "ben", "da", "de", "van", "von"))));
235-
NAME_PREFIXES.put(NameType.SEPHARDIC, Collections.unmodifiableSet(new HashSet<String>(Arrays.asList("al", "el", "da", "dal", "de",
236-
"del", "dela", "de la", "della", "des", "di", "do", "dos", "du", "van", "von"))));
237-
NAME_PREFIXES.put(NameType.GENERIC, Collections.unmodifiableSet(new HashSet<String>(Arrays.asList("da", "dal", "de", "del", "dela",
238-
"de la", "della", "des", "di", "do", "dos", "du", "van", "von"))));
234+
Collections.unmodifiableSet(
235+
new HashSet<String>(Arrays.asList("bar", "ben", "da", "de", "van", "von"))));
236+
NAME_PREFIXES.put(NameType.SEPHARDIC,
237+
Collections.unmodifiableSet(
238+
new HashSet<String>(Arrays.asList("al", "el", "da", "dal", "de", "del", "dela", "de la",
239+
"della", "des", "di", "do", "dos", "du", "van", "von"))));
240+
NAME_PREFIXES.put(NameType.GENERIC,
241+
Collections.unmodifiableSet(
242+
new HashSet<String>(Arrays.asList("da", "dal", "de", "del", "dela", "de la", "della",
243+
"des", "di", "do", "dos", "du", "van", "von"))));
239244
}
240245

241246
/**
@@ -278,7 +283,7 @@ public CharSequence subSequence(int start, int end) {
278283
* Joins some strings with an internal separator.
279284
* @param strings Strings to join
280285
* @param sep String to separate them with
281-
* @return a single String consisting of each element of <code>strings</code> interleaved by <code>sep</code>
286+
* @return a single String consisting of each element of <code>strings</code> interleaved by <code>sep</code>
282287
*/
283288
private static String join(Iterable<String> strings, String sep) {
284289
StringBuilder sb = new StringBuilder();
@@ -403,7 +408,8 @@ public String encode(String input) {
403408
* @param input
404409
* String to phoneticise; a String with dashes or spaces separating each word
405410
* @param languageSet
406-
* @return a phonetic representation of the input; a String containing '-'-separated phonetic representations of the input
411+
* @return a phonetic representation of the input; a String containing '-'-separated phonetic representations
412+
* of the input
407413
*/
408414
public String encode(String input, final Languages.LanguageSet languageSet) {
409415
final List<Rule> rules = Rule.getInstance(this.nameType, RuleType.RULES, languageSet);

src/main/java/org/apache/commons/codec/language/bm/Rule.java

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@ public CharSequence getPhonemeText() {
127127
}
128128

129129
public Phoneme join(Phoneme right) {
130-
return new Phoneme(this.phonemeText.toString() + right.phonemeText.toString(), this.languages.restrictTo(right.languages));
130+
return new Phoneme(this.phonemeText.toString() + right.phonemeText.toString(),
131+
this.languages.restrictTo(right.languages));
131132
}
132133
}
133134

@@ -168,8 +169,8 @@ public boolean isMatch(CharSequence input) {
168169

169170
private static final String HASH_INCLUDE = "#include";
170171

171-
private static final Map<NameType, Map<RuleType, Map<String, List<Rule>>>> RULES = new EnumMap<NameType, Map<RuleType, Map<String, List<Rule>>>>(
172-
NameType.class);
172+
private static final Map<NameType, Map<RuleType, Map<String, List<Rule>>>> RULES =
173+
new EnumMap<NameType, Map<RuleType, Map<String, List<Rule>>>>(NameType.class);
173174

174175
static {
175176
for (NameType s : NameType.values()) {
@@ -207,7 +208,8 @@ private static boolean contains(CharSequence chars, char input) {
207208
}
208209

209210
private static String createResourceName(NameType nameType, RuleType rt, String lang) {
210-
return String.format("org/apache/commons/codec/language/bm/%s_%s_%s.txt", nameType.getName(), rt.getName(), lang);
211+
return String.format("org/apache/commons/codec/language/bm/%s_%s_%s.txt",
212+
nameType.getName(), rt.getName(), lang);
211213
}
212214

213215
private static Scanner createScanner(NameType nameType, RuleType rt, String lang) {
@@ -256,7 +258,8 @@ private static boolean endsWith(CharSequence input, CharSequence suffix) {
256258
* @return a list of Rules that apply
257259
*/
258260
public static List<Rule> getInstance(NameType nameType, RuleType rt, Languages.LanguageSet langs) {
259-
return langs.isSingleton() ? getInstance(nameType, rt, langs.getAny()) : getInstance(nameType, rt, Languages.ANY);
261+
return langs.isSingleton() ? getInstance(nameType, rt, langs.getAny()) :
262+
getInstance(nameType, rt, Languages.ANY);
260263
}
261264

262265
/**
@@ -274,7 +277,8 @@ public static List<Rule> getInstance(NameType nameType, RuleType rt, String lang
274277
List<Rule> rules = RULES.get(nameType).get(rt).get(lang);
275278

276279
if (rules == null) {
277-
throw new IllegalArgumentException(String.format("No rules found for %s, %s, %s.", nameType.getName(), rt.getName(), lang));
280+
throw new IllegalArgumentException(String.format("No rules found for %s, %s, %s.",
281+
nameType.getName(), rt.getName(), lang));
278282
}
279283

280284
return rules;
@@ -364,7 +368,8 @@ private static List<Rule> parseRules(final Scanner scanner, final String locatio
364368
String[] parts = line.split("\\s+");
365369
if (parts.length != 4) {
366370
// FIXME: consider throwing an IllegalStateException like in parsePhonemeExpr
367-
// System.err.println("Warning: malformed rule statement split into " + parts.length + " parts: " + rawLine);
371+
// System.err.println("Warning: malformed rule statement split into " + parts.length +
372+
// " parts: " + rawLine);
368373
} else {
369374
try {
370375
String pat = stripQuotes(parts[0]);
@@ -487,7 +492,8 @@ public boolean isMatch(CharSequence input) {
487492
return new RPattern() {
488493
@Override
489494
public boolean isMatch(CharSequence input) {
490-
return input.length() > 0 && contains(bContent, input.charAt(input.length() - 1)) == shouldMatch;
495+
return input.length() > 0 &&
496+
contains(bContent, input.charAt(input.length() - 1)) == shouldMatch;
491497
}
492498
};
493499
}

0 commit comments

Comments
 (0)