object NumericChar
The companion object for NumericChar that offers factory
methods that produce NumericChars 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
NumericCharif passed a validCharliteral, otherwise a compile time error.A factory method, implemented via a macro, that produces a
NumericCharif passed a validCharliteral, otherwise a compile time error.The macro that implements this method will inspect the specified
Charexpression at compile time. If the expression is a numericCharliteral, i.e., a value between '0' and '9', it will return aNumericCharrepresenting that value. Otherwise, the passedCharexpression 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
fromfactory method in that this method is implemented via a macro that inspectsCharliterals at compile time, whereasfrominspectsCharvalues at run time.- value
the
Charliteral expression to inspect at compile time, and if numeric, to return wrapped in aNumericCharat run time.- 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.)
- 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
NumericChargiven a validCharvalue, or throwsAssertionError, if given an invalidCharvalue.A factory/assertion method that produces a
NumericChargiven a validCharvalue, or throwsAssertionError, if given an invalidCharvalue.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
ensuringValidcall 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
Charvalue and if it is a numericChar, it will return aNumericCharrepresenting that value. Otherwise, the passedCharvalue is not numeric, so this method will throwAssertionError.This factory method differs from the
applyfactory method in thatapplyis implemented via a macro that inspectsCharliterals at compile time, whereas this method inspectsCharvalues at run time. It differs from a vanillaassertorensuringcall in that you get something you didn't already have if the assertion succeeds: a type that promises aCharis numeric.- value
the
Charto inspect, and if numeric, return wrapped in aNumericChar.- returns
the specified
Charvalue wrapped in aNumericChar, if it is numeric, else throwsAssertionError.
- Exceptions thrown
AssertionErrorif 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 aCharvalue.A factory method that produces an
Option[NumericChar]given aCharvalue.This method will inspect the passed
Charvalue and if it is a numericChar, i.e., between '0' and '9', it will return aNumericCharrepresenting that value, wrapped in aSome. Otherwise, the passedCharvalue is not a numeric character value, so this method will returnNone.This factory method differs from the
applyfactory method in thatapplyis implemented via a macro that inspectsCharliterals at compile time, whereasfrominspectsCharvalues at run time.- value
the
Charto inspect, and if numeric, return wrapped in aSome[NumericChar].- returns
the specified
Charvalue wrapped in aSome[NumericChar], if it is numeric, elseNone.
- def fromOrElse(value: Char, default: => NumericChar): NumericChar
A factory method that produces a
NumericChargiven aCharvalue and a defaultNumericChar.A factory method that produces a
NumericChargiven aCharvalue and a defaultNumericChar.This method will inspect the passed
Charvalue and if it is a valid numeric Char (between '0' and '9'), it will return aNumericCharrepresenting that value. Otherwise, the passedCharvalue is a non-digit character, so this method will return the passeddefaultvalue.This factory method differs from the
applyfactory method in thatapplyis implemented via a macro that inspectsCharliterals at compile time, whereasfromOrElseinspectsCharvalues at run time.- value
the
Charto inspect, and if numeric, return.- default
the
NumericCharto return if the passedCharvalue is not numeric.- returns
the specified
Charvalue wrapped in aNumericChar, if it is numeric, else thedefaultNumericCharvalue.
- 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 validCharvalue, or if the givenCharis invalid, an error value of typeBproduced by passing the given invalidCharvalue to the given functionf, wrapped in aBad.A factory/validation method that produces a
NumericChar, wrapped in aGood, given a validCharvalue, or if the givenCharis invalid, an error value of typeBproduced by passing the given invalidCharvalue to the given functionf, wrapped in aBad.This method will inspect the passed
Charvalue and if it is a numericChar, it will return aNumericCharrepresenting that value, wrapped in aGood. Otherwise, the passedCharvalue is NOT numeric, so this method will return a result of typeBobtained by passing the invalidCharvalue to the given functionf, wrapped in aBad.This factory method differs from the
applyfactory method in thatapplyis implemented via a macro that inspectsCharliterals at compile time, whereas this method inspectsCharvalues at run time.- value
the
Charto inspect, and if numeric, return wrapped in aGood(NumericChar).- returns
the specified
Charvalue 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
Charvalue is between '0' and '9'.A predicate method that returns true if a given
Charvalue is between '0' and '9'.- value
the
Charto inspect, and if numeric, return true.- returns
true if the specified
Charis 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
Passgiven a validCharvalue, or an error value of typeEproduced by passing the given invalidCharvalue to the given functionf, wrapped in aFail.A validation method that produces a
Passgiven a validCharvalue, or an error value of typeEproduced by passing the given invalidCharvalue to the given functionf, wrapped in aFail.This method will inspect the passed
Charvalue and if it is a numericChar(between '0' and '9'), it will return aPass. Otherwise, the passedCharvalue is non-numeric, so this method will return a result of typeEobtained by passing the invalidCharvalue to the given functionf, wrapped in aFail.This factory method differs from the
applyfactory method in thatapplyis implemented via a macro that inspectsCharliterals at compile time, whereas this method inspectsCharvalues at run time.- value
the
Charto validate that it is numeric.- returns
a
Passif the specifiedCharvalue is numeric, else aFailcontaining an error value produced by passing the specifiedCharto 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 validCharvalue, or if the givenCharis invalid, an error value of typeLproduced by passing the given invalidCharvalue to the given functionf, wrapped in aLeft.A factory/validation method that produces a
NumericChar, wrapped in aRight, given a validCharvalue, or if the givenCharis invalid, an error value of typeLproduced by passing the given invalidCharvalue to the given functionf, wrapped in aLeft.This method will inspect the passed
Charvalue and if it is a numericChar(between '0' and '9'), it will return aNumericCharrepresenting that value, wrapped in aRight. Otherwise, the passedCharvalue is NOT numeric, so this method will return a result of typeLobtained by passing the invalidCharvalue to the given functionf, wrapped in aLeft.This factory method differs from the
applyfactory method in thatapplyis implemented via a macro that inspectsCharliterals at compile time, whereas this method inspectsCharvalues at run time.- value
the
Charto inspect, and if numeric, return wrapped in aRight(NumericChar).- returns
the specified
Charvalue 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 validCharvalue, or if the givenCharis invalid, anAssertionError, wrapped in aFailure.A factory/validation method that produces a
NumericChar, wrapped in aSuccess, given a validCharvalue, or if the givenCharis invalid, anAssertionError, wrapped in aFailure.This method will inspect the passed
Charvalue and if it represents a numeric value (between '0' and '9'), it will return aNumericCharrepresenting that value, wrapped in aSuccess. Otherwise, the passedCharvalue is not numeric, so this method will return anAssertionError, wrapped in aFailure.This factory method differs from the
applyfactory method in thatapplyis implemented via a macro that inspectsCharliterals at compile time, whereas this method inspectsCharvalues at run time.- value
the
Charto inspect, and if numeric, return wrapped in aSuccess(NumericChar).- returns
the specified
Charvalue 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
NumericChartoDouble.Implicit widening conversion from
NumericChartoDouble.- value
the
NumericCharto widen- returns
the
Doublewiden from the specifiedNumericChar.
- implicit def widenToFiniteDouble(pos: NumericChar): FiniteDouble
Implicit widening conversion from
NumericChartoFiniteDouble.Implicit widening conversion from
NumericChartoFiniteDouble.- pos
the
NumericCharto widen- returns
the
Intvalue underlying the specifiedNumericChar, widened toDoubleand wrapped in aFiniteDouble.
- implicit def widenToFiniteFloat(pos: NumericChar): FiniteFloat
Implicit widening conversion from
NumericChartoFiniteFloat.Implicit widening conversion from
NumericChartoFiniteFloat.- pos
the
NumericCharto widen- returns
the
Intvalue underlying the specifiedNumericChar, widened toFloatand wrapped in aFiniteFloat.
- implicit def widenToFloat(value: NumericChar): Float
Implicit widening conversion from
NumericChartoFloat.Implicit widening conversion from
NumericChartoFloat.- value
the
NumericCharto widen- returns
the
Floatwiden from the specifiedNumericChar.
- implicit def widenToInt(value: NumericChar): Int
Implicit widening conversion from
NumericChartoInt.Implicit widening conversion from
NumericChartoInt.- value
the
NumericCharto widen- returns
the
Intwiden from the specifiedNumericChar.
- implicit def widenToLong(value: NumericChar): Long
Implicit widening conversion from
NumericChartoLong.Implicit widening conversion from
NumericChartoLong.- value
the
NumericCharto widen- returns
the
Longwiden from the specifiedNumericChar.
- implicit def widenToPosDouble(pos: NumericChar): PosDouble
Implicit widening conversion from
NumericChartoPosDouble.Implicit widening conversion from
NumericChartoPosDouble.- pos
the
NumericCharto widen- returns
the
Intvalue underlying the specifiedNumericChar, widened toDoubleand wrapped in aPosDouble.
- implicit def widenToPosFiniteDouble(pos: NumericChar): PosFiniteDouble
Implicit widening conversion from
NumericChartoPosFiniteDouble.Implicit widening conversion from
NumericChartoPosFiniteDouble.- pos
the
NumericCharto widen- returns
the
Intvalue underlying the specifiedNumericChar, widened toDoubleand wrapped in aPosFiniteDouble.
- implicit def widenToPosFiniteFloat(pos: NumericChar): PosFiniteFloat
Implicit widening conversion from
NumericChartoPosFiniteFloat.Implicit widening conversion from
NumericChartoPosFiniteFloat.- pos
the
NumericCharto widen- returns
the
Intvalue underlying the specifiedNumericChar, widened toFloatand wrapped in aPosFiniteFloat.
- implicit def widenToPosFloat(pos: NumericChar): PosFloat
Implicit widening conversion from
NumericChartoPosFloat.Implicit widening conversion from
NumericChartoPosFloat.- pos
the
NumericCharto widen- returns
the
Intvalue underlying the specifiedNumericChar, widened toFloatand wrapped in aPosFloat.
- implicit def widenToPosInt(pos: NumericChar): PosInt
Implicit widening conversion from
NumericChartoPosInt.Implicit widening conversion from
NumericChartoPosInt.- pos
the
NumericCharto widen- returns
the
Intvalue underlying the specifiedNumericChar, widened toIntand wrapped in aPosInt.
- implicit def widenToPosLong(pos: NumericChar): PosLong
Implicit widening conversion from
NumericChartoPosLong.Implicit widening conversion from
NumericChartoPosLong.- pos
the
NumericCharto widen- returns
the
Intvalue underlying the specifiedNumericChar, widened toLongand wrapped in aPosLong.
- implicit def widenToPosZDouble(pos: NumericChar): PosZDouble
Implicit widening conversion from
NumericChartoPosZDouble.Implicit widening conversion from
NumericChartoPosZDouble.- pos
the
NumericCharto widen- returns
the
Intvalue underlying the specifiedNumericChar, widened toDoubleand wrapped in aPosZDouble.
- implicit def widenToPosZFiniteDouble(pos: NumericChar): PosZFiniteDouble
Implicit widening conversion from
NumericChartoPosZFiniteDouble.Implicit widening conversion from
NumericChartoPosZFiniteDouble.- pos
the
NumericCharto widen- returns
the
Intvalue underlying the specifiedNumericChar, widened toDoubleand wrapped in aPosZFiniteDouble.
- implicit def widenToPosZFiniteFloat(pos: NumericChar): PosZFiniteFloat
Implicit widening conversion from
NumericChartoPosZFiniteFloat.Implicit widening conversion from
NumericChartoPosZFiniteFloat.- pos
the
NumericCharto widen- returns
the
Intvalue underlying the specifiedNumericChar, widened toFloatand wrapped in aPosZFiniteFloat.
- implicit def widenToPosZFloat(pos: NumericChar): PosZFloat
Implicit widening conversion from
NumericChartoPosZFloat.Implicit widening conversion from
NumericChartoPosZFloat.- pos
the
NumericCharto widen- returns
the
Intvalue underlying the specifiedNumericChar, widened toFloatand wrapped in aPosZFloat.
- implicit def widenToPosZInt(pos: NumericChar): PosZInt
Implicit widening conversion from
NumericChartoPosZInt.Implicit widening conversion from
NumericChartoPosZInt.- pos
the
NumericCharto widen- returns
the
Intvalue underlying the specifiedNumericChar, widened toIntand wrapped in aPosZInt.
- implicit def widenToPosZLong(pos: NumericChar): PosZLong
Implicit widening conversion from
NumericChartoPosZLong.Implicit widening conversion from
NumericChartoPosZLong.- pos
the
NumericCharto widen- returns
the
Intvalue underlying the specifiedNumericChar, widened toLongand wrapped in aPosZLong.