1 64 package com.jcorporate.expresso.core.misc; 65 66 import java.io.ObjectInputStream ; 67 import java.io.ObjectOutputStream ; 68 69 70 72 84 public final class ReusableChar implements java.io.Serializable , Comparable { 85 97 public static final int MIN_RADIX = 2; 98 99 111 public static final int MAX_RADIX = 36; 112 113 119 public static final char MIN_VALUE = '\u0000'; 120 121 127 public static final char MAX_VALUE = '\uffff'; 128 129 134 private char value; 135 136 142 public ReusableChar(char value) { 143 this.value = value; 144 } 145 146 151 public void setCharValue(char ch) { 152 value = ch; 153 } 154 155 183 public static boolean isDefined(char ch) { 184 return Character.isDefined(ch); 185 } 186 187 206 public static boolean isDigit(char ch) { 207 return Character.isDigit(ch); 208 } 209 210 222 public static boolean isISOControl(char ch) { 223 return Character.isISOControl(ch); 224 } 225 226 274 public static boolean isIdentifierIgnorable(char ch) { 275 return Character.isIdentifierIgnorable(ch); 276 } 277 278 318 public static boolean isJavaIdentifierPart(char ch) { 319 return Character.isJavaIdentifierPart(ch); 320 } 321 322 346 public static boolean isJavaIdentifierStart(char ch) { 347 return Character.isJavaIdentifierStart(ch); 348 } 349 350 384 public static boolean isLetter(char ch) { 385 return Character.isLetter(ch); 386 } 387 388 412 public static boolean isLetterOrDigit(char ch) { 413 return Character.isLetterOrDigit(ch); 414 } 415 416 471 public static boolean isLowerCase(char ch) { 472 return Character.isLowerCase(ch); 473 } 474 475 490 public static int getNumericValue(char ch) { 491 return Character.getNumericValue(ch); 492 } 493 494 505 public static boolean isSpaceChar(char ch) { 506 return Character.isSpaceChar(ch); 507 } 508 509 552 public static boolean isTitleCase(char ch) { 553 return Character.isTitleCase(ch); 554 } 555 556 590 public static int getType(char ch) { 591 return Character.getType(ch); 592 } 593 594 631 public static boolean isUnicodeIdentifierPart(char ch) { 632 return Character.isUnicodeIdentifierPart(ch); 633 } 634 635 648 public static boolean isUnicodeIdentifierStart(char ch) { 649 return Character.isUnicodeIdentifierStart(ch); 650 } 651 652 702 public static boolean isUpperCase(char ch) { 703 return Character.isUpperCase(ch); 704 } 705 706 756 public static boolean isWhitespace(char ch) { 757 return Character.isWhitespace(ch); 758 } 759 760 766 public char charValue() { 767 return value; 768 } 769 770 810 public static int digit(char ch, int radix) { 811 return Character.digit(ch, radix); 812 } 813 814 824 public boolean equals(Object obj) { 825 if (obj instanceof ReusableChar) { 826 return value == ((ReusableChar) obj).charValue(); 827 } 828 829 return false; 830 } 831 832 860 public static char forDigit(int digit, int radix) { 861 return Character.forDigit(digit, radix); 862 } 863 864 869 public int hashCode() { 870 return (int) value; 871 } 872 873 899 public static char toLowerCase(char ch) { 900 return Character.toLowerCase(ch); 901 } 902 903 911 public String toString() { 912 char[] buf = {value}; 913 914 return String.valueOf(buf); 915 } 916 917 945 public static char toTitleCase(char ch) { 946 return Character.toTitleCase(ch); 947 } 948 949 970 public static char toUpperCase(char ch) { 971 return Character.toUpperCase(ch); 972 } 973 974 986 public int compareTo(ReusableChar anotherCharacter) { 987 return this.value - anotherCharacter.value; 988 } 989 990 1006 public int compareTo(Object o) { 1007 return compareTo((ReusableChar) o); 1008 } 1009 1010 1017 private void readObject(ObjectInputStream ois) 1018 throws ClassNotFoundException , java.io.IOException { 1019 value = ois.readChar(); 1020 } 1021 1022 private void writeObject(ObjectOutputStream oos) throws java.io.IOException { 1023 oos.writeChar((int) value); 1024 } 1025} 1026 | Popular Tags |