public class PatternParser extends DefaultHandler implements PatternConsumer
| Constructor and Description |
|---|
PatternParser() |
PatternParser(PatternConsumer consumer) |
| Modifier and Type | Method and Description |
|---|---|
void |
addClass(String c)
Add a character class.
|
void |
addException(String w,
ArrayList<Object> e)
Add a hyphenation exception.
|
void |
addPattern(String p,
String v)
Add hyphenation patterns.
|
void |
characters(char[] ch,
int start,
int length) |
void |
endElement(String uri,
String local,
String raw) |
protected String |
getExceptionWord(ArrayList<?> ex) |
protected static String |
getInterletterValues(String pat) |
protected static String |
getPattern(String word) |
static void |
main(String[] args) |
protected ArrayList<Object> |
normalizeException(ArrayList<?> ex) |
void |
parse(File file)
Parses a hyphenation pattern file.
|
void |
parse(InputSource source)
Parses a hyphenation pattern file.
|
void |
parse(String filename)
Parses a hyphenation pattern file.
|
protected String |
readToken(StringBuffer chars) |
InputSource |
resolveEntity(String publicId,
String systemId) |
void |
setConsumer(PatternConsumer consumer) |
void |
startElement(String uri,
String local,
String raw,
Attributes attrs) |
endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warningpublic PatternParser()
throws HyphenationException
HyphenationExceptionpublic PatternParser(PatternConsumer consumer) throws HyphenationException
HyphenationExceptionpublic void setConsumer(PatternConsumer consumer)
public void parse(String filename) throws HyphenationException
filename - the filenameHyphenationException - In case of an exception while parsingpublic void parse(File file) throws HyphenationException
file - the pattern fileHyphenationException - In case of an exception while parsingpublic void parse(InputSource source) throws HyphenationException
source - the InputSource for the fileHyphenationException - In case of an exception while parsingprotected String readToken(StringBuffer chars)
public InputSource resolveEntity(String publicId, String systemId)
resolveEntity in interface EntityResolverresolveEntity in class DefaultHandlerpublic void startElement(String uri, String local, String raw, Attributes attrs)
startElement in interface ContentHandlerstartElement in class DefaultHandlerContentHandler.startElement(java.lang.String,
java.lang.String, java.lang.String, org.xml.sax.Attributes)public void endElement(String uri, String local, String raw)
endElement in interface ContentHandlerendElement in class DefaultHandlerContentHandler.endElement(java.lang.String,
java.lang.String, java.lang.String)public void characters(char[] ch,
int start,
int length)
characters in interface ContentHandlercharacters in class DefaultHandlerContentHandler.characters(char[], int, int)public void addClass(String c)
PatternConsumeraddClass in interface PatternConsumerc - character grouppublic void addException(String w, ArrayList<Object> e)
PatternConsumerHyphen instancesaddException in interface PatternConsumerpublic void addPattern(String p, String v)
PatternConsumeraddPattern in interface PatternConsumerp - the patternv - interletter values expressed as a string of digit characters.