The largest value representable as a NumericChar.
The smallest value representable as a NumericChar.
A factory method, implemented via a macro, that produces a
NumericChar
if passed a valid Char
literal,
otherwise a compile time error.
A factory method, implemented via a macro, that produces a
NumericChar
if passed a valid Char
literal,
otherwise a compile time error.
The macro that implements this method will inspect the specified
Char
expression at compile time. If the expression is a
numeric Char
literal, i.e., a value between '0'
and '9', it will return a NumericChar
representing that
value. Otherwise, the passed Char
expression is either a
literal that is not numeric, or is not a literal, so this method will
give a compiler error.
This factory method differs from the from
factory method
in that this method is implemented via a macro that inspects
Char
literals at compile time, whereas from
inspects Char
values at run time.
the Char
literal expression to inspect at
compile time, and if numeric, to return wrapped in a
NumericChar
at run time.
the specified, valid Char
literal value wrapped
in a NumericChar
. (If the specified expression is not
a valid Char
literal, the invocation of this method
will not compile.)
A factory/assertion method that produces a NumericChar
given
a valid Char
value, or throws AssertionError
,
if given an invalid Char
value.
A factory/assertion method that produces a NumericChar
given
a valid Char
value, or throws AssertionError
,
if given an invalid Char
value.
Note: you should use this method only when you are convinced that it will
always succeed, i.e., never throw an exception. It is good practice to
add a comment near the invocation of this method indicating why you
think it will always succeed to document your reasoning. If you are not
sure an ensuringValid
call will always succeed, you should use one of
the other factory or validation methods provided on this object instead:
isValid
, tryingValid
, passOrElse
, goodOrElse
, or rightOrElse
.
This method will inspect the passed Char
value and if
it is a numeric Char
, it will return a
NumericChar
representing that value. Otherwise, the
passed Char
value is not numeric, so this method will
throw AssertionError
.
This factory method differs from the apply
factory method
in that apply
is implemented via a macro that inspects
Char
literals at compile time, whereas this method inspects
Char
values at run time.
It differs from a vanilla assert
or ensuring
call in that you get something you didn't already have if the assertion
succeeds: a type that promises a Char
is numeric.
the Char
to inspect, and if numeric, return
wrapped in a NumericChar
.
the specified Char
value wrapped
in a NumericChar
, if it is numeric, else throws
AssertionError
.
if the passed value is not numeric
A factory method that produces an Option[NumericChar]
given
a Char
value.
A factory method that produces an Option[NumericChar]
given
a Char
value.
This method will inspect the passed Char
value and if
it is a numeric Char
, i.e., between '0' and '9',
it will return a NumericChar
representing that value,
wrapped in a Some
. Otherwise, the passed Char
value is not a numeric character value, so this method will return
None
.
This factory method differs from the apply
factory method
in that apply
is implemented via a macro that inspects
Char
literals at compile time, whereas from
inspects Char
values at run time.
the Char
to inspect, and if numeric, return
wrapped in a Some[NumericChar]
.
the specified Char
value wrapped
in a Some[NumericChar]
, if it is numeric, else
None
.
A factory method that produces a NumericChar
given a
Char
value and a default NumericChar
.
A factory method that produces a NumericChar
given a
Char
value and a default NumericChar
.
This method will inspect the passed Char
value and if
it is a valid numeric Char (between '0' and '9'), it will return a
NumericChar
representing that value. Otherwise, the passed
Char
value is a non-digit character, so this method will
return the passed default
value.
This factory method differs from the apply
factory method
in that apply
is implemented via a macro that inspects
Char
literals at compile time, whereas
fromOrElse
inspects Char
values at run time.
the Char
to inspect, and if numeric, return.
the NumericChar
to return if the passed
Char
value is not numeric.
the specified Char
value wrapped in a
NumericChar
, if it is numeric, else the
default
NumericChar
value.
A factory/validation method that produces a NumericChar
,
wrapped in a Good
, given a valid Char
value,
or if the given Char
is invalid, an error value of type
B
produced by passing the given invalid
Char
value to the given function f
, wrapped
in a Bad
.
A factory/validation method that produces a NumericChar
,
wrapped in a Good
, given a valid Char
value,
or if the given Char
is invalid, an error value of type
B
produced by passing the given invalid
Char
value to the given function f
, wrapped
in a Bad
.
This method will inspect the passed Char
value and if
it is a numeric Char
, it will return a
NumericChar
representing that value, wrapped in a
Good
. Otherwise, the passed Char
value is
NOT numeric, so this method will return a result of type B
obtained by passing the invalid Char
value to the given
function f
, wrapped in a Bad
.
This factory method differs from the apply
factory method
in that apply
is implemented via a macro that inspects
Char
literals at compile time, whereas this method inspects
Char
values at run time.
the Char
to inspect, and if numeric, return
wrapped in a Good(NumericChar)
.
the specified Char
value wrapped
in a Good(NumericChar)
, if it is numeric, else a
Bad(f(value))
.
A predicate method that returns true if a given Char
value
is between '0' and '9'.
A predicate method that returns true if a given Char
value
is between '0' and '9'.
the Char
to inspect, and if numeric, return true.
true if the specified Char
is numeric, else false.
A validation method that produces a Pass
given a valid
Char
value, or an error value of type E
produced by passing the given invalid Char
value
to the given function f
, wrapped in a Fail
.
A validation method that produces a Pass
given a valid
Char
value, or an error value of type E
produced by passing the given invalid Char
value
to the given function f
, wrapped in a Fail
.
This method will inspect the passed Char
value and if
it is a numeric Char
(between '0' and '9'), it will return
a Pass
. Otherwise, the passed Char
value is
non-numeric, so this method will return a result of type E
obtained by passing the invalid Char
value to the given
function f
, wrapped in a Fail
.
This factory method differs from the apply
factory method
in that apply
is implemented via a macro that inspects
Char
literals at compile time, whereas this method inspects
Char
values at run time.
the Char
to validate that it is numeric.
a Pass
if the specified Char
value is numeric,
else a Fail
containing an error value produced by passing the
specified Char
to the given function f
.
A factory/validation method that produces a NumericChar
,
wrapped in a Right
, given a valid Char
value,
or if the given Char
is invalid, an error value of type
L
produced by passing the given invalid
Char
value to the given function f
, wrapped
in a Left
.
A factory/validation method that produces a NumericChar
,
wrapped in a Right
, given a valid Char
value,
or if the given Char
is invalid, an error value of type
L
produced by passing the given invalid
Char
value to the given function f
, wrapped
in a Left
.
This method will inspect the passed Char
value and if
it is a numeric Char
(between '0' and '9'), it will return a
NumericChar
representing that value, wrapped in a
Right
. Otherwise, the passed Char
value is
NOT numeric, so this method will return a result of type L
obtained by passing the invalid Char
value to the given
function f
, wrapped in a Left
.
This factory method differs from the apply
factory method
in that apply
is implemented via a macro that inspects
Char
literals at compile time, whereas this method inspects
Char
values at run time.
the Char
to inspect, and if numeric, return
wrapped in a Right(NumericChar)
.
the specified Char
value wrapped
in a Right(NumericChar)
, if it is numeric, else a
Left(f(value))
.
A factory/validation method that produces a NumericChar
,
wrapped in a Success
, given a valid Char
value, or if the given Char
is invalid, an
AssertionError
, wrapped in a Failure
.
A factory/validation method that produces a NumericChar
,
wrapped in a Success
, given a valid Char
value, or if the given Char
is invalid, an
AssertionError
, wrapped in a Failure
.
This method will inspect the passed Char
value and if
it represents a numeric value (between '0' and '9'), it will return a
NumericChar
representing that value, wrapped in a
Success
. Otherwise, the passed Char
value is
not numeric, so this method will return an AssertionError
,
wrapped in a Failure
.
This factory method differs from the apply
factory method
in that apply
is implemented via a macro that inspects
Char
literals at compile time, whereas this method inspects
Char
values at run time.
the Char
to inspect, and if numeric, return
wrapped in a Success(NumericChar)
.
the specified Char
value wrapped
in a Success(NumericChar)
, if it is numeric, else a
Failure(AssertionError)
.
Implicit widening conversion from NumericChar
to Double
.
Implicit widening conversion from NumericChar
to Double
.
the NumericChar
to widen
the Double
widen from the specified NumericChar
.
Implicit widening conversion from NumericChar
to FiniteDouble
.
Implicit widening conversion from NumericChar
to FiniteDouble
.
the NumericChar
to widen
the Int
value underlying the specified NumericChar
,
widened to Double
and wrapped in a FiniteDouble
.
Implicit widening conversion from NumericChar
to FiniteFloat
.
Implicit widening conversion from NumericChar
to FiniteFloat
.
the NumericChar
to widen
the Int
value underlying the specified NumericChar
,
widened to Float
and wrapped in a FiniteFloat
.
Implicit widening conversion from NumericChar
to Float
.
Implicit widening conversion from NumericChar
to Float
.
the NumericChar
to widen
the Float
widen from the specified NumericChar
.
Implicit widening conversion from NumericChar
to Int
.
Implicit widening conversion from NumericChar
to Int
.
the NumericChar
to widen
the Int
widen from the specified NumericChar
.
Implicit widening conversion from NumericChar
to Long
.
Implicit widening conversion from NumericChar
to Long
.
the NumericChar
to widen
the Long
widen from the specified NumericChar
.
Implicit widening conversion from NumericChar
to PosDouble
.
Implicit widening conversion from NumericChar
to PosDouble
.
the NumericChar
to widen
the Int
value underlying the specified NumericChar
,
widened to Double
and wrapped in a PosDouble
.
Implicit widening conversion from NumericChar
to PosFiniteDouble
.
Implicit widening conversion from NumericChar
to PosFiniteDouble
.
the NumericChar
to widen
the Int
value underlying the specified NumericChar
,
widened to Double
and wrapped in a PosFiniteDouble
.
Implicit widening conversion from NumericChar
to PosFiniteFloat
.
Implicit widening conversion from NumericChar
to PosFiniteFloat
.
the NumericChar
to widen
the Int
value underlying the specified NumericChar
,
widened to Float
and wrapped in a PosFiniteFloat
.
Implicit widening conversion from NumericChar
to PosFloat
.
Implicit widening conversion from NumericChar
to PosFloat
.
the NumericChar
to widen
the Int
value underlying the specified NumericChar
,
widened to Float
and wrapped in a PosFloat
.
Implicit widening conversion from NumericChar
to PosInt
.
Implicit widening conversion from NumericChar
to PosInt
.
the NumericChar
to widen
the Int
value underlying the specified NumericChar
,
widened to Int
and wrapped in a PosInt
.
Implicit widening conversion from NumericChar
to PosLong
.
Implicit widening conversion from NumericChar
to PosLong
.
the NumericChar
to widen
the Int
value underlying the specified NumericChar
,
widened to Long
and wrapped in a PosLong
.
Implicit widening conversion from NumericChar
to PosZDouble
.
Implicit widening conversion from NumericChar
to PosZDouble
.
the NumericChar
to widen
the Int
value underlying the specified NumericChar
,
widened to Double
and wrapped in a PosZDouble
.
Implicit widening conversion from NumericChar
to PosZFiniteDouble
.
Implicit widening conversion from NumericChar
to PosZFiniteDouble
.
the NumericChar
to widen
the Int
value underlying the specified NumericChar
,
widened to Double
and wrapped in a PosZFiniteDouble
.
Implicit widening conversion from NumericChar
to PosZFiniteFloat
.
Implicit widening conversion from NumericChar
to PosZFiniteFloat
.
the NumericChar
to widen
the Int
value underlying the specified NumericChar
,
widened to Float
and wrapped in a PosZFiniteFloat
.
Implicit widening conversion from NumericChar
to PosZFloat
.
Implicit widening conversion from NumericChar
to PosZFloat
.
the NumericChar
to widen
the Int
value underlying the specified NumericChar
,
widened to Float
and wrapped in a PosZFloat
.
Implicit widening conversion from NumericChar
to PosZInt
.
Implicit widening conversion from NumericChar
to PosZInt
.
the NumericChar
to widen
the Int
value underlying the specified NumericChar
,
widened to Int
and wrapped in a PosZInt
.
Implicit widening conversion from NumericChar
to PosZLong
.
Implicit widening conversion from NumericChar
to PosZLong
.
the NumericChar
to widen
the Int
value underlying the specified NumericChar
,
widened to Long
and wrapped in a PosZLong
.
The companion object for
NumericChar
that offers factory methods that produceNumericChar
s and maximum and minimum constant values forNumericChar
.