Source Code Cross Referenced for TransformTransliterator.java in  » Internationalization-Localization » icu4j » com » ibm » icu » text » 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 » Internationalization Localization » icu4j » com.ibm.icu.text 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (C) 1996-2004, International Business Machines Corporation and
003:         * others. All Rights Reserved.
004:         *
005:         */
006:        package com.ibm.icu.text;
007:
008:        //import java.util.*;
009:
010:        abstract class TransformTransliterator {
011:            // Currently unused
012:        }
013:
014:        ///**
015:        // * An abstract class for transliterators based on a transform
016:        // * operation.  To create a transliterator that implements a
017:        // * transformation, create a subclass of this class and implement the
018:        // * abstract <code>transform()</code> and <code>hasTransform()</code>
019:        // * methods.
020:        // * @author Alan Liu
021:        // */
022:        //abstract class TransformTransliterator extends Transliterator {
023:        //
024:        //    /**
025:        //     * Constructs a transliterator.  For use by subclasses.
026:        //     */
027:        //    protected TransformTransliterator(String id, UnicodeFilter f) {
028:        //        super(id, f);
029:        //    }
030:        //
031:        //    /**
032:        //     * Implements {@link Transliterator#handleTransliterate}.
033:        //     */
034:        //    protected void handleTransliterate(Replaceable text,
035:        //                                       Position offsets, boolean incremental) {
036:        //
037:        //        int start;
038:        //        for (start = offsets.start; start < offsets.limit; ++start) {
039:        //            // Scan for the first character that is != its transform.
040:        //            // If there are none, we fall out without doing anything.
041:        //            char c = text.charAt(start);
042:        //            if (hasTransform(c)) {
043:        //                // There is a transforming character at start.  Break
044:        //                // up the remaining string, from start to
045:        //                // offsets.limit, into segments of unfiltered and
046:        //                // filtered characters.  Only transform the unfiltered
047:        //                // characters.  As always, minimize the number of
048:        //                // calls to Replaceable.replace().
049:        //
050:        //                int len = offsets.limit - start;
051:        //                // assert(len >= 1);
052:        //                
053:        //                char[] buf = new char[len];
054:        //                text.getChars(start, offsets.limit, buf, 0);
055:        //
056:        //                int segStart = 0;
057:        //                int segLimit;
058:        //                UnicodeFilter filt = getFilter();
059:        //
060:        //                // lenDelta is the accumulated length difference for
061:        //                // all transformed segments.  It is new length - old
062:        //                // length.
063:        //                int lenDelta = 0;
064:        //
065:        //                // Set segStart, segLimit to the unfiltered segment
066:        //                // starting with start.  If the filter is null, then
067:        //                // segStart/Limit will be set to the whole string,
068:        //                // that is, 0/len.
069:        //                do {
070:        //                    // Set segLimit to the first filtered char at or
071:        //                    // after segStart.
072:        //                    segLimit = len;
073:        //                    if (filt != null) {
074:        //                        segLimit = segStart;
075:        //                        while (segLimit < len && filt.contains(buf[segLimit])) {
076:        //                             ++segLimit;
077:        //                        }
078:        //                    }
079:        //
080:        //                    // Transform the unfiltered chars between segStart
081:        //                    // and segLimit.
082:        //                    int segLen = segLimit - segStart;
083:        //                    if (segLen != 0) {
084:        //                        String newStr = transform(
085:        //                            new String(buf, segStart, segLen));
086:        //                        text.replace(start, start + segLen, newStr);
087:        //                        start += newStr.length();
088:        //                        lenDelta += newStr.length() - segLen;
089:        //                    }
090:        //
091:        //                    // Set segStart to the first unfiltered char at or
092:        //                    // after segLimit.
093:        //                    segStart = segLimit;
094:        //                    if (filt != null) {
095:        //                        while (segStart < len && !filt.contains(buf[segStart])) {
096:        //                            ++segStart;
097:        //                        }
098:        //                    }
099:        //                    start += segStart - segLimit;
100:        //
101:        //                } while (segStart < len);
102:        //                
103:        //                offsets.limit += lenDelta;
104:        //                offsets.contextLimit += lenDelta;
105:        //                offsets.start = offsets.limit;
106:        //                return;
107:        //            }
108:        //        }
109:        //        // assert(start == offsets.limit);
110:        //        offsets.start = start;
111:        //    }
112:        //
113:        //    /**
114:        //     * Subclasses must implement this method to determine whether a
115:        //     * given character has a transform that is not equal to itself.
116:        //     * This is approximately equivalent to <code>c !=
117:        //     * transform(String.valueOf(c))</code>, where
118:        //     * <code>String.valueOf(c)</code> returns a String containing the
119:        //     * single character (not integer) <code>c</code>.  Subclasses that
120:        //     * transform all their input can simply return <code>true</code>.
121:        //     */
122:        //    protected abstract boolean hasTransform(int c);
123:        //
124:        //    /**
125:        //     * Subclasses must implement this method to transform a string.
126:        //     */
127:        //    protected abstract String transform(String s);
128:        //}
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.