@@ -47,7 +47,7 @@ class Character private ()
4747}
4848
4949object Character {
50- final val TYPE = classOf [scala.Char ]
50+ final val TYPE = scala. Predef . classOf [scala.Char ]
5151 final val MIN_VALUE = '\u0000 '
5252 final val MAX_VALUE = '\uffff '
5353 final val SIZE = 16
@@ -114,10 +114,10 @@ object Character {
114114 }
115115
116116 @ inline
117- private [this ] def getTypeLT256 (codePoint : Int ): scala. Byte =
117+ private [this ] def getTypeLT256 (codePoint : Int ): Int =
118118 charTypesFirst256(codePoint)
119119
120- private [this ] def getTypeGE256 (codePoint : Int ): scala. Byte = {
120+ private [this ] def getTypeGE256 (codePoint : Int ): Int = {
121121 // the idx is increased by 1 due to the differences in indexing
122122 // between charTypeIndices and charType
123123 val idx = Arrays .binarySearch(charTypeIndices, codePoint) + 1
@@ -448,8 +448,8 @@ object Character {
448448 // def getDirectionality(c: scala.Char): scala.Byte
449449
450450 /* Conversions */
451- def toUpperCase (c : scala.Char ): scala.Char = c.toString.toUpperCase()(0 )
452- def toLowerCase (c : scala.Char ): scala.Char = c.toString.toLowerCase()(0 )
451+ def toUpperCase (c : scala.Char ): scala.Char = c.toString.toUpperCase().charAt (0 )
452+ def toLowerCase (c : scala.Char ): scala.Char = c.toString.toLowerCase().charAt (0 )
453453 // def toTitleCase(c: scala.Char): scala.Char
454454 // def getNumericValue(c: scala.Char): Int
455455
@@ -508,7 +508,7 @@ object Character {
508508 // Based on Unicode 7.0.0
509509
510510 // Types of characters from 0 to 255
511- private [this ] lazy val charTypesFirst256 = Array [scala. Byte ] (15 , 15 , 15 , 15 ,
511+ private [this ] lazy val charTypesFirst256 : Array [Int ] = Array (15 , 15 , 15 , 15 ,
512512 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 ,
513513 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 12 , 24 , 24 , 24 , 26 , 24 , 24 , 24 ,
514514 21 , 22 , 24 , 25 , 24 , 20 , 24 , 24 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 24 , 24 , 25 ,
@@ -541,11 +541,11 @@ object Character {
541541 // .map(tup => tup._1 - tup._2)
542542 // val charTypes = indicesAndTypes.map(_._2)
543543 // println(charTypeIndicesDeltas.mkString(
544- // "charTypeIndices: val deltas = Array[Int] (", ", ", ")"))
545- // println(charTypes.mkString("val charTypes = Array[scala.Byte] (", ", ", ")"))
544+ // "charTypeIndices: val deltas = Array(", ", ", ")"))
545+ // println(charTypes.mkString("val charTypes = Array(", ", ", ")"))
546546 //
547- private [this ] lazy val charTypeIndices = {
548- val deltas = Array [ Int ] (257 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 ,
547+ private [this ] lazy val charTypeIndices : Array [ Int ] = {
548+ val deltas = Array (257 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 ,
549549 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 ,
550550 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 2 , 1 , 1 , 1 , 1 , 1 , 1 ,
551551 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 2 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 ,
@@ -695,7 +695,7 @@ object Character {
695695 uncompressDeltas(deltas)
696696 }
697697
698- private [this ] lazy val charTypes = Array [scala. Byte ] (1 , 2 , 1 , 2 , 1 , 2 ,
698+ private [this ] lazy val charTypes : Array [Int ] = Array (1 , 2 , 1 , 2 , 1 , 2 ,
699699 1 , 2 , 1 , 2 , 1 , 2 , 1 , 2 , 1 , 2 , 1 , 2 , 1 , 2 , 1 , 2 , 1 , 2 , 1 , 2 , 1 , 2 , 1 ,
700700 2 , 1 , 2 , 1 , 2 , 1 , 2 , 1 , 2 , 1 , 2 , 1 , 2 , 1 , 2 , 1 , 2 , 1 , 2 , 1 , 2 , 1 , 2 ,
701701 1 , 2 , 1 , 2 , 1 , 2 , 1 , 2 , 1 , 2 , 1 , 2 , 1 , 2 , 1 , 2 , 1 , 2 , 1 , 2 , 1 , 2 , 1 ,
@@ -859,8 +859,8 @@ object Character {
859859 // 0 :: isMirroredIndices.init).map(tup => tup._1 - tup._2)
860860 // println(isMirroredIndicesDeltas.mkString(
861861 // "isMirroredIndices: val deltas = Array[Int](", ", ", ")"))
862- private [this ] lazy val isMirroredIndices = {
863- val deltas = Array [ Int ] (40 , 2 , 18 , 1 , 1 , 1 , 28 , 1 , 1 , 1 , 29 , 1 , 1 , 1 ,
862+ private [this ] lazy val isMirroredIndices : Array [ Int ] = {
863+ val deltas = Array (40 , 2 , 18 , 1 , 1 , 1 , 28 , 1 , 1 , 1 , 29 , 1 , 1 , 1 ,
864864 45 , 1 , 15 , 1 , 3710 , 4 , 1885 , 2 , 2460 , 2 , 10 , 2 , 54 , 2 , 14 , 2 , 177 , 1 ,
865865 192 , 4 , 3 , 6 , 3 , 1 , 3 , 2 , 3 , 4 , 1 , 4 , 1 , 1 , 1 , 1 , 4 , 9 , 5 , 1 , 1 , 18 ,
866866 5 , 4 , 9 , 2 , 1 , 1 , 1 , 8 , 2 , 31 , 2 , 4 , 5 , 1 , 9 , 2 , 2 , 19 , 5 , 2 , 9 , 5 , 2 ,
@@ -875,8 +875,14 @@ object Character {
875875 }
876876
877877 private [this ] def uncompressDeltas (deltas : Array [Int ]): Array [Int ] = {
878- for (i <- 1 until deltas.length)
879- deltas(i) += deltas(i - 1 )
878+ var acc = deltas(0 )
879+ var i = 1
880+ val len = deltas.length
881+ while (i != len) {
882+ acc += deltas(i)
883+ deltas(i) = acc
884+ i += 1
885+ }
880886 deltas
881887 }
882888
@@ -887,7 +893,7 @@ object Character {
887893 * point mapping to digits from 0 to 9.
888894 */
889895 private [this ] lazy val nonASCIIZeroDigitCodePoints : Array [Int ] = {
890- Array [ Int ] (0x660 , 0x6f0 , 0x7c0 , 0x966 , 0x9e6 , 0xa66 , 0xae6 , 0xb66 , 0xbe6 ,
896+ Array (0x660 , 0x6f0 , 0x7c0 , 0x966 , 0x9e6 , 0xa66 , 0xae6 , 0xb66 , 0xbe6 ,
891897 0xc66 , 0xce6 , 0xd66 , 0xe50 , 0xed0 , 0xf20 , 0x1040 , 0x1090 , 0x17e0 ,
892898 0x1810 , 0x1946 , 0x19d0 , 0x1a80 , 0x1a90 , 0x1b50 , 0x1bb0 , 0x1c40 , 0x1c50 ,
893899 0xa620 , 0xa8d0 , 0xa900 , 0xa9d0 , 0xaa50 , 0xabf0 , 0xff10 , 0x104a0 ,
0 commit comments