commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1154427 - in /commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/bm: Lang.java Languages.java NameType.java PhoneticEngine.java
Date Sat, 06 Aug 2011 02:14:46 GMT
Author: ggregory
Date: Sat Aug  6 02:14:46 2011
New Revision: 1154427

URL: http://svn.apache.org/viewvc?rev=1154427&view=rev
Log:
Code clean ups.

Modified:
    commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/bm/Lang.java
    commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/bm/Languages.java
    commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/bm/NameType.java
    commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/bm/PhoneticEngine.java

Modified: commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/bm/Lang.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/bm/Lang.java?rev=1154427&r1=1154426&r2=1154427&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/bm/Lang.java (original)
+++ commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/bm/Lang.java Sat
Aug  6 02:14:46 2011
@@ -199,11 +199,7 @@ public class Lang {
      */
     public String guessLanguage(String text) {
         Languages.LanguageSet ls = guessLanguages(text);
-        if (ls.isSingleton()) {
-            return ls.getAny();
-        } else {
-            return Languages.ANY;
-        }
+        return ls.isSingleton() ? ls.getAny() : Languages.ANY; 
     }
 
     /**
@@ -235,10 +231,6 @@ public class Lang {
         }
 
         Languages.LanguageSet ls = Languages.LanguageSet.from(langs);
-        if (ls.equals(Languages.NO_LANGUAGES)) {
-            return Languages.ANY_LANGUAGE;
-        } else {
-            return ls;
-        }
+        return ls.equals(Languages.NO_LANGUAGES) ? Languages.ANY_LANGUAGE : ls;
     }
 }

Modified: commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/bm/Languages.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/bm/Languages.java?rev=1154427&r1=1154426&r2=1154427&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/bm/Languages.java
(original)
+++ commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/bm/Languages.java
Sat Aug  6 02:14:46 2011
@@ -58,12 +58,9 @@ public class Languages {
      * A set of languages.
      */
     public static abstract class LanguageSet {
+        
         public static LanguageSet from(Set<String> langs) {
-            if (langs.isEmpty()) {
-                return NO_LANGUAGES;
-            } else {
-                return new SomeLanguages(langs);
-            }
+            return langs.isEmpty() ? NO_LANGUAGES : new SomeLanguages(langs);  
         }
 
         public abstract boolean contains(String language);

Modified: commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/bm/NameType.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/bm/NameType.java?rev=1154427&r1=1154426&r2=1154427&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/bm/NameType.java
(original)
+++ commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/bm/NameType.java
Sat Aug  6 02:14:46 2011
@@ -24,10 +24,13 @@ package org.apache.commons.codec.languag
  * @since 2.0
  */
 public enum NameType {
+    
     /** Ashkenazi family names */
     ASHKENAZI("ash"),
+    
     /** Generic names and words */
     GENERIC("gen"),
+    
     /** Sephardic family names */
     SEPHARDIC("sep");
 

Modified: commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/bm/PhoneticEngine.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/bm/PhoneticEngine.java?rev=1154427&r1=1154426&r2=1154427&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/bm/PhoneticEngine.java
(original)
+++ commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/bm/PhoneticEngine.java
Sat Aug  6 02:14:46 2011
@@ -50,6 +50,7 @@ import java.util.TreeSet;
  * @since 2.0
  */
 public class PhoneticEngine {
+
     static class PhonemeBuilder {
 
         public static PhonemeBuilder empty(Languages.LanguageSet languages) {
@@ -97,8 +98,9 @@ public class PhoneticEngine {
             // System.err.println(this.phonemes.getClass());
 
             for (Rule.Phoneme ph : this.phonemes) {
-                if (sb.length() > 0)
+                if (sb.length() > 0) {
                     sb.append("|");
+                }
                 sb.append(ph.getPhonemeText());
             }
 
@@ -330,8 +332,7 @@ public class PhoneticEngine {
                     return "(" + encode(remainder) + ")-(" + encode(combined) + ")";
                 }
                 // fixme: this case is invariant on l
-                else if (input.length() >= 2 && input.substring(0, 2).equals("d'"))
// check for d'
-                {
+                else if (input.length() >= 2 && input.substring(0, 2).equals("d'"))
{ // check for d'
                     String remainder = input.substring(2);
                     String combined = "d" + remainder;
                     return "(" + encode(remainder) + ")-(" + encode(combined) + ")";



Mime
View raw message