The companion object for NumericChar
that offers factory methods that produce NumericChar
s and maximum and minimum constant values for NumericChar
.
Attributes
- Companion
- class
- Source
- NumericChar.scala
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
NumericChar.type
Members list
Value members
Concrete methods
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.
Value parameters
- value
-
the
Char
to inspect, and if numeric, return wrapped in aNumericChar
.
Attributes
- Returns
-
the specified
Char
value wrapped in aNumericChar
, if it is numeric, else throwsAssertionError
. - Throws
-
AssertionError
if the passed value is not numeric
- Source
- NumericChar.scala
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.
Value parameters
- value
-
the
Char
to inspect, and if numeric, return wrapped in aSome[NumericChar]
.
Attributes
- Returns
-
the specified
Char
value wrapped in aSome[NumericChar]
, if it is numeric, elseNone
. - Source
- NumericChar.scala
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.
Value parameters
- default
-
the
NumericChar
to return if the passedChar
value is not numeric. - value
-
the
Char
to inspect, and if numeric, return.
Attributes
- Returns
-
the specified
Char
value wrapped in aNumericChar
, if it is numeric, else thedefault
NumericChar
value. - Source
- NumericChar.scala
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.
Value parameters
- value
-
the
Char
to inspect, and if numeric, return wrapped in aGood(NumericChar)
.
Attributes
- Returns
-
the specified
Char
value wrapped in aGood(NumericChar)
, if it is numeric, else aBad(f(value))
. - Source
- NumericChar.scala
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'.
Value parameters
- value
-
the
Char
to inspect, and if numeric, return true.
Attributes
- Returns
-
true if the specified
Char
is numeric, else false. - Source
- NumericChar.scala
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.
Value parameters
- value
-
the
Char
to validate that it is numeric.
Attributes
- Returns
-
a
Pass
if the specifiedChar
value is numeric, else aFail
containing an error value produced by passing the specifiedChar
to the given functionf
. - Source
- NumericChar.scala
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.
Value parameters
- value
-
the
Char
to inspect, and if numeric, return wrapped in aRight(NumericChar)
.
Attributes
- Returns
-
the specified
Char
value wrapped in aRight(NumericChar)
, if it is numeric, else aLeft(f(value))
. - Source
- NumericChar.scala
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.
Value parameters
- value
-
the
Char
to inspect, and if numeric, return wrapped in aSuccess(NumericChar)
.
Attributes
- Returns
-
the specified
Char
value wrapped in aSuccess(NumericChar)
, if it is numeric, else aFailure(AssertionError)
. - Source
- NumericChar.scala
Concrete fields
The largest value representable as a NumericChar.
The smallest value representable as a NumericChar.
Implicits
Implicits
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.
Value parameters
- value
-
the
Char
literal expression to inspect at compile time, and if numeric, to return wrapped in aNumericChar
at run time.
Attributes
- Returns
-
the specified, valid
Char
literal value wrapped in aNumericChar
. (If the specified expression is not a validChar
literal, the invocation of this method will not compile.) - Source
- NumericChar.scala
Implicit widening conversion from NumericChar
to Double
.
Implicit widening conversion from NumericChar
to Double
.
Value parameters
- value
-
the
NumericChar
to widen
Attributes
- Returns
-
the
Double
widen from the specifiedNumericChar
. - Source
- NumericChar.scala
Implicit widening conversion from NumericChar
to FiniteDouble
.
Implicit widening conversion from NumericChar
to FiniteDouble
.
Value parameters
- pos
-
the
NumericChar
to widen
Attributes
- Returns
-
the
Int
value underlying the specifiedNumericChar
, widened toDouble
and wrapped in aFiniteDouble
. - Source
- NumericChar.scala
Implicit widening conversion from NumericChar
to FiniteFloat
.
Implicit widening conversion from NumericChar
to FiniteFloat
.
Value parameters
- pos
-
the
NumericChar
to widen
Attributes
- Returns
-
the
Int
value underlying the specifiedNumericChar
, widened toFloat
and wrapped in aFiniteFloat
. - Source
- NumericChar.scala
Implicit widening conversion from NumericChar
to Float
.
Implicit widening conversion from NumericChar
to Float
.
Value parameters
- value
-
the
NumericChar
to widen
Attributes
- Returns
-
the
Float
widen from the specifiedNumericChar
. - Source
- NumericChar.scala
Implicit widening conversion from NumericChar
to Int
.
Implicit widening conversion from NumericChar
to Int
.
Value parameters
- value
-
the
NumericChar
to widen
Attributes
- Returns
-
the
Int
widen from the specifiedNumericChar
. - Source
- NumericChar.scala
Implicit widening conversion from NumericChar
to Long
.
Implicit widening conversion from NumericChar
to Long
.
Value parameters
- value
-
the
NumericChar
to widen
Attributes
- Returns
-
the
Long
widen from the specifiedNumericChar
. - Source
- NumericChar.scala
Implicit widening conversion from NumericChar
to PosDouble
.
Implicit widening conversion from NumericChar
to PosDouble
.
Value parameters
- pos
-
the
NumericChar
to widen
Attributes
- Returns
-
the
Int
value underlying the specifiedNumericChar
, widened toDouble
and wrapped in aPosDouble
. - Source
- NumericChar.scala
Implicit widening conversion from NumericChar
to PosFiniteDouble
.
Implicit widening conversion from NumericChar
to PosFiniteDouble
.
Value parameters
- pos
-
the
NumericChar
to widen
Attributes
- Returns
-
the
Int
value underlying the specifiedNumericChar
, widened toDouble
and wrapped in aPosFiniteDouble
. - Source
- NumericChar.scala
Implicit widening conversion from NumericChar
to PosFiniteFloat
.
Implicit widening conversion from NumericChar
to PosFiniteFloat
.
Value parameters
- pos
-
the
NumericChar
to widen
Attributes
- Returns
-
the
Int
value underlying the specifiedNumericChar
, widened toFloat
and wrapped in aPosFiniteFloat
. - Source
- NumericChar.scala
Implicit widening conversion from NumericChar
to PosFloat
.
Implicit widening conversion from NumericChar
to PosFloat
.
Value parameters
- pos
-
the
NumericChar
to widen
Attributes
- Returns
-
the
Int
value underlying the specifiedNumericChar
, widened toFloat
and wrapped in aPosFloat
. - Source
- NumericChar.scala
Implicit widening conversion from NumericChar
to PosInt
.
Implicit widening conversion from NumericChar
to PosInt
.
Value parameters
- pos
-
the
NumericChar
to widen
Attributes
- Returns
-
the
Int
value underlying the specifiedNumericChar
, widened toInt
and wrapped in aPosInt
. - Source
- NumericChar.scala
Implicit widening conversion from NumericChar
to PosLong
.
Implicit widening conversion from NumericChar
to PosLong
.
Value parameters
- pos
-
the
NumericChar
to widen
Attributes
- Returns
-
the
Int
value underlying the specifiedNumericChar
, widened toLong
and wrapped in aPosLong
. - Source
- NumericChar.scala
Implicit widening conversion from NumericChar
to PosZDouble
.
Implicit widening conversion from NumericChar
to PosZDouble
.
Value parameters
- pos
-
the
NumericChar
to widen
Attributes
- Returns
-
the
Int
value underlying the specifiedNumericChar
, widened toDouble
and wrapped in aPosZDouble
. - Source
- NumericChar.scala
Implicit widening conversion from NumericChar
to PosZFiniteDouble
.
Implicit widening conversion from NumericChar
to PosZFiniteDouble
.
Value parameters
- pos
-
the
NumericChar
to widen
Attributes
- Returns
-
the
Int
value underlying the specifiedNumericChar
, widened toDouble
and wrapped in aPosZFiniteDouble
. - Source
- NumericChar.scala
Implicit widening conversion from NumericChar
to PosZFiniteFloat
.
Implicit widening conversion from NumericChar
to PosZFiniteFloat
.
Value parameters
- pos
-
the
NumericChar
to widen
Attributes
- Returns
-
the
Int
value underlying the specifiedNumericChar
, widened toFloat
and wrapped in aPosZFiniteFloat
. - Source
- NumericChar.scala
Implicit widening conversion from NumericChar
to PosZFloat
.
Implicit widening conversion from NumericChar
to PosZFloat
.
Value parameters
- pos
-
the
NumericChar
to widen
Attributes
- Returns
-
the
Int
value underlying the specifiedNumericChar
, widened toFloat
and wrapped in aPosZFloat
. - Source
- NumericChar.scala
Implicit widening conversion from NumericChar
to PosZInt
.
Implicit widening conversion from NumericChar
to PosZInt
.
Value parameters
- pos
-
the
NumericChar
to widen
Attributes
- Returns
-
the
Int
value underlying the specifiedNumericChar
, widened toInt
and wrapped in aPosZInt
. - Source
- NumericChar.scala
Implicit widening conversion from NumericChar
to PosZLong
.
Implicit widening conversion from NumericChar
to PosZLong
.
Value parameters
- pos
-
the
NumericChar
to widen
Attributes
- Returns
-
the
Int
value underlying the specifiedNumericChar
, widened toLong
and wrapped in aPosZLong
. - Source
- NumericChar.scala