Source Code Cross Referenced for TKLaTeXConverter.java in  » Content-Management-System » webman » com » teamkonzept » lib » 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 » Content Management System » webman » com.teamkonzept.lib 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.teamkonzept.lib;
002:
003:        /**
004:         * Konvertierungsklasse fuer LaTeX-Codierung
005:         * @author  $Author: alex $
006:         * @version $Revision: 1.1 $
007:         */
008:        public class TKLaTeXConverter extends TKConverter {
009:
010:            public final static String CONV_ID = "LT";
011:            public final static String CONV_NAME = "LATEX";
012:            private final static int MAX_BYTES_CHAR = 21;
013:
014:            public String getName() {
015:                return CONV_NAME;
016:            }
017:
018:            public int getMaxBytesPerChar() {
019:                return MAX_BYTES_CHAR;
020:            }
021:
022:            public int minCharSize(int byteCount) {
023:                return byteCount;
024:            }
025:
026:            public final static String[] LATEX_TRANSLATION = {
027:
028:            // Quote special chars ///////////////////////////////////////////////////////////
029:
030:                    /*    0         */"?"
031:                    /*    1         */, "?"
032:                    /*    2         */, "?"
033:                    /*    3         */, "?"
034:                    /*    4         */, "?"
035:                    /*    5         */, "?"
036:                    /*    6         */, "?"
037:                    /*    7         */, "?"
038:                    /*    8         */, "?"
039:                    /*    9         */, (char) (9) + "" // Tabulator
040:                            /*   10         */, (char) (10) + "" // Line feed
041:                            /*   11         */, "?"
042:                    /*   12         */, "?"
043:                    /*   13         */, (char) (13) + "" // Carriage return
044:                            /*   14         */, "?"
045:                    /*   15         */, "?"
046:                    /*   16         */, "?"
047:                    /*   17         */, "?"
048:                    /*   18         */, "?"
049:                    /*   19         */, "?"
050:                    /*   20         */, "?"
051:                    /*   21         */, "?"
052:                    /*   22         */, "?"
053:                    /*   23         */, "?"
054:                    /*   24         */, "?"
055:                    /*   25         */, "?"
056:                    /*   26         */, "?"
057:                    /*   27         */, "?"
058:                    /*   28         */, "?"
059:                    /*   29         */, "?"
060:                    /*   30         */, "?"
061:                    /*   31         */, "?"
062:                    /*   32         */, " "
063:                    /*   33    !    */, "!"
064:                    /*   34    "    */, "{}\"{}" //  Quotation mark'
065:                    /*   35    #    */, "\\#{}" //  Number sign'
066:                    /*   36    $    */, "\\${}" //  Dollar sign'
067:                    /*   37    %    */, "\\%{}" //  Percent sign'
068:                    /*   38    &    */, "\\&{}" //  Ampersand'
069:                    /*   39    '    */, "{}'{}" //  Apostrophe'
070:                    /*   40    (    */, "("
071:                    /*   41    )    */, ")"
072:                    /*   42    *    */, "{}*{}" //  Star'
073:                    /*   43    +    */, "+"
074:                    /*   44    ,    */, "{},{}" //  ,'
075:                    /*   45    -    */, "{}-{}" //  Hyphen'
076:                    /*   46    .    */, "."
077:                    /*   47    /    */, "/"
078:                    /*   48    0    */, "0"
079:                    /*   49    1    */, "1"
080:                    /*   50    2    */, "2"
081:                    /*   51    3    */, "3"
082:                    /*   52    4    */, "4"
083:                    /*   53    5    */, "5"
084:                    /*   54    6    */, "6"
085:                    /*   55    7    */, "7"
086:                    /*   56    8    */, "8"
087:                    /*   57    9    */, "9"
088:                    /*   58    :    */, ":"
089:                    /*   59    ;    */, ";"
090:                    /*   60    <    */, "{\\tt{}<}" //  <'
091:                    /*   61    =    */, "{}={}" //  ='
092:                    /*   62    >    */, "{\\tt{}>}" //  >'
093:                    /*   63    ?    */, "?"
094:                    /*   64    @    */, "{}@{}" //  Commercial at'
095:                    /*   65    A    */, "A"
096:                    /*   66    B    */, "B"
097:                    /*   67    C    */, "C"
098:                    /*   68    D    */, "D"
099:                    /*   69    E    */, "E"
100:                    /*   70    F    */, "F"
101:                    /*   71    G    */, "G"
102:                    /*   72    H    */, "H"
103:                    /*   73    I    */, "I"
104:                    /*   74    J    */, "J"
105:                    /*   75    K    */, "K"
106:                    /*   76    L    */, "L"
107:                    /*   77    M    */, "M"
108:                    /*   78    N    */, "N"
109:                    /*   79    O    */, "O"
110:                    /*   80    P    */, "P"
111:                    /*   81    Q    */, "Q"
112:                    /*   82    R    */, "R"
113:                    /*   83    S    */, "S"
114:                    /*   84    T    */, "T"
115:                    /*   85    U    */, "U"
116:                    /*   86    V    */, "V"
117:                    /*   87    W    */, "W"
118:                    /*   88    X    */, "X"
119:                    /*   89    Y    */, "Y"
120:                    /*   90    Z    */, "Z"
121:                    /*   91    [    */, "{}[{}" //  Left square bracket'
122:                    /*   92    \    */, "\\textbackslash{}" //  Reverse solidus (backslash)'
123:                    /*   93    ]    */, "{}]{}" //  Right square bracket'
124:                    /*   94    ^    */, "\\textasciicircum{}" //  Caret, Circum'
125:                    /*   95    _    */, "\\_{}" //  Horizontal bar (underscore)'
126:                    /*   96    `    */, "\\`{}" //  Backquote (= Grave accent)'
127:                    /*   97    a    */, "a"
128:                    /*   98    b    */, "b"
129:                    /*   99    c    */, "c"
130:                    /*  100    d    */, "d"
131:                    /*  101    e    */, "e"
132:                    /*  102    f    */, "f"
133:                    /*  103    g    */, "g"
134:                    /*  104    h    */, "h"
135:                    /*  105    i    */, "i"
136:                    /*  106    j    */, "j"
137:                    /*  107    k    */, "k"
138:                    /*  108    l    */, "l"
139:                    /*  109    m    */, "m"
140:                    /*  110    n    */, "n"
141:                    /*  111    o    */, "o"
142:                    /*  112    p    */, "p"
143:                    /*  113    q    */, "q"
144:                    /*  114    r    */, "r"
145:                    /*  115    s    */, "s"
146:                    /*  116    t    */, "t"
147:                    /*  117    u    */, "u"
148:                    /*  118    v    */, "v"
149:                    /*  119    w    */, "w"
150:                    /*  120    x    */, "x"
151:                    /*  121    y    */, "y"
152:                    /*  122    z    */, "z"
153:                    /*  123    {    */, "\\{" //  Left curly brace'
154:                    /*  124    |    */, "|"
155:                    /*  125    }    */, "\\}" //  Right curly brace'
156:                    /*  126    ~    */, "\\textasciitilde{}" //  Tilde'
157:                    /*  127         */, "?" //  <del>                       
158:
159:                    // non iso 8859-1 : cp1252 aka winansi (ansinew input encoding) ///////////////
160:
161:                    /*  128         */, "?" //  Euro sign
162:                    /*  129         */, "?" //
163:                    /*  130         */, "\\textquotesinglbase{}" //  Beg.half.germ.cit.'
164:                    /*  131         */, (char) (131) + "" //  Florin
165:                            /*  132         */, "\\textquotedblbase{}" //  Beg.germ.cit.'
166:                    /*  133         */, (char) (133) + "" //  Ellipsis
167:                            /*  134         */, (char) (134) + "" //  Dag
168:                            /*  135         */, (char) (135) + "" //  Double dag
169:                            /*  136         */, (char) (136) + "" //  Caret accent
170:                            /*  137         */, (char) (137) + "" //  Promille
171:                            /*  138         */, (char) (138) + "" //  Capital S, hachek accent
172:                            /*  139         */, (char) (139) + "" //  Beg.half.french.cit
173:                            /*  140         */, (char) (140) + "" //  Capital OE ligature
174:                            /*  141         */, "?" //
175:                    /*  142         */, "\\v{Z}" //  Capital Z, hachek accent
176:                    /*  143         */, "?" //
177:                    /*  144         */, "?" //
178:                    /*  145         */, (char) (145) + "" //  Beg.half.engl/End.half.germ.cit.
179:                            /*  146         */, (char) (146) + "" //  End.half.engl.cit.
180:                            /*  147         */, (char) (147) + "" //  Beg.engl.cit., End.germ.cit.
181:                            /*  148         */, (char) (148) + "" //  End.engl.cit.
182:                            /*  149         */, (char) (149) + "" //  Bullet
183:                            /*  150         */, (char) (150) + "" //  (endash,Bindestrich)
184:                            /*  151         */, (char) (151) + "" //  (emdash,Gedankenstrich)
185:                            /*  152         */, (char) (152) + "" //  Tilde accent
186:                            /*  153         */, (char) (153) + "" //  Trademark
187:                            /*  154         */, (char) (154) + "" //  Small s, hachek accent
188:                            /*  155         */, (char) (155) + "" //  End.half.french.cit
189:                            /*  156         */, (char) (156) + "" //  Small oe ligature
190:                            /*  157         */, "?" //
191:                    /*  158         */, "\\v{z}" //  Small z, hachek accent
192:                    /*  159         */, (char) (159) + "" //  Capital Y, dieresis or umlaut mark
193:
194:                            // end of non iso 8859-1 //////////////////////////////////////////////////////
195:
196:                    /*  160        */, "" //  non-breaking space / soft hyphen
197:                    /*  161    ¡    */, "¡" //  Inverted exclamation
198:                    /*  162    ¢    */, "¢" //  Cent sign
199:                    /*  163    £    */, "£" //  Pound sterling
200:                    /*  164    ¤    */, "¤" //  General currency sign
201:                    /*  165    ¥    */, "¥" //  Yen sign
202:                    /*  166    ¦    */, "¦" //  Broken vertical bar
203:                    /*  167    §    */, "\\textsection{}" //  Section sign
204:                    /*  168    ¨    */, "¨" //  Umlaut (dieresis)
205:                    /*  169    ©    */, "©" //  Copyright
206:                    /*  170    ª    */, "ª" //  Feminine ordinal
207:                    /*  171    «    */, "«" //  Guillemotleft
208:                    /*  172    ¬    */, "\\textlogicalnot{}" //
209:                    /*  173    ­    */, "­"
210:                    /*  174    ®    */, "®" //  Registered trademark
211:                    /*  175    ¯    */, "¯" //  Macron accent
212:                    /*  176    °    */, "°" //  Degree sign
213:                    /*  177    ±    */, "\\textplusminus{}" //
214:                    /*  178    ²    */, "\\textsupertwo{}" //
215:                    /*  179    ³    */, "\\textsuperthree{}" //
216:                    /*  180    ´    */, "´" //  Quote (= Acute accent)
217:                    /*  181    µ    */, "\\textmu{}" //
218:                    /*  182    ¶    */, "¶" //  Paragraph sign
219:                    /*  183    ·    */, "·" //  Middle dot
220:                    /*  184    ¸    */, "¸" //  Cedilla
221:                    /*  185    ¹    */, "\\textsuperone{}" //
222:                    /*  186    º    */, "º"
223:                    /*  187    »    */, "»"
224:                    /*  188    ¼    */, "¼"
225:                    /*  189    ½    */, "½"
226:                    /*  190    ¾    */, "¾"
227:                    /*  191    ¿    */, "¿" //  Inverted question mark
228:                    /*  192    À    */, "À" //  Capital A, grave accent
229:                    /*  193    Á    */, "Á" //  Capital A, acute accent
230:                    /*  194    Â    */, "Â" //  Capital A, circumflex accent
231:                    /*  195    Ã    */, "Ã" //  Capital A, tilde
232:                    /*  196    Ä    */, "Ä" //  Capital A, dieresis or umlaut mark
233:                    /*  197    Å    */, "Å" //  Capital A, ring
234:                    /*  198    Æ    */, "Æ"
235:                    /*  199    Ç    */, "Ç" //  Capital C, cedilla
236:                    /*  200    È    */, "È" //  Capital E, grave accent
237:                    /*  201    É    */, "É" //  Capital E, acute accent
238:                    /*  202    Ê    */, "Ê" //  Capital E, circumflex accent
239:                    /*  203    Ë    */, "Ë" //  Capital E, dieresis or umlaut mark
240:                    /*  204    Ì    */, "Ì" //  Capital I, grave accent
241:                    /*  205    Í    */, "Í" //  Capital I, acute accent
242:                    /*  206    Î    */, "Î" //  Capital I, circumflex accent
243:                    /*  207    Ï    */, "Ï" //  Capital I, dieresis or umlaut mark
244:                    /*  208    Ð    */, "Ð"
245:                    /*  209    Ñ    */, "Ñ"
246:                    /*  210    Ò    */, "Ò"
247:                    /*  211    Ó    */, "Ó"
248:                    /*  212    Ô    */, "Ô"
249:                    /*  213    Õ    */, "Õ"
250:                    /*  214    Ö    */, "Ö"
251:                    /*  215    ×    */, "\\textmultiply{}" //
252:                    /*  216    Ø    */, "Ø"
253:                    /*  217    Ù    */, "Ù" //  Capital U, grave accent
254:                    /*  218    Ú    */, "Ú" //  Capital U, acute accent
255:                    /*  219    Û    */, "Û" //  Capital U, circumflex accent
256:                    /*  220    Ü    */, "Ü" //  Capital U, dieresis or umlaut mark
257:                    /*  221    Ý    */, "Ý" //  Capital Y, acute accent
258:                    /*  222    Þ    */, "Þ" //  Capital islandic thorn
259:                    /*  223    ß    */, "ß" //  Small sharp s, German (sz ligature)
260:                    /*  224    à    */, "à" //  Small a, grave accent
261:                    /*  225    á    */, "á" //  Small a, acute accent
262:                    /*  226    â    */, "â" //  Small a, circumflex accent
263:                    /*  227    ã    */, "ã" //  Small a, tilde
264:                    /*  228    ä    */, "ä" //  Small a, dieresis or umlaut mark
265:                    /*  229    å    */, "å" //  Small a, ring
266:                    /*  230    æ    */, "æ"
267:                    /*  231    ç    */, "ç" //  Small c, cedilla
268:                    /*  232    è    */, "è" //  Small e, grave accent
269:                    /*  233    é    */, "é" //  Small e, acute accent
270:                    /*  234    ê    */, "ê" //  Small e, circumflex accent
271:                    /*  235    ë    */, "ë" //  Small e, dieresis or umlaut mark
272:                    /*  236    ì    */, "ì" //  Small i, grave accent
273:                    /*  237    í    */, "í" //  Small i, acute accent
274:                    /*  238    î    */, "î" //  Small i, circumflex accent
275:                    /*  239    ï    */, "ï" //  Small i, dieresis or umlaut mark
276:                    /*  240    ð    */, "ð"
277:                    /*  241    ñ    */, "ñ" //  Small n, tilde
278:                    /*  242    ò    */, "ò" //  Small o, grave accent
279:                    /*  243    ó    */, "ó" //  Small o, acute accent
280:                    /*  244    ô    */, "ô" //  Small o, circumflex accent
281:                    /*  245    õ    */, "õ" //  Small o, tilde
282:                    /*  246    ö    */, "ö" //  Small o, dieresis or umlaut mark
283:                    /*  247    ÷    */, "\\textdivide{}" //
284:                    /*  248    ø    */, "ø"
285:                    /*  249    ù    */, "ù" //  Small u, grave accent
286:                    /*  250    ú    */, "ú" //  Small u, acute accent
287:                    /*  251    û    */, "û" //  Small u, circumflex accent
288:                    /*  252    ü    */, "ü" //  Small u, dieresis or umlaut mark
289:                    /*  253    ý    */, "ý" //  Small y, acute accent
290:                    /*  254    þ    */, "þ" //  Small islandic thorn
291:                    /*  255    ÿ    */, "ÿ" //  Small y, dieresis or umlaut mark
292:            };
293:
294:            public int charsToBytes(char src[], byte dst[], int srcBegin,
295:                    int length, int dstBegin) {
296:                String back = encodeLaTeX(src, srcBegin, length);
297:                back.getBytes(0, back.length(), dst, dstBegin);
298:                return back.length();
299:            }
300:
301:            public int bytesToChars(byte src[], char dst[], int srcBegin,
302:                    int length, int dstBegin) {
303:                String srcIn = new String(src);
304:                String back = encodeLaTeX(srcIn.toCharArray(), srcBegin, length);
305:                back.getChars(0, back.length(), dst, dstBegin);
306:                return back.length();
307:            }
308:
309:            public static String encodeLaTeX(char[] in, int start, int length) {
310:                if (in == null)
311:                    return null;
312:
313:                StringBuffer buf = new StringBuffer();
314:                int trLimit = LATEX_TRANSLATION.length;
315:                int end = start + length;
316:
317:                for (int i = start; i < end; i++) {
318:                    if (in[i] < trLimit)
319:                        buf.append(LATEX_TRANSLATION[in[i]]);
320:                    else
321:                        buf.append('?');
322:                }
323:
324:                return buf.toString();
325:            }
326:
327:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.