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 java.lang.Object
      implements SimpleXMLDocHandler, PatternConsumer

  Parses the xml hyphenation pattern.
  Author:
    Paulo Soares (psoares@consiste.pt)

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `(package private) PatternConsumer` | `consumer`
    `(package private) int` | `currElement`
    `(package private) static int` | `ELEM_CLASSES`
    `(package private) static int` | `ELEM_EXCEPTIONS`
    `(package private) static int` | `ELEM_HYPHEN`
    `(package private) static int` | `ELEM_PATTERNS`
    `(package private) java.util.ArrayList` | `exception`
    `(package private) char` | `hyphenChar`
    `(package private) SimpleXMLParser` | `parser`
    `(package private) java.lang.StringBuffer` | `token`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SimplePatternParser()` Creates a new instance of PatternParser2

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addClass(java.lang.String c)` Add a character class.
    `void` | `addException(java.lang.String w, java.util.ArrayList e)` Add a hyphenation exception.
    `void` | `addPattern(java.lang.String p, java.lang.String v)` Add hyphenation patterns.
    `void` | `endDocument()` Called after the document is parsed.
    `void` | `endElement(java.lang.String tag)` Called when an end tag is found.
    `protected java.lang.String` | `getExceptionWord(java.util.ArrayList ex)`
    `protected static java.lang.String` | `getInterletterValues(java.lang.String pat)`
    `protected static java.lang.String` | `getPattern(java.lang.String word)`
    `static void` | `main(java.lang.String[] args)`
    `protected java.util.ArrayList` | `normalizeException(java.util.ArrayList ex)`
    `void` | `parse(java.io.InputStream stream, PatternConsumer consumer)`
    `void` | `startDocument()` Called when the document starts to be parsed.
    `void` | `startElement(java.lang.String tag, java.util.HashMap h)` Called when a start tag is found.
    `void` | `text(java.lang.String str)` Called when a text element is found.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### currElement

          int currElement

    - #### consumer

          PatternConsumer consumer

    - #### token

          java.lang.StringBuffer token

    - #### exception

          java.util.ArrayList exception

    - #### hyphenChar

          char hyphenChar

    - #### parser

          SimpleXMLParser parser

    - #### ELEM_CLASSES

          static final int ELEM_CLASSES

      See Also:
        Constant Field Values

    - #### ELEM_EXCEPTIONS

          static final int ELEM_EXCEPTIONS

      See Also:
        Constant Field Values

    - #### ELEM_PATTERNS

          static final int ELEM_PATTERNS

      See Also:
        Constant Field Values

    - #### ELEM_HYPHEN

          static final int ELEM_HYPHEN

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### SimplePatternParser

          public SimplePatternParser()

      Creates a new instance of PatternParser2

  - ### Method Detail

    - #### parse

          public void parse(java.io.InputStream stream,
                   PatternConsumer consumer)

    - #### getPattern

          protected static java.lang.String getPattern(java.lang.String word)

    - #### normalizeException

          protected java.util.ArrayList normalizeException(java.util.ArrayList ex)

    - #### getExceptionWord

          protected java.lang.String getExceptionWord(java.util.ArrayList ex)

    - #### getInterletterValues

          protected static java.lang.String getInterletterValues(java.lang.String pat)

    - #### endDocument

          public void endDocument()

      Description copied from interface: `SimpleXMLDocHandler`
      Called after the document is parsed.
      Specified by:
        `endDocument` in interface `SimpleXMLDocHandler`

    - #### endElement

          public void endElement(java.lang.String tag)

      Description copied from interface: `SimpleXMLDocHandler`
      Called when an end tag is found.
      Specified by:
        `endElement` in interface `SimpleXMLDocHandler`
      Parameters:
        `tag` - the tag name

    - #### startDocument

          public void startDocument()

      Description copied from interface: `SimpleXMLDocHandler`
      Called when the document starts to be parsed.
      Specified by:
        `startDocument` in interface `SimpleXMLDocHandler`

    - #### startElement

          public void startElement(java.lang.String tag,
                          java.util.HashMap h)

      Description copied from interface: `SimpleXMLDocHandler`
      Called when a start tag is found.
      Specified by:
        `startElement` in interface `SimpleXMLDocHandler`
      Parameters:
        `tag` - the tag name
        `h` - the tag's attributes

    - #### text

          public void text(java.lang.String str)

      Description copied from interface: `SimpleXMLDocHandler`
      Called when a text element is found.
      Specified by:
        `text` in interface `SimpleXMLDocHandler`
      Parameters:
        `str` - the text element, probably a fragment.

    - #### addClass

          public void addClass(java.lang.String c)

      Description copied from interface: `PatternConsumer`
      Add 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:
        `addClass` in interface `PatternConsumer`
      Parameters:
        `c` - character group

    - #### addException

          public void addException(java.lang.String w,
                          java.util.ArrayList e)

      Description copied from interface: `PatternConsumer`
      Add 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 and `Hyphen` instances
      Specified by:
        `addException` in interface `PatternConsumer`

    - #### addPattern

          public void addPattern(java.lang.String p,
                        java.lang.String v)

      Description copied from interface: `PatternConsumer`
      Add hyphenation patterns.
      Specified by:
        `addPattern` in interface `PatternConsumer`
      Parameters:
        `p` - the pattern
        `v` - interletter values expressed as a string of digit characters.

    - #### main

          public static void main(java.lang.String[] args)
                           throws java.lang.Exception

      Throws:
        `java.lang.Exception`