object NumericChar
The companion object for NumericChar
that offers factory
methods that produce NumericChar
s and maximum and minimum
constant values for NumericChar
.
- Source
- NumericChar.scala
- Alphabetic
- By Inheritance
- NumericChar
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final val MaxValue: NumericChar
The largest value representable as a NumericChar.
- final val MinValue: NumericChar
The smallest value representable as a NumericChar.
- implicit macro def apply(value: Char): NumericChar
A factory method, implemented via a macro, that produces a
NumericChar
if passed a validChar
literal, otherwise a compile time error.A factory method, implemented via a macro, that produces a
NumericChar
if passed a validChar
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 numericChar
literal, i.e., a value between '0' and '9', it will return aNumericChar
representing that value. Otherwise, the passedChar
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 inspectsChar
literals at compile time, whereasfrom
inspectsChar
values at run time.- value
the
Char
literal expression to inspect at compile time, and if numeric, to return wrapped in aNumericChar
at run time.- 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.)
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def ensuringValid(value: Char): NumericChar
A factory/assertion method that produces a
NumericChar
given a validChar
value, or throwsAssertionError
, if given an invalidChar
value.A factory/assertion method that produces a
NumericChar
given a validChar
value, or throwsAssertionError
, if given an invalidChar
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
, orrightOrElse
.This method will inspect the passed
Char
value and if it is a numericChar
, it will return aNumericChar
representing that value. Otherwise, the passedChar
value is not numeric, so this method will throwAssertionError
.This factory method differs from the
apply
factory method in thatapply
is implemented via a macro that inspectsChar
literals at compile time, whereas this method inspectsChar
values at run time. It differs from a vanillaassert
orensuring
call in that you get something you didn't already have if the assertion succeeds: a type that promises aChar
is numeric.- value
the
Char
to inspect, and if numeric, return wrapped in aNumericChar
.- returns
the specified
Char
value wrapped in aNumericChar
, if it is numeric, else throwsAssertionError
.
- Exceptions thrown
AssertionError
if the passed value is not numeric
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def from(value: Char): Option[NumericChar]
A factory method that produces an
Option[NumericChar]
given aChar
value.A factory method that produces an
Option[NumericChar]
given aChar
value.This method will inspect the passed
Char
value and if it is a numericChar
, i.e., between '0' and '9', it will return aNumericChar
representing that value, wrapped in aSome
. Otherwise, the passedChar
value is not a numeric character value, so this method will returnNone
.This factory method differs from the
apply
factory method in thatapply
is implemented via a macro that inspectsChar
literals at compile time, whereasfrom
inspectsChar
values at run time.- value
the
Char
to inspect, and if numeric, return wrapped in aSome[NumericChar]
.- returns
the specified
Char
value wrapped in aSome[NumericChar]
, if it is numeric, elseNone
.
- def fromOrElse(value: Char, default: => NumericChar): NumericChar
A factory method that produces a
NumericChar
given aChar
value and a defaultNumericChar
.A factory method that produces a
NumericChar
given aChar
value and a defaultNumericChar
.This method will inspect the passed
Char
value and if it is a valid numeric Char (between '0' and '9'), it will return aNumericChar
representing that value. Otherwise, the passedChar
value is a non-digit character, so this method will return the passeddefault
value.This factory method differs from the
apply
factory method in thatapply
is implemented via a macro that inspectsChar
literals at compile time, whereasfromOrElse
inspectsChar
values at run time.- value
the
Char
to inspect, and if numeric, return.- default
the
NumericChar
to return if the passedChar
value is not numeric.- returns
the specified
Char
value wrapped in aNumericChar
, if it is numeric, else thedefault
NumericChar
value.
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def goodOrElse[B](value: Char)(f: (Char) => B): Or[NumericChar, B]
A factory/validation method that produces a
NumericChar
, wrapped in aGood
, given a validChar
value, or if the givenChar
is invalid, an error value of typeB
produced by passing the given invalidChar
value to the given functionf
, wrapped in aBad
.A factory/validation method that produces a
NumericChar
, wrapped in aGood
, given a validChar
value, or if the givenChar
is invalid, an error value of typeB
produced by passing the given invalidChar
value to the given functionf
, wrapped in aBad
.This method will inspect the passed
Char
value and if it is a numericChar
, it will return aNumericChar
representing that value, wrapped in aGood
. Otherwise, the passedChar
value is NOT numeric, so this method will return a result of typeB
obtained by passing the invalidChar
value to the given functionf
, wrapped in aBad
.This factory method differs from the
apply
factory method in thatapply
is implemented via a macro that inspectsChar
literals at compile time, whereas this method inspectsChar
values at run time.- value
the
Char
to inspect, and if numeric, return wrapped in aGood(NumericChar)
.- returns
the specified
Char
value wrapped in aGood(NumericChar)
, if it is numeric, else aBad(f(value))
.
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isValid(value: Char): Boolean
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
the
Char
to inspect, and if numeric, return true.- returns
true if the specified
Char
is numeric, else false.
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def passOrElse[E](value: Char)(f: (Char) => E): Validation[E]
A validation method that produces a
Pass
given a validChar
value, or an error value of typeE
produced by passing the given invalidChar
value to the given functionf
, wrapped in aFail
.A validation method that produces a
Pass
given a validChar
value, or an error value of typeE
produced by passing the given invalidChar
value to the given functionf
, wrapped in aFail
.This method will inspect the passed
Char
value and if it is a numericChar
(between '0' and '9'), it will return aPass
. Otherwise, the passedChar
value is non-numeric, so this method will return a result of typeE
obtained by passing the invalidChar
value to the given functionf
, wrapped in aFail
.This factory method differs from the
apply
factory method in thatapply
is implemented via a macro that inspectsChar
literals at compile time, whereas this method inspectsChar
values at run time.- value
the
Char
to validate that it is numeric.- returns
a
Pass
if the specifiedChar
value is numeric, else aFail
containing an error value produced by passing the specifiedChar
to the given functionf
.
- def rightOrElse[L](value: Char)(f: (Char) => L): Either[L, NumericChar]
A factory/validation method that produces a
NumericChar
, wrapped in aRight
, given a validChar
value, or if the givenChar
is invalid, an error value of typeL
produced by passing the given invalidChar
value to the given functionf
, wrapped in aLeft
.A factory/validation method that produces a
NumericChar
, wrapped in aRight
, given a validChar
value, or if the givenChar
is invalid, an error value of typeL
produced by passing the given invalidChar
value to the given functionf
, wrapped in aLeft
.This method will inspect the passed
Char
value and if it is a numericChar
(between '0' and '9'), it will return aNumericChar
representing that value, wrapped in aRight
. Otherwise, the passedChar
value is NOT numeric, so this method will return a result of typeL
obtained by passing the invalidChar
value to the given functionf
, wrapped in aLeft
.This factory method differs from the
apply
factory method in thatapply
is implemented via a macro that inspectsChar
literals at compile time, whereas this method inspectsChar
values at run time.- value
the
Char
to inspect, and if numeric, return wrapped in aRight(NumericChar)
.- returns
the specified
Char
value wrapped in aRight(NumericChar)
, if it is numeric, else aLeft(f(value))
.
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- def tryingValid(value: Char): Try[NumericChar]
A factory/validation method that produces a
NumericChar
, wrapped in aSuccess
, given a validChar
value, or if the givenChar
is invalid, anAssertionError
, wrapped in aFailure
.A factory/validation method that produces a
NumericChar
, wrapped in aSuccess
, given a validChar
value, or if the givenChar
is invalid, anAssertionError
, wrapped in aFailure
.This method will inspect the passed
Char
value and if it represents a numeric value (between '0' and '9'), it will return aNumericChar
representing that value, wrapped in aSuccess
. Otherwise, the passedChar
value is not numeric, so this method will return anAssertionError
, wrapped in aFailure
.This factory method differs from the
apply
factory method in thatapply
is implemented via a macro that inspectsChar
literals at compile time, whereas this method inspectsChar
values at run time.- value
the
Char
to inspect, and if numeric, return wrapped in aSuccess(NumericChar)
.- returns
the specified
Char
value wrapped in aSuccess(NumericChar)
, if it is numeric, else aFailure(AssertionError)
.
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- implicit def widenToDouble(value: NumericChar): Double
Implicit widening conversion from
NumericChar
toDouble
.Implicit widening conversion from
NumericChar
toDouble
.- value
the
NumericChar
to widen- returns
the
Double
widen from the specifiedNumericChar
.
- implicit def widenToFiniteDouble(pos: NumericChar): FiniteDouble
Implicit widening conversion from
NumericChar
toFiniteDouble
.Implicit widening conversion from
NumericChar
toFiniteDouble
.- pos
the
NumericChar
to widen- returns
the
Int
value underlying the specifiedNumericChar
, widened toDouble
and wrapped in aFiniteDouble
.
- implicit def widenToFiniteFloat(pos: NumericChar): FiniteFloat
Implicit widening conversion from
NumericChar
toFiniteFloat
.Implicit widening conversion from
NumericChar
toFiniteFloat
.- pos
the
NumericChar
to widen- returns
the
Int
value underlying the specifiedNumericChar
, widened toFloat
and wrapped in aFiniteFloat
.
- implicit def widenToFloat(value: NumericChar): Float
Implicit widening conversion from
NumericChar
toFloat
.Implicit widening conversion from
NumericChar
toFloat
.- value
the
NumericChar
to widen- returns
the
Float
widen from the specifiedNumericChar
.
- implicit def widenToInt(value: NumericChar): Int
Implicit widening conversion from
NumericChar
toInt
.Implicit widening conversion from
NumericChar
toInt
.- value
the
NumericChar
to widen- returns
the
Int
widen from the specifiedNumericChar
.
- implicit def widenToLong(value: NumericChar): Long
Implicit widening conversion from
NumericChar
toLong
.Implicit widening conversion from
NumericChar
toLong
.- value
the
NumericChar
to widen- returns
the
Long
widen from the specifiedNumericChar
.
- implicit def widenToPosDouble(pos: NumericChar): PosDouble
Implicit widening conversion from
NumericChar
toPosDouble
.Implicit widening conversion from
NumericChar
toPosDouble
.- pos
the
NumericChar
to widen- returns
the
Int
value underlying the specifiedNumericChar
, widened toDouble
and wrapped in aPosDouble
.
- implicit def widenToPosFiniteDouble(pos: NumericChar): PosFiniteDouble
Implicit widening conversion from
NumericChar
toPosFiniteDouble
.Implicit widening conversion from
NumericChar
toPosFiniteDouble
.- pos
the
NumericChar
to widen- returns
the
Int
value underlying the specifiedNumericChar
, widened toDouble
and wrapped in aPosFiniteDouble
.
- implicit def widenToPosFiniteFloat(pos: NumericChar): PosFiniteFloat
Implicit widening conversion from
NumericChar
toPosFiniteFloat
.Implicit widening conversion from
NumericChar
toPosFiniteFloat
.- pos
the
NumericChar
to widen- returns
the
Int
value underlying the specifiedNumericChar
, widened toFloat
and wrapped in aPosFiniteFloat
.
- implicit def widenToPosFloat(pos: NumericChar): PosFloat
Implicit widening conversion from
NumericChar
toPosFloat
.Implicit widening conversion from
NumericChar
toPosFloat
.- pos
the
NumericChar
to widen- returns
the
Int
value underlying the specifiedNumericChar
, widened toFloat
and wrapped in aPosFloat
.
- implicit def widenToPosInt(pos: NumericChar): PosInt
Implicit widening conversion from
NumericChar
toPosInt
.Implicit widening conversion from
NumericChar
toPosInt
.- pos
the
NumericChar
to widen- returns
the
Int
value underlying the specifiedNumericChar
, widened toInt
and wrapped in aPosInt
.
- implicit def widenToPosLong(pos: NumericChar): PosLong
Implicit widening conversion from
NumericChar
toPosLong
.Implicit widening conversion from
NumericChar
toPosLong
.- pos
the
NumericChar
to widen- returns
the
Int
value underlying the specifiedNumericChar
, widened toLong
and wrapped in aPosLong
.
- implicit def widenToPosZDouble(pos: NumericChar): PosZDouble
Implicit widening conversion from
NumericChar
toPosZDouble
.Implicit widening conversion from
NumericChar
toPosZDouble
.- pos
the
NumericChar
to widen- returns
the
Int
value underlying the specifiedNumericChar
, widened toDouble
and wrapped in aPosZDouble
.
- implicit def widenToPosZFiniteDouble(pos: NumericChar): PosZFiniteDouble
Implicit widening conversion from
NumericChar
toPosZFiniteDouble
.Implicit widening conversion from
NumericChar
toPosZFiniteDouble
.- pos
the
NumericChar
to widen- returns
the
Int
value underlying the specifiedNumericChar
, widened toDouble
and wrapped in aPosZFiniteDouble
.
- implicit def widenToPosZFiniteFloat(pos: NumericChar): PosZFiniteFloat
Implicit widening conversion from
NumericChar
toPosZFiniteFloat
.Implicit widening conversion from
NumericChar
toPosZFiniteFloat
.- pos
the
NumericChar
to widen- returns
the
Int
value underlying the specifiedNumericChar
, widened toFloat
and wrapped in aPosZFiniteFloat
.
- implicit def widenToPosZFloat(pos: NumericChar): PosZFloat
Implicit widening conversion from
NumericChar
toPosZFloat
.Implicit widening conversion from
NumericChar
toPosZFloat
.- pos
the
NumericChar
to widen- returns
the
Int
value underlying the specifiedNumericChar
, widened toFloat
and wrapped in aPosZFloat
.
- implicit def widenToPosZInt(pos: NumericChar): PosZInt
Implicit widening conversion from
NumericChar
toPosZInt
.Implicit widening conversion from
NumericChar
toPosZInt
.- pos
the
NumericChar
to widen- returns
the
Int
value underlying the specifiedNumericChar
, widened toInt
and wrapped in aPosZInt
.
- implicit def widenToPosZLong(pos: NumericChar): PosZLong
Implicit widening conversion from
NumericChar
toPosZLong
.Implicit widening conversion from
NumericChar
toPosZLong
.- pos
the
NumericChar
to widen- returns
the
Int
value underlying the specifiedNumericChar
, widened toLong
and wrapped in aPosZLong
.