The companion object for NumericChar that offers factory methods that produce NumericChars 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
Charto inspect, and if numeric, return wrapped in aNumericChar.
Attributes
- Returns
-
the specified
Charvalue 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
Charto inspect, and if numeric, return wrapped in aSome[NumericChar].
Attributes
- Returns
-
the specified
Charvalue 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
NumericCharto return if the passedCharvalue is not numeric. - value
-
the
Charto inspect, and if numeric, return.
Attributes
- Returns
-
the specified
Charvalue wrapped in aNumericChar, if it is numeric, else thedefaultNumericCharvalue. - 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
Charto inspect, and if numeric, return wrapped in aGood(NumericChar).
Attributes
- Returns
-
the specified
Charvalue 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
Charto inspect, and if numeric, return true.
Attributes
- Returns
-
true if the specified
Charis 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
Charto validate that it is numeric.
Attributes
- Returns
-
a
Passif the specifiedCharvalue is numeric, else aFailcontaining an error value produced by passing the specifiedCharto 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
Charto inspect, and if numeric, return wrapped in aRight(NumericChar).
Attributes
- Returns
-
the specified
Charvalue 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
Charto inspect, and if numeric, return wrapped in aSuccess(NumericChar).
Attributes
- Returns
-
the specified
Charvalue 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
Charliteral expression to inspect at compile time, and if numeric, to return wrapped in aNumericCharat run time.
Attributes
- Returns
-
the specified, valid
Charliteral value wrapped in aNumericChar. (If the specified expression is not a validCharliteral, 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
NumericCharto widen
Attributes
- Returns
-
the
Doublewiden from the specifiedNumericChar. - Source
- NumericChar.scala
Implicit widening conversion from NumericChar to FiniteDouble.
Implicit widening conversion from NumericChar to FiniteDouble.
Value parameters
- pos
-
the
NumericCharto widen
Attributes
- Returns
-
the
Intvalue underlying the specifiedNumericChar, widened toDoubleand wrapped in aFiniteDouble. - Source
- NumericChar.scala
Implicit widening conversion from NumericChar to FiniteFloat.
Implicit widening conversion from NumericChar to FiniteFloat.
Value parameters
- pos
-
the
NumericCharto widen
Attributes
- Returns
-
the
Intvalue underlying the specifiedNumericChar, widened toFloatand wrapped in aFiniteFloat. - Source
- NumericChar.scala
Implicit widening conversion from NumericChar to Float.
Implicit widening conversion from NumericChar to Float.
Value parameters
- value
-
the
NumericCharto widen
Attributes
- Returns
-
the
Floatwiden from the specifiedNumericChar. - Source
- NumericChar.scala
Implicit widening conversion from NumericChar to Int.
Implicit widening conversion from NumericChar to Int.
Value parameters
- value
-
the
NumericCharto widen
Attributes
- Returns
-
the
Intwiden from the specifiedNumericChar. - Source
- NumericChar.scala
Implicit widening conversion from NumericChar to Long.
Implicit widening conversion from NumericChar to Long.
Value parameters
- value
-
the
NumericCharto widen
Attributes
- Returns
-
the
Longwiden from the specifiedNumericChar. - Source
- NumericChar.scala
Implicit widening conversion from NumericChar to PosDouble.
Implicit widening conversion from NumericChar to PosDouble.
Value parameters
- pos
-
the
NumericCharto widen
Attributes
- Returns
-
the
Intvalue underlying the specifiedNumericChar, widened toDoubleand wrapped in aPosDouble. - Source
- NumericChar.scala
Implicit widening conversion from NumericChar to PosFiniteDouble.
Implicit widening conversion from NumericChar to PosFiniteDouble.
Value parameters
- pos
-
the
NumericCharto widen
Attributes
- Returns
-
the
Intvalue underlying the specifiedNumericChar, widened toDoubleand wrapped in aPosFiniteDouble. - Source
- NumericChar.scala
Implicit widening conversion from NumericChar to PosFiniteFloat.
Implicit widening conversion from NumericChar to PosFiniteFloat.
Value parameters
- pos
-
the
NumericCharto widen
Attributes
- Returns
-
the
Intvalue underlying the specifiedNumericChar, widened toFloatand wrapped in aPosFiniteFloat. - Source
- NumericChar.scala
Implicit widening conversion from NumericChar to PosFloat.
Implicit widening conversion from NumericChar to PosFloat.
Value parameters
- pos
-
the
NumericCharto widen
Attributes
- Returns
-
the
Intvalue underlying the specifiedNumericChar, widened toFloatand wrapped in aPosFloat. - Source
- NumericChar.scala
Implicit widening conversion from NumericChar to PosInt.
Implicit widening conversion from NumericChar to PosInt.
Value parameters
- pos
-
the
NumericCharto widen
Attributes
- Returns
-
the
Intvalue underlying the specifiedNumericChar, widened toIntand wrapped in aPosInt. - Source
- NumericChar.scala
Implicit widening conversion from NumericChar to PosLong.
Implicit widening conversion from NumericChar to PosLong.
Value parameters
- pos
-
the
NumericCharto widen
Attributes
- Returns
-
the
Intvalue underlying the specifiedNumericChar, widened toLongand wrapped in aPosLong. - Source
- NumericChar.scala
Implicit widening conversion from NumericChar to PosZDouble.
Implicit widening conversion from NumericChar to PosZDouble.
Value parameters
- pos
-
the
NumericCharto widen
Attributes
- Returns
-
the
Intvalue underlying the specifiedNumericChar, widened toDoubleand wrapped in aPosZDouble. - Source
- NumericChar.scala
Implicit widening conversion from NumericChar to PosZFiniteDouble.
Implicit widening conversion from NumericChar to PosZFiniteDouble.
Value parameters
- pos
-
the
NumericCharto widen
Attributes
- Returns
-
the
Intvalue underlying the specifiedNumericChar, widened toDoubleand wrapped in aPosZFiniteDouble. - Source
- NumericChar.scala
Implicit widening conversion from NumericChar to PosZFiniteFloat.
Implicit widening conversion from NumericChar to PosZFiniteFloat.
Value parameters
- pos
-
the
NumericCharto widen
Attributes
- Returns
-
the
Intvalue underlying the specifiedNumericChar, widened toFloatand wrapped in aPosZFiniteFloat. - Source
- NumericChar.scala
Implicit widening conversion from NumericChar to PosZFloat.
Implicit widening conversion from NumericChar to PosZFloat.
Value parameters
- pos
-
the
NumericCharto widen
Attributes
- Returns
-
the
Intvalue underlying the specifiedNumericChar, widened toFloatand wrapped in aPosZFloat. - Source
- NumericChar.scala
Implicit widening conversion from NumericChar to PosZInt.
Implicit widening conversion from NumericChar to PosZInt.
Value parameters
- pos
-
the
NumericCharto widen
Attributes
- Returns
-
the
Intvalue underlying the specifiedNumericChar, widened toIntand wrapped in aPosZInt. - Source
- NumericChar.scala
Implicit widening conversion from NumericChar to PosZLong.
Implicit widening conversion from NumericChar to PosZLong.
Value parameters
- pos
-
the
NumericCharto widen
Attributes
- Returns
-
the
Intvalue underlying the specifiedNumericChar, widened toLongand wrapped in aPosZLong. - Source
- NumericChar.scala