Generated by
JDiff

com.itextpdf.layout.hyphenation Documentation Differences

This file contains all the changes in documentation in the package com.itextpdf.layout.hyphenation as colored differences. Deletions are shown like this , and additions are shown like this.
If no deletions or additions are shown in an entry, the HTML tags will be what has changed. The new HTML tags are shown in the differences. If no documentation existed, and then some was added in a later version, this change is noted in the appropriate class pages of differences, but the change is not shown on this page. Only changes in existing text are shown here. Similarly, documentation which was inherited from another class or interface is not shown here.
Note that an HTML error in the new documentation may cause the display of other documentation changes to be presented incorrectly. For instance, failure to close a tag will cause all subsequent paragraphs to be displayed differently.

Class ByteVector

This class implements a simple byte vector with access to the underlying array.

This work was authored by Carlos Villegas (cav@uniscope.co.jp).


Class CharVector

This class implements a simple char vector with access to the underlying array.

This work was authored by Carlos Villegas (cav@uniscope.co.jp).


Class Hyphenation

This class represents a hyphenated word.

This work was authored by Carlos Villegas (cav@uniscope.co.jp).


Class HyphenationException

A hyphenation exception.

This work was authored by Carlos Villegas (cav@uniscope.co.jp).


Class HyphenationTree

This tree structure stores the hyphenation patterns in an efficient way for fast lookup. It provides the provides the method to hyphenate a word.

This work was authored by Carlos Villegas (cav@uniscope.co.jp).

Class HyphenationTree, void searchPatterns(char[], int, byte[])

Search for all possible partial matches of word starting at index an update interletter values. In other words, it does something like:

for(i=0; i

But it is done in an efficient way since the patterns are stored in a ternary tree. In fact, this is the whole purpose of having the tree: doing this search without having to test every single pattern. The number of patterns for languages such as English range from 4000 to 10000. Thus, doing thousands of string comparisons for each word to hyphenate would be really slow without the tree. The tradeoff is memory, but using a ternary tree instead of a trie, almost halves the the memory used by Lout or TeX. It's also faster than using a hash table table @param word null terminated word to match @param index start index from word @param il interletter values array to update


Class HyphenationTreeCache

This is a cache for HyphenationTree instances.

Class Hyphenator

This class is the main entry point to the hyphenation package. You can use only the static methods or create an instance.

This work was authored by Carlos Villegas (cav@uniscope.co.jp).


Class IPatternConsumer

This interface is used to connect the XML pattern file parser to the hyphenation tree.

This work was authored by Carlos Villegas (cav@uniscope.co.jp).


Class PatternParser

A SAX document handler to read and parse hyphenation patterns from a XML file.

This work was authored by Carlos Villegas (cav@uniscope.co.jp).


Class TernaryTree

Ternary Search Tree.

A ternary search tree is a hibrid hybrid between a binary tree and a digital search tree (trie). Keys are limited to strings. A data value of type char is stored in each leaf node. It can be used as an index (or pointer) to the data. Branches that only contain one key are compressed to one node by storing a pointer to the trailer substring of the key. This class is intended to serve as base class or helper class to implement Dictionary collections or the like. Ternary trees have some nice properties as the following: the tree can be traversed in sorted order, partial matches (wildcard) can be implemented, retrieval of all keys within a given distance from the target, etc. The storage requirements are higher than a binary tree but a lot less than a trie. Performance is comparable with a hash table, sometimes it outperforms a hash function (most of the time can determine a miss faster than a hash).

The main purpose of this java port is to serve as a base for implementing TeX's hyphenation algorithm (see The TeXBook, appendix H). Each language requires from 5000 to 15000 hyphenation patterns which will be keys in this tree. The strings patterns are usually small (from 2 to 5 characters), but each char in the tree is stored in a node. Thus memory usage is the main concern. We will sacrify 'elegance' to keep memory requirements to the minimum. Using java's char type as pointer (yes, I know pointer it is a forbidden word in java) we can keep the size of the node to be just 8 bytes (3 pointers and the data char). This gives room for about 65000 nodes. In my tests the english patterns took 7694 nodes and the german patterns 10055 nodes, so I think we are safe.

All said, this is a map with strings as keys and char as value. Pretty limited!. It can be extended to a general map by using the string representation of an object and using the char value as an index to an array that contains the object values.

This work was authored by Carlos Villegas (cav@uniscope.co.jp).

Class TernaryTree, char[] sc

The character stored in this node: splitchar. Two special values are reserved:
  • 0x0000 as string terminator terminator
  • 0xFFFF to indicate that the branch starting at this node is compressed compressed
This shouldn't be a problem if we give the usual semantics to strings since 0xFFFF is garanteed not to be an Unicode character.