Source Code Cross Referenced for Character.java in  » 6.0-JDK-Modules » j2me » java » lang » 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 » 6.0 JDK Modules » j2me » java.lang 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *   
003:         *
004:         * Copyright  1990-2007 Sun Microsystems, Inc. All Rights Reserved.
005:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
006:         * 
007:         * This program is free software; you can redistribute it and/or
008:         * modify it under the terms of the GNU General Public License version
009:         * 2 only, as published by the Free Software Foundation.
010:         * 
011:         * This program is distributed in the hope that it will be useful, but
012:         * WITHOUT ANY WARRANTY; without even the implied warranty of
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014:         * General Public License version 2 for more details (a copy is
015:         * included at /legal/license.txt).
016:         * 
017:         * You should have received a copy of the GNU General Public License
018:         * version 2 along with this work; if not, write to the Free Software
019:         * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020:         * 02110-1301 USA
021:         * 
022:         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
023:         * Clara, CA 95054 or visit www.sun.com if you need additional
024:         * information or have any questions.
025:         */
026:
027:        package java.lang;
028:
029:        import com.sun.cldc.i18n.uclc.*;
030:
031:        /**
032:         * The Character class wraps a value of the primitive type <code>char</code>
033:         * in an object. An object of type <code>Character</code> contains a
034:         * single field whose type is <code>char</code>.
035:         * <p>
036:         * In addition, this class provides several methods for determining
037:         * the type of a character and converting characters from uppercase
038:         * to lowercase and vice versa.
039:         * <p>
040:         * Character information is based on the Unicode Standard, version 3.0.
041:         * However, in order to reduce footprint, by default the character
042:         * property and case conversion operations in CLDC are available
043:         * only for the ISO Latin-1 range of characters.  Other Unicode
044:         * character blocks can be supported as necessary.
045:         * <p>
046:         *
047:         * @version 12/17/01 (CLDC 1.1)
048:         * @since   JDK1.0, CLDC 1.0
049:         */
050:
051:        /*
052:         * Implementation note:
053:         * 
054:         * The character property and case conversion facilities 
055:         * provided by this CLDC implementation can be
056:         * extended by overriding an implementation class called 
057:         * DefaultCaseConverter.  Refer to the end of this file
058:         * for details.
059:         */
060:
061:        public final class Character extends Object {
062:
063:            /**
064:             * The minimum radix available for conversion to and from Strings.
065:             *
066:             * @see     java.lang.Integer#toString(int, int)
067:             * @see     java.lang.Integer#valueOf(java.lang.String)
068:             */
069:            public static final int MIN_RADIX = 2;
070:
071:            /**
072:             * The maximum radix available for conversion to and from Strings.
073:             *
074:             * @see     java.lang.Integer#toString(int, int)
075:             * @see     java.lang.Integer#valueOf(java.lang.String)
076:             */
077:            public static final int MAX_RADIX = 36;
078:
079:            /**
080:             * The constant value of this field is the smallest value of type
081:             * <code>char</code>.
082:             *
083:             * @since   JDK1.0.2
084:             */
085:            public static final char MIN_VALUE = '\u0000';
086:
087:            /**
088:             * The constant value of this field is the largest value of type
089:             * <code>char</code>.
090:             *
091:             * @since   JDK1.0.2
092:             */
093:            public static final char MAX_VALUE = '\uffff';
094:
095:            /**
096:             * The value of the Character.
097:             */
098:            private char value;
099:
100:            /**
101:             * Constructs a <code>Character</code> object and initializes it so
102:             * that it represents the primitive <code>value</code> argument.
103:             *
104:             * @param  value   value for the new <code>Character</code> object.
105:             */
106:            public Character(char value) {
107:                this .value = value;
108:            }
109:
110:            /**
111:             * Returns the value of this Character object.
112:             * @return  the primitive <code>char</code> value represented by
113:             *          this object.
114:             */
115:            public char charValue() {
116:                return value;
117:            }
118:
119:            /**
120:             * Returns a hash code for this Character.
121:             * @return  a hash code value for this object.
122:             */
123:            public int hashCode() {
124:                return (int) value;
125:            }
126:
127:            /**
128:             * Compares this object against the specified object.
129:             * The result is <code>true</code> if and only if the argument is not
130:             * <code>null</code> and is a <code>Character</code> object that
131:             * represents the same <code>char</code> value as this object.
132:             *
133:             * @param   obj   the object to compare with.
134:             * @return  <code>true</code> if the objects are the same;
135:             *          <code>false</code> otherwise.
136:             */
137:            public boolean equals(Object obj) {
138:                if (obj instanceof  Character) {
139:                    return value == ((Character) obj).charValue();
140:                }
141:                return false;
142:            }
143:
144:            /**
145:             * Returns a String object representing this character's value.
146:             * Converts this <code>Character</code> object to a string. The
147:             * result is a string whose length is <code>1</code>. The string's
148:             * sole component is the primitive <code>char</code> value represented
149:             * by this object.
150:             *
151:             * @return  a string representation of this object.
152:             */
153:            public String toString() {
154:                char buf[] = { value };
155:                return String.valueOf(buf);
156:            }
157:
158:            /**
159:             * Determines if the specified character is a lowercase character.
160:             * <p>
161:             * Note that by default CLDC only supports 
162:             * the ISO Latin-1 range of characters.
163:             * <p>
164:             * Of the ISO Latin-1 characters (character codes 0x0000 through 0x00FF),
165:             * the following are lowercase:
166:             * <p>
167:             * a b c d e f g h i j k l m n o p q r s t u v w x y z
168:             * &#92;u00DF &#92;u00E0 &#92;u00E1 &#92;u00E2 &#92;u00E3 &#92;u00E4 &#92;u00E5 &#92;u00E6 &#92;u00E7
169:             * &#92;u00E8 &#92;u00E9 &#92;u00EA &#92;u00EB &#92;u00EC &#92;u00ED &#92;u00EE &#92;u00EF &#92;u00F0
170:             * &#92;u00F1 &#92;u00F2 &#92;u00F3 &#92;u00F4 &#92;u00F5 &#92;u00F6 &#92;u00F8 &#92;u00F9 &#92;u00FA
171:             * &#92;u00FB &#92;u00FC &#92;u00FD &#92;u00FE &#92;u00FF
172:             *
173:             * @param   ch   the character to be tested.
174:             * @return  <code>true</code> if the character is lowercase;
175:             *          <code>false</code> otherwise.
176:             * @since   JDK1.0
177:             */
178:            public static boolean isLowerCase(char ch) {
179:                return DefaultCaseConverter.isLowerCase(ch);
180:            }
181:
182:            /**
183:             * Determines if the specified character is an uppercase character.
184:             * <p>
185:             * Note that by default CLDC only supports 
186:             * the ISO Latin-1 range of characters.
187:             * <p>
188:             * Of the ISO Latin-1 characters (character codes 0x0000 through 0x00FF),
189:             * the following are uppercase:
190:             * <p>
191:             * A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
192:             * &#92;u00C0 &#92;u00C1 &#92;u00C2 &#92;u00C3 &#92;u00C4 &#92;u00C5 &#92;u00C6 &#92;u00C7
193:             * &#92;u00C8 &#92;u00C9 &#92;u00CA &#92;u00CB &#92;u00CC &#92;u00CD &#92;u00CE &#92;u00CF &#92;u00D0
194:             * &#92;u00D1 &#92;u00D2 &#92;u00D3 &#92;u00D4 &#92;u00D5 &#92;u00D6 &#92;u00D8 &#92;u00D9 &#92;u00DA
195:             * &#92;u00DB &#92;u00DC &#92;u00DD &#92;u00DE
196:             *
197:             * @param   ch   the character to be tested.
198:             * @return  <code>true</code> if the character is uppercase;
199:             *          <code>false</code> otherwise.
200:             * @see     java.lang.Character#isLowerCase(char)
201:             * @see     java.lang.Character#toUpperCase(char)
202:             * @since   1.0
203:             */
204:            public static boolean isUpperCase(char ch) {
205:                return DefaultCaseConverter.isUpperCase(ch);
206:            }
207:
208:            /**
209:             * Determines if the specified character is a digit.
210:             *
211:             * @param   ch   the character to be tested.
212:             * @return  <code>true</code> if the character is a digit;
213:             *          <code>false</code> otherwise.
214:             * @since   JDK1.0
215:             */
216:            public static boolean isDigit(char ch) {
217:                return DefaultCaseConverter.isDigit(ch);
218:            }
219:
220:            /**
221:             * The given character is mapped to its lowercase equivalent; if the
222:             * character has no lowercase equivalent, the character itself is
223:             * returned.
224:             * <p>
225:             * Note that by default CLDC only supports 
226:             * the ISO Latin-1 range of characters.
227:             *
228:             * @param   ch   the character to be converted.
229:             * @return  the lowercase equivalent of the character, if any;
230:             *          otherwise the character itself.
231:             * @see     java.lang.Character#isLowerCase(char)
232:             * @see     java.lang.Character#isUpperCase(char)
233:             * @see     java.lang.Character#toUpperCase(char)
234:             * @since   JDK1.0
235:             */
236:            public static char toLowerCase(char ch) {
237:                return DefaultCaseConverter.toLowerCase(ch);
238:            }
239:
240:            /**
241:             * Converts the character argument to uppercase; if the
242:             * character has no uppercase equivalent, the character itself is
243:             * returned.
244:             * <p>
245:             * Note that by default CLDC only supports 
246:             * the ISO Latin-1 range of characters.
247:             *
248:             * @param   ch   the character to be converted.
249:             * @return  the uppercase equivalent of the character, if any;
250:             *          otherwise the character itself.
251:             * @see     java.lang.Character#isLowerCase(char)
252:             * @see     java.lang.Character#isUpperCase(char)
253:             * @see     java.lang.Character#toLowerCase(char)
254:             * @since   JDK1.0
255:             */
256:            public static char toUpperCase(char ch) {
257:                return DefaultCaseConverter.toUpperCase(ch);
258:            }
259:
260:            /**
261:             * Returns the numeric value of the character <code>ch</code> in the
262:             * specified radix.
263:             *
264:             * @param   ch      the character to be converted.
265:             * @param   radix   the radix.
266:             * @return  the numeric value represented by the character in the
267:             *          specified radix.
268:             * @see     java.lang.Character#isDigit(char)
269:             * @since   JDK1.0
270:             */
271:            public static int digit(char ch, int radix) {
272:                return DefaultCaseConverter.digit(ch, radix);
273:            }
274:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.