File tree 2 files changed +3
-6
lines changed
TimeParser/src/main/scala 2 files changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import scala.math.Ordering
6
6
* Represents a unicode codepoint
7
7
*/
8
8
final class CodePoint private (val intValue : Int ) {
9
- if ( ! Character .isValidCodePoint(intValue)) throw new IllegalArgumentException ( s " $intValue" )
9
+ require( Character .isValidCodePoint(intValue), s " $intValue is not a valid codepoint " )
10
10
11
11
override def toString : String = new String (Array [Int ](intValue), 0 , 1 )
12
12
override def hashCode : Int = intValue
Original file line number Diff line number Diff line change @@ -9,11 +9,8 @@ final class Digits(val value:Int)
9
9
10
10
object Digit {
11
11
def apply (x: Char ): Digit = {
12
- if ('0' <= x && x <= '9' ) {
13
- new Digit (x - '0' )
14
- } else {
15
- throw new IllegalArgumentException (" Expected ascii digit" )
16
- }
12
+ require('0' <= x && x <= '9' , " Expected ascii digit" )
13
+ new Digit (x - '0' )
17
14
}
18
15
19
16
implicit def given_Repeated : Repeated [Digit , Digits ] = new Repeated [Digit , Digits ]{
You can’t perform that action at this time.
0 commit comments