Revision: 9258
          
http://languagetool.svn.sourceforge.net/languagetool/?rev=9258&view=rev
Author:   dnaber
Date:     2013-01-28 22:36:24 +0000 (Mon, 28 Jan 2013)
Log Message:
-----------
adding missing license headers; some whitespace cleanup; small code cleanup

Modified Paths:
--------------
    
trunk/languagetool/languagetool-standalone/src/main/dev/org/languagetool/dev/tools/RomanianDiacriticsModifier.java

Modified: 
trunk/languagetool/languagetool-standalone/src/main/dev/org/languagetool/dev/tools/RomanianDiacriticsModifier.java
===================================================================
--- 
trunk/languagetool/languagetool-standalone/src/main/dev/org/languagetool/dev/tools/RomanianDiacriticsModifier.java
  2013-01-28 22:31:57 UTC (rev 9257)
+++ 
trunk/languagetool/languagetool-standalone/src/main/dev/org/languagetool/dev/tools/RomanianDiacriticsModifier.java
  2013-01-28 22:36:24 UTC (rev 9258)
@@ -1,99 +1,103 @@
+/* LanguageTool, a natural language style checker
+ * Copyright (C) 2009 Ionuț Păduraru
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
+ * USA
+ */
 package org.languagetool.dev.tools;
 
 /**
- * 
  * Helper class for romanian diacritics correction. Many romanian texts
  * (including Romanian wikipedia) contains wrong diacritics: <b>ş</b> instead 
of
  * <b>ș</b> and <b>ţ</b> instead of <b>ț</b>.
  * 
  * @author Ionuț Păduraru
- * @since 14.04.2009 12:27:24
  */
 public final class RomanianDiacriticsModifier {
 
-       private RomanianDiacriticsModifier() {
-               // private constructor
-       }
-       private static final int REPLACEMENT_BUFF_SIZE = 10 * 1024;
-       private static char[] cCorrectDiacritics = null;
-       private static char[] replacementBuff = null;
+  private RomanianDiacriticsModifier() {
+    // private constructor
+  }
+  private static final int REPLACEMENT_BUFF_SIZE = 10 * 1024;
+  private static char[] cCorrectDiacritics = null;
+  private static char[] replacementBuff = null;
 
-       /**
-        * Initialize internal buffers
-        * 
-        * @author Ionuț Păduraru
-        * @since 14.04.2009 12:32:29
-        */
-       private synchronized static void initCharMap() {
-               if (cCorrectDiacritics == null) {
-                       replacementBuff = new char[REPLACEMENT_BUFF_SIZE];
-                       cCorrectDiacritics = new char[Character.MAX_VALUE
-                                       - Character.MIN_VALUE];
-                       char c = Character.MIN_VALUE;
-                       for (int i = 0; i < Character.MAX_VALUE - 
Character.MIN_VALUE; i++) {
-                               final char newC = diac(c);
-                               cCorrectDiacritics[i] = newC;
-                               c++;
-                       }
-               }
-       }
+  /**
+   * Initialize internal buffers
+   */
+  private synchronized static void initCharMap() {
+    if (cCorrectDiacritics == null) {
+      replacementBuff = new char[REPLACEMENT_BUFF_SIZE];
+      cCorrectDiacritics = new char[Character.MAX_VALUE - Character.MIN_VALUE];
+      char c = Character.MIN_VALUE;
+      for (int i = 0; i < Character.MAX_VALUE - Character.MIN_VALUE; i++) {
+        final char newC = diac(c);
+        cCorrectDiacritics[i] = newC;
+        c++;
+      }
+    }
+  }
 
-       /**
-        * Single character correction. Used internally during buffers
-        * initialization
-        * 
-        * @author Ionuț Păduraru
-        * @since 14.04.2009 12:32:52
-        * @param c
-        * @return
-        */
-       private static char diac(char c) {
-               switch (c) {
-               case 'ş':
-                       c = 'ș';
-                       break;
-               case 'ţ':
-                       c = 'ț';
-                       break;
-               case 'Ţ':
-                       c = 'Ț';
-                       break;
-               case 'Ş':
-                       c = 'Ș';
-                       break;
-               default:
-                       break;
-               }
-               return c;
-       }
+  /**
+   * Single character correction. Used internally during buffers
+   * initialization.
+   */
+  private static char diac(char c) {
+    char result = c;
+    switch (c) {
+      case 'ş':
+        result = 'ș';
+        break;
+      case 'ţ':
+        result = 'ț';
+        break;
+      case 'Ţ':
+        result = 'Ț';
+        break;
+      case 'Ş':
+        result = 'Ș';
+        break;
+      default:
+        break;
+    }
+    return result;
+  }
 
-       /**
-        * Romanian diactitics correction: replace <b>ş</b> with <b>ș</b> and
-        * <b>ţ</b> with <b>ț</b>(including upper-case variants). <br/>
-        * Thread-safe method.
-        * 
-        * @author Ionuț Păduraru
-        * @since 14.04.2009 12:33:39
-        * @param s
-        */
-       public static synchronized String correctDiacritrics(String s) {
-               if (null == s)
-                       return null;
-               initCharMap();
-               final int length = s.length();
-               // check buffer size
-               if (length > replacementBuff.length) {
-                       replacementBuff = new char[length];
-               }
-               // get current chars
-               s.getChars(0, length, replacementBuff, 0);
-               // replace
-               for (int i = 0; i < length; i++) {
-                       replacementBuff[i] = 
cCorrectDiacritics[replacementBuff[i]];
+  /**
+   * Romanian diacritics correction: replace <b>ş</b> with <b>ș</b> and
+   * <b>ţ</b> with <b>ț</b> (including upper-case variants).<br/>
+   * Thread-safe method.
+   */
+  public static synchronized String correctDiacritrics(String s) {
+    if (null == s) {
+      return null;
+    }
+    initCharMap();
+    final int length = s.length();
+    // check buffer size
+    if (length > replacementBuff.length) {
+      replacementBuff = new char[length];
+    }
+    // get current chars
+    s.getChars(0, length, replacementBuff, 0);
+    // replace
+    for (int i = 0; i < length; i++) {
+      replacementBuff[i] = cCorrectDiacritics[replacementBuff[i]];
+    }
+    // return the corrected string
+    return String.valueOf(replacementBuff, 0, length);
+  }
 
-               }
-               // return the corrected string
-               return String.valueOf(replacementBuff, 0, length);
-       }
-
 }
\ No newline at end of file

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
_______________________________________________
Languagetool-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/languagetool-commits

Reply via email to