Revision: 8513 http://languagetool.svn.sourceforge.net/languagetool/?rev=8513&view=rev Author: dnaber Date: 2012-12-08 11:34:14 +0000 (Sat, 08 Dec 2012) Log Message: ----------- make Tools.median() private, as it should not have been public anyway (it's not used anywhere outside Tools)
Modified Paths: -------------- trunk/JLanguageTool/CHANGES.txt trunk/JLanguageTool/src/main/java/org/languagetool/tools/Tools.java Modified: trunk/JLanguageTool/CHANGES.txt =================================================================== --- trunk/JLanguageTool/CHANGES.txt 2012-12-08 11:27:38 UTC (rev 8512) +++ trunk/JLanguageTool/CHANGES.txt 2012-12-08 11:34:14 UTC (rev 8513) @@ -39,6 +39,8 @@ -API: Language.getLanguageForShortName() now consistently throws an exception if the given language code is not known + -API: Tools.median() is now private (it was accidentally made public) + -HTTP API: the XML we return now contains a new attribute "locqualityissuetype", which is the "Localization Quality Issue Type" in the upcoming Internationalization Tag Set (ITS) Version 2.0 standard from W3C. This means errors are now categorized according to Modified: trunk/JLanguageTool/src/main/java/org/languagetool/tools/Tools.java =================================================================== --- trunk/JLanguageTool/src/main/java/org/languagetool/tools/Tools.java 2012-12-08 11:27:38 UTC (rev 8512) +++ trunk/JLanguageTool/src/main/java/org/languagetool/tools/Tools.java 2012-12-08 11:34:14 UTC (rev 8513) @@ -433,7 +433,6 @@ final long endTime = System.currentTimeMillis(); workTime[k] = endTime - startTime; } - Arrays.sort(workTime); final long time = median(workTime); final float timeInSeconds = time / 1000.0f; final float sentencesPerSecond = sentences.size() / timeInSeconds; @@ -443,17 +442,9 @@ System.out.println(); } } - - public static int profileRulesOnLine(final String contents, - final JLanguageTool lt, final Rule rule) throws IOException { - int count = 0; - for (final String sentence : lt.sentenceTokenize(contents)) { - count += rule.match(lt.getAnalyzedSentence(sentence)).length ; - } - return count; - } - public static long median(long[] m) { + private static long median(long[] m) { + Arrays.sort(m); final int middle = m.length / 2; // subscript of middle element if (m.length % 2 == 1) { // Odd number of elements -- return the middle one. @@ -462,6 +453,15 @@ return (m[middle-1] + m[middle]) / 2; } + public static int profileRulesOnLine(final String contents, + final JLanguageTool lt, final Rule rule) throws IOException { + int count = 0; + for (final String sentence : lt.sentenceTokenize(contents)) { + count += rule.match(lt.getAnalyzedSentence(sentence)).length ; + } + return count; + } + /** * Automatically applies suggestions to the text, as suggested * by the rules that match. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d _______________________________________________ Languagetool-commits mailing list Languagetool-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/languagetool-commits