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


001:        /*
002:         **********************************************************************
003:         *   Copyright (c) 2001, International Business Machines
004:         *   Corporation and others.  All Rights Reserved.
005:         **********************************************************************
006:         *   Date        Name        Description
007:         *   11/29/2001  aliu        Creation.
008:         *   06/26/2002  aliu        Moved to com.ibm.icu.dev.tool.translit
009:         **********************************************************************
010:         */
011:        package com.ibm.icu.dev.tool.translit;
012:
013:        import java.util.*;
014:        import com.ibm.icu.dev.tool.translit.UnicodeSetClosure;
015:        import java.io.*;
016:        import com.ibm.icu.text.*;
017:
018:        /**
019:         * Class that generates source set information for a transliterator.
020:         * 
021:         * To run, use:
022:         * 
023:         *   java com.ibm.icu.dev.tool.translit.SourceSet Latin-Katakana NFD lower
024:         * 
025:         * Output is produced in the command console, and a file with more detail is also written.
026:         * 
027:         * To see if it works, use:
028:         * 
029:         *   java com.ibm.icu.dev.test.translit.TransliteratorTest -v -nothrow TestIncrementalProgress
030:         * 
031:         * and
032:         *  
033:         *   java com.ibm.icu.dev.demo.translit.Demo
034:         */
035:        public class SourceSet {
036:
037:            public static void main(String[] args) throws IOException {
038:                if (args.length == 0) {
039:                    // Compute and display the source sets for all system
040:                    // transliterators.
041:                    for (Enumeration e = Transliterator.getAvailableIDs(); e
042:                            .hasMoreElements();) {
043:                        String ID = (String) e.nextElement();
044:                        showSourceSet(ID, Normalizer.NONE, false);
045:                    }
046:                } else {
047:                    // Usage: ID [NFKD | NFD] [lower]
048:                    Normalizer.Mode m = Normalizer.NONE;
049:                    boolean lowerFirst = false;
050:                    if (args.length >= 2) {
051:                        if (args[1].equalsIgnoreCase("NFD")) {
052:                            m = Normalizer.NFD;
053:                        } else if (args[1].equalsIgnoreCase("NFKD")) {
054:                            m = Normalizer.NFKD;
055:                        } else {
056:                            usage();
057:                        }
058:                    }
059:                    if (args.length >= 3) {
060:                        if (args[2].equalsIgnoreCase("lower")) {
061:                            lowerFirst = true;
062:                        } else {
063:                            usage();
064:                        }
065:                    }
066:                    if (args.length > 3) {
067:                        usage();
068:                    }
069:                    showSourceSet(args[0], m, lowerFirst);
070:                }
071:            }
072:
073:            static void showSourceSet(String ID, Normalizer.Mode m,
074:                    boolean lowerFirst) throws IOException {
075:                File f = new File("UnicodeSetClosure.txt");
076:                String filename = f.getCanonicalFile().toString();
077:                out = new PrintWriter(new OutputStreamWriter(
078:                        new FileOutputStream(filename), "UTF-8"));
079:                out.print('\uFEFF'); // BOM
080:                System.out.println();
081:                System.out.println("Writing " + filename);
082:                Transliterator t = Transliterator.getInstance(ID);
083:                showSourceSetAux(t, m, lowerFirst, true);
084:                showSourceSetAux(t.getInverse(), m, lowerFirst, false);
085:                out.close();
086:            }
087:
088:            static PrintWriter out;
089:
090:            static void showSourceSetAux(Transliterator t, Normalizer.Mode m,
091:                    boolean lowerFirst, boolean forward) throws IOException {
092:                UnicodeSet sourceSet = t.getSourceSet();
093:                if (m != Normalizer.NONE || lowerFirst) {
094:                    UnicodeSetClosure.close(sourceSet, m, lowerFirst);
095:                }
096:                System.out
097:                        .println(t.getID() + ": " + sourceSet.toPattern(true));
098:                out.println("# MINIMAL FILTER GENERATED FOR: " + t.getID()
099:                        + (forward ? "" : " REVERSE"));
100:                out.println(":: " + (forward ? "" : "( ")
101:                        + sourceSet.toPattern(true) + (forward ? "" : " )")
102:                        + " ;");
103:                out.println("# Unicode: " + sourceSet.toPattern(false));
104:                out.println();
105:            }
106:
107:            static void usage() {
108:                System.err.println("Usage: ID [ NFD|NFKD [lower] ]");
109:                System.exit(1);
110:            }
111:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.