Java Doc for HyphenationTree.java in  » PDF » pdf-itext » com » lowagie » text » pdf » hyphenation » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » PDF » pdf itext » com.lowagie.text.pdf.hyphenation 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.lowagie.text.pdf.hyphenation.TernaryTree
      com.lowagie.text.pdf.hyphenation.HyphenationTree

HyphenationTree
public class HyphenationTree extends TernaryTree implements PatternConsumer(Code)
This tree structure stores the hyphenation patterns in an efficient way for fast lookup. It provides the provides the method to hyphenate a word.
author:
   Carlos Villegas


Field Summary
protected  TernaryTreeclassmap
    
protected  HashMapstoplist
    
protected  ByteVectorvspace
    

Constructor Summary
public  HyphenationTree()
    

Method Summary
public  voidaddClass(String chargroup)
     Add a character class to the tree.
public  voidaddException(String word, ArrayList hyphenatedword)
     Add an exception to the tree.
public  voidaddPattern(String pattern, String ivalue)
     Add a pattern to the tree.
public  StringfindPattern(String pat)
    
protected  byte[]getValues(int k)
    
protected  inthstrcmp(char[] s, int si, char[] t, int ti)
    
public  Hyphenationhyphenate(String word, int remainCharCount, int pushCharCount)
     Hyphenate word and return a Hyphenation object.
Parameters:
  word - the word to be hyphenated
Parameters:
  remainCharCount - Minimum number of characters allowedbefore the hyphenation point.
Parameters:
  pushCharCount - Minimum number of characters allowed afterthe hyphenation point.
public  Hyphenationhyphenate(char[] w, int offset, int len, int remainCharCount, int pushCharCount)
     Hyphenate word and return an array of hyphenation points.
Parameters:
  w - char array that contains the word
Parameters:
  offset - Offset to first character in word
Parameters:
  len - Length of word
Parameters:
  remainCharCount - Minimum number of characters allowedbefore the hyphenation point.
Parameters:
  pushCharCount - Minimum number of characters allowed afterthe hyphenation point.
public  voidloadSimplePatterns(InputStream stream)
    
protected  intpackValues(String values)
     Packs the values by storing them in 4 bits, two values into a byte Values range is from 0 to 9.
public  voidprintStats()
    
protected  voidsearchPatterns(char[] word, int index, byte[] il)
    

Search for all possible partial matches of word starting at index an update interletter values.

protected  StringunpackValues(int k)
    

Field Detail
classmap
protected TernaryTree classmap(Code)
This map stores the character classes



stoplist
protected HashMap stoplist(Code)
This map stores hyphenation exceptions



vspace
protected ByteVector vspace(Code)
value space: stores the inteletter values




Constructor Detail
HyphenationTree
public HyphenationTree()(Code)




Method Detail
addClass
public void addClass(String chargroup)(Code)
Add a character class to the tree. It is used by SimplePatternParser SimplePatternParser as callback to add character classes. Character classes define the valid word characters for hyphenation. If a word contains a character not defined in any of the classes, it is not hyphenated. It also defines a way to normalize the characters in order to compare them with the stored patterns. Usually pattern files use only lower case characters, in this case a class for letter 'a', for example, should be defined as "aA", the first character being the normalization char.



addException
public void addException(String word, ArrayList hyphenatedword)(Code)
Add an exception to the tree. It is used by SimplePatternParser SimplePatternParser class as callback to store the hyphenation exceptions.
Parameters:
  word - normalized word
Parameters:
  hyphenatedword - a vector of alternating strings andHyphen hyphen objects.



addPattern
public void addPattern(String pattern, String ivalue)(Code)
Add a pattern to the tree. Mainly, to be used by SimplePatternParser SimplePatternParser class as callback to add a pattern to the tree.
Parameters:
  pattern - the hyphenation pattern
Parameters:
  ivalue - interletter weight values indicating thedesirability and priority of hyphenating at a given pointwithin the pattern. It should contain only digit characters.(i.e. '0' to '9').



findPattern
public String findPattern(String pat)(Code)



getValues
protected byte[] getValues(int k)(Code)



hstrcmp
protected int hstrcmp(char[] s, int si, char[] t, int ti)(Code)
String compare, returns 0 if equal or t is a substring of s



hyphenate
public Hyphenation hyphenate(String word, int remainCharCount, int pushCharCount)(Code)
Hyphenate word and return a Hyphenation object.
Parameters:
  word - the word to be hyphenated
Parameters:
  remainCharCount - Minimum number of characters allowedbefore the hyphenation point.
Parameters:
  pushCharCount - Minimum number of characters allowed afterthe hyphenation point. a Hyphenation Hyphenation object representingthe hyphenated word or null if word is not hyphenated.



hyphenate
public Hyphenation hyphenate(char[] w, int offset, int len, int remainCharCount, int pushCharCount)(Code)
Hyphenate word and return an array of hyphenation points.
Parameters:
  w - char array that contains the word
Parameters:
  offset - Offset to first character in word
Parameters:
  len - Length of word
Parameters:
  remainCharCount - Minimum number of characters allowedbefore the hyphenation point.
Parameters:
  pushCharCount - Minimum number of characters allowed afterthe hyphenation point. a Hyphenation Hyphenation object representingthe hyphenated word or null if word is not hyphenated.



loadSimplePatterns
public void loadSimplePatterns(InputStream stream)(Code)



packValues
protected int packValues(String values)(Code)
Packs the values by storing them in 4 bits, two values into a byte Values range is from 0 to 9. We use zero as terminator, so we'll add 1 to the value.
Parameters:
  values - a string of digits from '0' to '9' representing theinterletter values. the index into the vspace array where the packed valuesare stored.



printStats
public void printStats()(Code)



searchPatterns
protected void searchPatterns(char[] word, int index, byte[] il)(Code)

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


Parameters:
  word - null terminated word to match
Parameters:
  index - start index from word
Parameters:
  il - interletter values array to update



unpackValues
protected String unpackValues(int k)(Code)



Fields inherited from com.lowagie.text.pdf.hyphenation.TernaryTree
final protected static int BLOCK_SIZE(Code)(Java Doc)
protected char[] eq(Code)(Java Doc)
protected char freenode(Code)(Java Doc)
protected char[] hi(Code)(Java Doc)
protected CharVector kv(Code)(Java Doc)
protected int length(Code)(Java Doc)
protected char[] lo(Code)(Java Doc)
protected char root(Code)(Java Doc)
protected char[] sc(Code)(Java Doc)

Methods inherited from com.lowagie.text.pdf.hyphenation.TernaryTree
public void balance()(Code)(Java Doc)
public Object clone()(Code)(Java Doc)
public int find(String key)(Code)(Java Doc)
public int find(char[] key, int start)(Code)(Java Doc)
protected void init()(Code)(Java Doc)
public void insert(String key, char val)(Code)(Java Doc)
public void insert(char[] key, int start, char val)(Code)(Java Doc)
protected void insertBalanced(String[] k, char[] v, int offset, int n)(Code)(Java Doc)
public Enumeration keys()(Code)(Java Doc)
public boolean knows(String key)(Code)(Java Doc)
public void printStats()(Code)(Java Doc)
public int size()(Code)(Java Doc)
public static int strcmp(char[] a, int startA, char[] b, int startB)(Code)(Java Doc)
public static int strcmp(String str, char[] a, int start)(Code)(Java Doc)
public static void strcpy(char[] dst, int di, char[] src, int si)(Code)(Java Doc)
public static int strlen(char[] a, int start)(Code)(Java Doc)
public static int strlen(char[] a)(Code)(Java Doc)
public void trimToSize()(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.