You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by sp...@apache.org on 2010/10/02 19:48:07 UTC

svn commit: r1003845 - /xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/Hyphenator.java

Author: spepping
Date: Sat Oct  2 17:48:07 2010
New Revision: 1003845

URL: http://svn.apache.org/viewvc?rev=1003845&view=rev
Log:
Remove unused methods from Hyphenator; this leaves a utility class

Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/Hyphenator.java

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/Hyphenator.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/Hyphenator.java?rev=1003845&r1=1003844&r2=1003845&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/Hyphenator.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/Hyphenator.java Sat Oct  2 17:48:07 2010
@@ -47,25 +47,13 @@ public class Hyphenator {
 
     private static HyphenationTreeCache hTreeCache = null;
 
-    private HyphenationTree hyphenTree = null;
-    private int remainCharCount = 2;
-    private int pushCharCount = 2;
     /** Enables a dump of statistics. Note: If activated content is sent to System.out! */
     private static boolean statisticsDump = false;
 
     /**
      * Creates a new hyphenator.
-     * @param lang the language
-     * @param country the country (may be null or "none")
-     * @param leftMin the minimum number of characters before the hyphenation point
-     * @param rightMin the minimum number of characters after the hyphenation point
      */
-    public Hyphenator(String lang, String country, int leftMin,
-                      int rightMin) {
-        hyphenTree = getHyphenationTree(lang, country);
-        remainCharCount = leftMin;
-        pushCharCount = rightMin;
-    }
+    private Hyphenator() { }
 
     /** @return the default (static) hyphenation tree cache */
     public static synchronized HyphenationTreeCache getHyphenationTreeCache() {
@@ -414,56 +402,4 @@ public class Hyphenator {
         return hyphenate(lang, country, null, null, word, offset, len, leftMin, rightMin);
     }
 
-    /**
-     * Sets the minimum number of characters before the hyphenation point
-     * @param min the number of characters
-     */
-    public void setMinRemainCharCount(int min) {
-        remainCharCount = min;
-    }
-
-    /**
-     * Sets the minimum number of characters after the hyphenation point
-     * @param min the number of characters
-     */
-    public void setMinPushCharCount(int min) {
-        pushCharCount = min;
-    }
-
-    /**
-     * Sets the language and country for the hyphenation process.
-     * @param lang the language
-     * @param country the country (may be null or "none")
-     */
-    public void setLanguage(String lang, String country) {
-        hyphenTree = getHyphenationTree(lang, country);
-    }
-
-    /**
-     * Hyphenates a word.
-     * @param word the word to hyphenate
-     * @param offset the offset of the first character in the "word" character array
-     * @param len the length of the word
-     * @return the hyphenation result
-     */
-    public Hyphenation hyphenate(char[] word, int offset, int len) {
-        if (hyphenTree == null) {
-            return null;
-        }
-        return hyphenTree.hyphenate(word, offset, len, remainCharCount,
-                                    pushCharCount);
-    }
-
-    /**
-     * Hyphenates a word.
-     * @param word the word to hyphenate
-     * @return the hyphenation result
-     */
-    public Hyphenation hyphenate(String word) {
-        if (hyphenTree == null) {
-            return null;
-        }
-        return hyphenTree.hyphenate(word, remainCharCount, pushCharCount);
-    }
-
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org


Re: svn commit: r1003845 - /xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/Hyphenator.java

Posted by Vincent Hennebert <vh...@gmail.com>.
On 02/10/10 19:37, Simon Pepping wrote:
> On Sat, Oct 02, 2010 at 05:48:07PM -0000, spepping@apache.org wrote:
>> Author: spepping
>> Date: Sat Oct  2 17:48:07 2010
>> New Revision: 1003845
>>
>> URL: http://svn.apache.org/viewvc?rev=1003845&view=rev
>> Log:
>> Remove unused methods from Hyphenator; this leaves a utility class
>>
>> Modified:
>>     xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/Hyphenator.java
>>
> 
> When I wanted to add configurability for hyphenation pattern file
> names, I had to analyse the callers of a lot of Hyphenator methods, to
> see if they needed access to the configuration. It turned out that
> several methods were never called from within FOP. Even the Hyphenator
> constructor is not called from within FOP, so that there never is a
> Hyphenator object in FOP. I removed these methods because it
> facilitates working on FOP's code, and saves a lot of time. Of course,
> there is a remote possibility that these public methods are used by an
> external application, but that is so remote as to be beyond my
> horizon.

... and I couldn’t agree more. Thanks for this clean-up work :-)

Vincent

Re: svn commit: r1003845 - /xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/Hyphenator.java

Posted by Simon Pepping <sp...@leverkruid.eu>.
On Sat, Oct 02, 2010 at 05:48:07PM -0000, spepping@apache.org wrote:
> Author: spepping
> Date: Sat Oct  2 17:48:07 2010
> New Revision: 1003845
> 
> URL: http://svn.apache.org/viewvc?rev=1003845&view=rev
> Log:
> Remove unused methods from Hyphenator; this leaves a utility class
> 
> Modified:
>     xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/Hyphenator.java
> 

When I wanted to add configurability for hyphenation pattern file
names, I had to analyse the callers of a lot of Hyphenator methods, to
see if they needed access to the configuration. It turned out that
several methods were never called from within FOP. Even the Hyphenator
constructor is not called from within FOP, so that there never is a
Hyphenator object in FOP. I removed these methods because it
facilitates working on FOP's code, and saves a lot of time. Of course,
there is a remote possibility that these public methods are used by an
external application, but that is so remote as to be beyond my
horizon.

Simon

-- 
Simon Pepping
home page: http://www.leverkruid.eu