Package com.lowagie.text.pdf.hyphenation
Class SimplePatternParser
- java.lang.Object
-
- com.lowagie.text.pdf.hyphenation.SimplePatternParser
-
- All Implemented Interfaces:
PatternConsumer,SimpleXMLDocHandler
public class SimplePatternParser extends Object implements SimpleXMLDocHandler, PatternConsumer
Parses the xml hyphenation pattern.- Author:
- Paulo Soares (psoares@consiste.pt)
-
-
Constructor Summary
Constructors Constructor Description SimplePatternParser()Creates a new instance of PatternParser2
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddClass(String c)Add a character class.voidaddException(String w, ArrayList e)Add a hyphenation exception.voidaddPattern(String p, String v)Add hyphenation patterns.voidendDocument()Called after the document is parsed.voidendElement(String tag)Called when an end tag is found.protected StringgetExceptionWord(List<Object> ex)protected static StringgetInterletterValues(String pat)protected static StringgetPattern(String word)static voidmain(String[] args)protected List<Object>normalizeException(List<Object> ex)voidparse(InputStream stream, PatternConsumer consumer)voidstartDocument()Called when the document starts to be parsed.voidstartElement(String tag, HashMap h)Deprecated.voidstartElement(String tag, Map<String,String> h)Called when a start tag is found.voidtext(String str)Called when a text element is found.
-
-
-
Method Detail
-
parse
public void parse(InputStream stream, PatternConsumer consumer)
-
endDocument
public void endDocument()
Description copied from interface:SimpleXMLDocHandlerCalled after the document is parsed.- Specified by:
endDocumentin interfaceSimpleXMLDocHandler
-
endElement
public void endElement(String tag)
Description copied from interface:SimpleXMLDocHandlerCalled when an end tag is found.- Specified by:
endElementin interfaceSimpleXMLDocHandler- Parameters:
tag- the tag name
-
startDocument
public void startDocument()
Description copied from interface:SimpleXMLDocHandlerCalled when the document starts to be parsed.- Specified by:
startDocumentin interfaceSimpleXMLDocHandler
-
startElement
@Deprecated public void startElement(String tag, HashMap h)
Deprecated.Description copied from interface:SimpleXMLDocHandlerCalled when a start tag is found.- Specified by:
startElementin interfaceSimpleXMLDocHandler- Parameters:
tag- the tag nameh- the tag's attributes
-
startElement
public void startElement(String tag, Map<String,String> h)
Description copied from interface:SimpleXMLDocHandlerCalled when a start tag is found.- Specified by:
startElementin interfaceSimpleXMLDocHandler- Parameters:
tag- the tag nameh- the tag's attributes
-
text
public void text(String str)
Description copied from interface:SimpleXMLDocHandlerCalled when a text element is found.- Specified by:
textin interfaceSimpleXMLDocHandler- Parameters:
str- the text element, probably a fragment.
-
addClass
public void addClass(String c)
Description copied from interface:PatternConsumerAdd a character class. A character class defines characters that are considered equivalent for the purpose of hyphenation (e.g. "aA"). It usually means to ignore case.- Specified by:
addClassin interfacePatternConsumer- Parameters:
c- character group
-
addException
public void addException(String w, ArrayList e)
Description copied from interface:PatternConsumerAdd a hyphenation exception. An exception replaces the result obtained by the algorithm for cases for which this fails or the user wants to provide his own hyphenation. A hyphenatedword is a vector of alternating String's andHypheninstances- Specified by:
addExceptionin interfacePatternConsumer- Parameters:
w- The word to changee- A vector of alternating String's andHypheninstances
-
addPattern
public void addPattern(String p, String v)
Description copied from interface:PatternConsumerAdd hyphenation patterns.- Specified by:
addPatternin interfacePatternConsumer- Parameters:
p- the patternv- interletter values expressed as a string of digit characters.
-
main
public static void main(String[] args)
-
-