From acf1e47be8f8d7cabcb900c56a0e1ae7c0d8c1e1 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Fri, 18 Sep 2009 20:37:52 +0000 Subject: Exposed a bunch of java 5 Character methods thr... Exposed a bunch of java 5 Character methods through RichChar, and deprecated a couple in favor of less irritating names. --- src/library/scala/runtime/RichChar.scala | 39 ++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/src/library/scala/runtime/RichChar.scala b/src/library/scala/runtime/RichChar.scala index cbc8f88ab0..e79984c5a7 100644 --- a/src/library/scala/runtime/RichChar.scala +++ b/src/library/scala/runtime/RichChar.scala @@ -46,12 +46,43 @@ final class RichChar(x: Char) extends Proxy with Ordered[Char] { def isDigit: Boolean = Character.isDigit(x) def isLetter: Boolean = Character.isLetter(x) def isLetterOrDigit: Boolean = Character.isLetterOrDigit(x) - def isLowerCase: Boolean = Character.isLowerCase(x) - def isUpperCase: Boolean = Character.isUpperCase(x) def isWhitespace: Boolean = Character.isWhitespace(x) + def isSpaceChar: Boolean = Character.isSpaceChar(x) + def isHighSurrogate: Boolean = Character.isHighSurrogate(x) + def isLowSurrogate: Boolean = Character.isLowSurrogate(x) + def isUnicodeIdentifierStart: Boolean = Character.isUnicodeIdentifierStart(x) + def isUnicodeIdentifierPart: Boolean = Character.isUnicodeIdentifierPart(x) + def isIdentifierIgnorable: Boolean = Character.isIdentifierIgnorable(x) + def isMirrored: Boolean = Character.isMirrored(x) - def toLowerCase: Char = Character.toLowerCase(x) - def toUpperCase: Char = Character.toUpperCase(x) + def isLower: Boolean = Character.isLowerCase(x) + def isUpper: Boolean = Character.isUpperCase(x) + def isTitleCase: Boolean = Character.isTitleCase(x) + + def toLower: Char = Character.toLowerCase(x) + def toUpper: Char = Character.toUpperCase(x) + def toTitleCase: Char = Character.toTitleCase(x) + + def getType: Int = Character.getType(x) + def getNumericValue: Int = Character.getNumericValue(x) + def getDirectionality: Byte = Character.getDirectionality(x) + def reverseBytes: Char = Character.reverseBytes(x) + + // Java 5 Character methods not added: + // + // public static boolean isDefined(char ch) + // public static boolean isJavaIdentifierStart(char ch) + // public static boolean isJavaIdentifierPart(char ch) + + @deprecated("Use ch.toLower instead") + def toLowerCase: Char = toLower + @deprecated("Use ch.toUpper instead") + def toUpperCase: Char = toUpper + + @deprecated("Use ch.isLower instead") + def isLowerCase: Boolean = isLower + @deprecated("Use ch.isUpper instead") + def isUpperCase: Boolean = isUpper /** Create a [Char] over the characters from 'x' to 'y' - 1 */ -- cgit v1.2.3