org.foray.hyphen
Class HyphenationServer4a

java.lang.Object
  extended by org.foray.hyphen.HyphenationServer4a
All Implemented Interfaces:
org.axsl.hyphen.HyphenationServer

public class HyphenationServer4a
extends Object
implements org.axsl.hyphen.HyphenationServer

This class is the main entry point to the hyphenation package.


Field Summary
static String PATTERN_RESOURCE_PATH
          The path to the hyphenation patterns.
 
Constructor Summary
HyphenationServer4a(org.apache.commons.logging.Log logger, URL hyphenationDir, URL naturalLanguageDir)
          Constructor.
 
Method Summary
static String buildCountryKey(String languageCode, org.axsl.common.i18n.Country rawCountryCode)
          Concatenates a language code with a country code to create a country key suitable for naming country-specific items.
 URL getHyphenationDir()
          Returns the hyphenation directory for this server.
 org.apache.commons.logging.Log getLogger()
          Returns the logger.
 NaturalLanguage getNaturalLanguage(org.axsl.common.i18n.Language iso639)
          Finds or creates the instance of this class that is suitable for a given language description.
 NaturalLanguage getNaturalLanguage(String languageCode)
          Finds or creates the instance of this class that is suitable for a given language description.
 org.axsl.hyphen.Word hyphenate(CharSequence word, int offset, int length, org.axsl.common.i18n.Orthography orthography)
           
 org.axsl.hyphen.HyphenationConsumer makeConsumer()
           
 NaturalLanguage makeNaturalLanguage(String languageCode)
          Makes a new, empty instance of this class for a given language description.
 int wordSize(CharSequence characters, int wordStart, org.axsl.common.i18n.Orthography orthography)
           
 int wordStarts(CharSequence characters, int startIndex, org.axsl.common.i18n.Orthography orthography)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PATTERN_RESOURCE_PATH

public static final String PATTERN_RESOURCE_PATH
The path to the hyphenation patterns.

See Also:
Constant Field Values
Constructor Detail

HyphenationServer4a

public HyphenationServer4a(org.apache.commons.logging.Log logger,
                           URL hyphenationDir,
                           URL naturalLanguageDir)
Constructor.

Parameters:
logger - The Log instance for user messages. Null can safely be passed here as a default logger will be created by the server.
hyphenationDir - The base URL for hyphenation patterns.
naturalLanguageDir - The base URL for natural language definitions.
Method Detail

hyphenate

public org.axsl.hyphen.Word hyphenate(CharSequence word,
                                      int offset,
                                      int length,
                                      org.axsl.common.i18n.Orthography orthography)
                               throws org.axsl.hyphen.HyphenationException
Specified by:
hyphenate in interface org.axsl.hyphen.HyphenationServer
Throws:
org.axsl.hyphen.HyphenationException

getLogger

public org.apache.commons.logging.Log getLogger()
Returns the logger.

Returns:
The logger.

wordSize

public int wordSize(CharSequence characters,
                    int wordStart,
                    org.axsl.common.i18n.Orthography orthography)
Specified by:
wordSize in interface org.axsl.hyphen.HyphenationServer

wordStarts

public int wordStarts(CharSequence characters,
                      int startIndex,
                      org.axsl.common.i18n.Orthography orthography)
Specified by:
wordStarts in interface org.axsl.hyphen.HyphenationServer

buildCountryKey

public static String buildCountryKey(String languageCode,
                                     org.axsl.common.i18n.Country rawCountryCode)
Concatenates a language code with a country code to create a country key suitable for naming country-specific items.

Parameters:
languageCode - The language to be included in the country key.
rawCountryCode - The country to be included in the country key.
Returns:
The country key, or null if the input is invalid.

getHyphenationDir

public URL getHyphenationDir()
Returns the hyphenation directory for this server.

Returns:
The hyphenation directory.

getNaturalLanguage

public NaturalLanguage getNaturalLanguage(String languageCode)
Finds or creates the instance of this class that is suitable for a given language description.

Parameters:
languageCode - The ISO-639 code for the language sought.
Returns:
The suitable instance for languageCode.

getNaturalLanguage

public NaturalLanguage getNaturalLanguage(org.axsl.common.i18n.Language iso639)
Finds or creates the instance of this class that is suitable for a given language description.

Parameters:
iso639 - The ISO-639 instance for the language sought.
Returns:
The suitable instance for iso639.

makeNaturalLanguage

public NaturalLanguage makeNaturalLanguage(String languageCode)
Makes a new, empty instance of this class for a given language description.

Parameters:
languageCode - The ISO-639 code for the new instance.
Returns:
A new instance for languageCode, or null if an instance already exists for it.

makeConsumer

public org.axsl.hyphen.HyphenationConsumer makeConsumer()
Specified by:
makeConsumer in interface org.axsl.hyphen.HyphenationServer


Copyright © 2017. All rights reserved.