net.sf.mmm.util.text.base
Class HyphenationImpl

java.lang.Object
  extended by net.sf.mmm.util.text.base.HyphenationImpl
All Implemented Interfaces:
Hyphenation

public class HyphenationImpl
extends Object
implements Hyphenation

This is the implementation of the Hyphenation interface.

Since:
2.0.0
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)

Field Summary
private  char hyphen
           
private  int[] hyphenationPoints
           
private  String word
           
 
Constructor Summary
HyphenationImpl(String hyphenatedWord)
          The constructor.
HyphenationImpl(String hyphenatedWord, char hyphen)
          The constructor.
HyphenationImpl(String word, char hyphen, int[] hyphenationPoints)
          The constructor.
 
Method Summary
 char getHyphen()
          
 int getHyphenation(int hyphenationIndex)
          This method gets the index of the given hyphenation-point.
 int getHyphenationBefore(int offset)
          This method gets the greatest hyphenation position that is less to the given offset.
 int getHyphenationCount()
          This method gets the number of hyphenation-points in the word.
 int[] getHyphenationPoints()
           
 String getWord()
          This method gets the raw word to be hyphenated.
 String toString()
          The hyphenation of the according word (e.g. un-avail-able).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

word

private final String word
See Also:
getWord()

hyphenationPoints

private final int[] hyphenationPoints
See Also:
getHyphenation(int)

hyphen

private final char hyphen
See Also:
getHyphen()
Constructor Detail

HyphenationImpl

public HyphenationImpl(String word,
                       char hyphen,
                       int[] hyphenationPoints)
The constructor.

Parameters:
word - is the word.
hyphen - is the hyphen-character.
hyphenationPoints - are the actual hyphenation-points.

HyphenationImpl

public HyphenationImpl(String hyphenatedWord)
The constructor.

Parameters:
hyphenatedWord - is the hyphenated word.

HyphenationImpl

public HyphenationImpl(String hyphenatedWord,
                       char hyphen)
The constructor.

Parameters:
hyphenatedWord - is the hyphenated word.
hyphen - is the hyphen-character.
Method Detail

getHyphenationCount

public int getHyphenationCount()
This method gets the number of hyphenation-points in the word.

Specified by:
getHyphenationCount in interface Hyphenation
Returns:
the number of hyphenation-points (e.g. 0 for "I" or "egg" or 1 for "im-pact").

getHyphenation

public int getHyphenation(int hyphenationIndex)
This method gets the index of the given hyphenation-point.

Specified by:
getHyphenation in interface Hyphenation
Parameters:
hyphenationIndex - is the index of the hyphenation-point in the range from 0 to Hyphenation.getHyphenationCount() - 1.
Returns:
the index of the position in the word.

getHyphenationBefore

public int getHyphenationBefore(int offset)
This method gets the greatest hyphenation position that is less to the given offset.

Specified by:
getHyphenationBefore in interface Hyphenation
Parameters:
offset - is the offset in the word where a hyphenation is desired.
Returns:
the hyphenation position just before the given offset or -1 if there is no such position.

getHyphenationPoints

public int[] getHyphenationPoints()
Returns:
the hyphenationPoints

getWord

public String getWord()
This method gets the raw word to be hyphenated.

Specified by:
getWord in interface Hyphenation
Returns:
the word without added hyphens.

getHyphen

public char getHyphen()

Specified by:
getHyphen in interface Hyphenation
Returns:
the hyphen character.
See Also:
Hyphenator.getHyphen()

toString

public String toString()
The hyphenation of the according word (e.g. un-avail-able).

Specified by:
toString in interface Hyphenation
Overrides:
toString in class Object


Copyright © 2001-2010 mmm-Team. All Rights Reserved.