Source Code Cross Referenced for Replaceable.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:         *******************************************************************************
003:         * Copyright (C) 1996-2004, International Business Machines Corporation and    *
004:         * others. All Rights Reserved.                                                *
005:         *******************************************************************************
006:         */
007:        package com.ibm.icu.text;
008:
009:        /**
010:         * <code>Replaceable</code> is an interface representing a
011:         * string of characters that supports the replacement of a range of
012:         * itself with a new string of characters.  It is used by APIs that
013:         * change a piece of text while retaining metadata.  Metadata is data
014:         * other than the Unicode characters returned by char32At().  One
015:         * example of metadata is style attributes; another is an edit
016:         * history, marking each character with an author and revision number.
017:         *
018:         * <p>An implicit aspect of the <code>Replaceable</code> API is that
019:         * during a replace operation, new characters take on the metadata of
020:         * the old characters.  For example, if the string "the <b>bold</b>
021:         * font" has range (4, 8) replaced with "strong", then it becomes "the
022:         * <b>strong</b> font".
023:         *
024:         * <p><code>Replaceable</code> specifies ranges using a start
025:         * offset and a limit offset.  The range of characters thus specified
026:         * includes the characters at offset start..limit-1.  That is, the
027:         * start offset is inclusive, and the limit offset is exclusive.
028:         *
029:         * <p><code>Replaceable</code> also includes API to access characters
030:         * in the string: <code>length()</code>, <code>charAt()</code>,
031:         * <code>char32At()</code>, and <code>extractBetween()</code>.
032:         *
033:         * <p>For a subclass to support metadata, typical behavior of
034:         * <code>replace()</code> is the following:
035:         * <ul>
036:         *   <li>Set the metadata of the new text to the metadata of the first
037:         *   character replaced</li>
038:         *   <li>If no characters are replaced, use the metadata of the
039:         *   previous character</li>
040:         *   <li>If there is no previous character (i.e. start == 0), use the
041:         *   following character</li>
042:         *   <li>If there is no following character (i.e. the replaceable was
043:         *   empty), use default metadata<br>
044:         *   <li>If the code point U+FFFF is seen, it should be interpreted as
045:         *   a special marker having no metadata<li>
046:         *   </li>
047:         * </ul>
048:         * If this is not the behavior, the subclass should document any differences.
049:         * 
050:         * <p>Copyright &copy; IBM Corporation 1999.  All rights reserved.
051:         *
052:         * @author Alan Liu
053:         * @stable ICU 2.0
054:         */
055:        public interface Replaceable {
056:            /**
057:             * Returns the number of 16-bit code units in the text.
058:             * @return number of 16-bit code units in text
059:             * @stable ICU 2.0
060:             */
061:            int length();
062:
063:            /**
064:             * Returns the 16-bit code unit at the given offset into the text.
065:             * @param offset an integer between 0 and <code>length()</code>-1
066:             * inclusive
067:             * @return 16-bit code unit of text at given offset
068:             * @stable ICU 2.0
069:             */
070:            char charAt(int offset);
071:
072:            /**
073:             * Returns the 32-bit code point at the given 16-bit offset into
074:             * the text.  This assumes the text is stored as 16-bit code units
075:             * with surrogate pairs intermixed.  If the offset of a leading or
076:             * trailing code unit of a surrogate pair is given, return the
077:             * code point of the surrogate pair.
078:             *
079:             * <p>Most subclasses can return
080:             * <code>com.ibm.icu.text.UTF16.charAt(this, offset)</code>.
081:             * @param offset an integer between 0 and <code>length()</code>-1
082:             * inclusive
083:             * @return 32-bit code point of text at given offset
084:             * @stable ICU 2.0
085:             */
086:            int char32At(int offset);
087:
088:            /**
089:             * Copies characters from this object into the destination
090:             * character array.  The first character to be copied is at index
091:             * <code>srcStart</code>; the last character to be copied is at
092:             * index <code>srcLimit-1</code> (thus the total number of
093:             * characters to be copied is <code>srcLimit-srcStart</code>). The
094:             * characters are copied into the subarray of <code>dst</code>
095:             * starting at index <code>dstStart</code> and ending at index
096:             * <code>dstStart + (srcLimit-srcStart) - 1</code>.
097:             *
098:             * @param srcStart the beginning index to copy, inclusive; <code>0
099:             * <= start <= limit</code>.
100:             * @param srcLimit the ending index to copy, exclusive;
101:             * <code>start <= limit <= length()</code>.
102:             * @param dst the destination array.
103:             * @param dstStart the start offset in the destination array.
104:             * @stable ICU 2.0
105:             */
106:            void getChars(int srcStart, int srcLimit, char dst[], int dstStart);
107:
108:            /**
109:             * Replaces a substring of this object with the given text.
110:             *
111:             * <p>Subclasses must ensure that if the text between start and
112:             * limit is equal to the replacement text, that replace has no
113:             * effect. That is, any metadata
114:             * should be unaffected. In addition, subclasses are encouraged to
115:             * check for initial and trailing identical characters, and make a
116:             * smaller replacement if possible. This will preserve as much
117:             * metadata as possible.
118:             * @param start the beginning index, inclusive; <code>0 <= start
119:             * <= limit</code>.
120:             * @param limit the ending index, exclusive; <code>start <= limit
121:             * <= length()</code>.
122:             * @param text the text to replace characters <code>start</code>
123:             * to <code>limit - 1</code>
124:             * @stable ICU 2.0
125:             */
126:            void replace(int start, int limit, String text);
127:
128:            /**
129:             * Replaces a substring of this object with the given text.
130:             *
131:             * <p>Subclasses must ensure that if the text between start and
132:             * limit is equal to the replacement text, that replace has no
133:             * effect. That is, any metadata
134:             * should be unaffected. In addition, subclasses are encouraged to
135:             * check for initial and trailing identical characters, and make a
136:             * smaller replacement if possible. This will preserve as much
137:             * metadata as possible.
138:             * @param start the beginning index, inclusive; <code>0 <= start
139:             * <= limit</code>.
140:             * @param limit the ending index, exclusive; <code>start <= limit
141:             * <= length()</code>.
142:             * @param chars the text to replace characters <code>start</code>
143:             * to <code>limit - 1</code>
144:             * @param charsStart the beginning index into <code>chars</code>,
145:             * inclusive; <code>0 <= start <= limit</code>.
146:             * @param charsLen the number of characters of <code>chars</code>.
147:             * @stable ICU 2.0
148:             */
149:            void replace(int start, int limit, char[] chars, int charsStart,
150:                    int charsLen);
151:
152:            // Note: We use length rather than limit to conform to StringBuffer
153:            // and System.arraycopy.
154:
155:            /**
156:             * Copies a substring of this object, retaining metadata.
157:             * This method is used to duplicate or reorder substrings.
158:             * The destination index must not overlap the source range.
159:             * If <code>hasMetaData()</code> returns false, subclasses
160:             * may use the naive implementation:
161:             *
162:             * <pre> char[] text = new char[limit - start];
163:             * getChars(start, limit, text, 0);
164:             * replace(dest, dest, text, 0, limit - start);</pre>
165:             * 
166:             * @param start the beginning index, inclusive; <code>0 <= start <=
167:             * limit</code>.
168:             * @param limit the ending index, exclusive; <code>start <= limit <=
169:             * length()</code>.
170:             * @param dest the destination index.  The characters from
171:             * <code>start..limit-1</code> will be copied to <code>dest</code>.
172:             * Implementations of this method may assume that <code>dest <= start ||
173:             * dest >= limit</code>.
174:             * @stable ICU 2.0
175:             */
176:            void copy(int start, int limit, int dest);
177:
178:            /**
179:             * Returns true if this object contains metadata.  If a
180:             * Replaceable object has metadata, calls to the Replaceable API
181:             * must be made so as to preserve metadata.  If it does not, calls
182:             * to the Replaceable API may be optimized to improve performance.
183:             * @return true if this object contains metadata
184:             * @stable ICU 2.2
185:             */
186:            boolean hasMetaData();
187:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.