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, warning
public PatternParser() throws HyphenationException
HyphenationException
public PatternParser(PatternConsumer consumer) throws HyphenationException
HyphenationException
public 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 EntityResolver
resolveEntity
in class DefaultHandler
public void startElement(String uri, String local, String raw, Attributes attrs)
startElement
in interface ContentHandler
startElement
in class DefaultHandler
ContentHandler.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 ContentHandler
endElement
in class DefaultHandler
ContentHandler.endElement(java.lang.String,
java.lang.String, java.lang.String)
public void characters(char[] ch, int start, int length)
characters
in interface ContentHandler
characters
in class DefaultHandler
ContentHandler.characters(char[], int, int)
public void addClass(String c)
PatternConsumer
addClass
in interface PatternConsumer
c
- character grouppublic void addException(String w, ArrayList<Object> e)
PatternConsumer
Hyphen
instancesaddException
in interface PatternConsumer
public void addPattern(String p, String v)
PatternConsumer
addPattern
in interface PatternConsumer
p
- the patternv
- interletter values expressed as a string of digit characters.