object NegInt
The companion object for NegInt that offers factory methods that
produce NegInts, implicit widening conversions from NegInt
to other numeric types, and maximum and minimum constant values for NegInt.
- Source
 - NegInt.scala
 
- Alphabetic
 - By Inheritance
 
- NegInt
 - 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: NegInt
The largest value representable as a negative
Int, which isNegInt(-1). -   final  val MinValue: NegInt
The smallest value representable as a negative
Int, which isNegInt(-2147483648). -   implicit macro  def apply(value: Int): NegInt
A factory method, implemented via a macro, that produces a
NegIntif passed a validIntliteral, otherwise a compile time error.A factory method, implemented via a macro, that produces a
NegIntif passed a validIntliteral, otherwise a compile time error.The macro that implements this method will inspect the specified
Intexpression at compile time. If the expression is a positiveIntliteral, i.e., with a value greater than 0, it will return aNegIntrepresenting that value. Otherwise, the passedIntexpression is either a literal that is 0 or negative, 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 inspectsIntliterals at compile time, whereasfrominspectsIntvalues at run time.- value
 the
Intliteral expression to inspect at compile time, and if positive, to return wrapped in aNegIntat run time.- returns
 the specified, valid
Intliteral value wrapped in aNegInt. (If the specified expression is not a validIntliteral, 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: Int): NegInt
A factory/assertion method that produces a
NegIntgiven a validIntvalue, or throwsAssertionError, if given an invalidIntvalue.A factory/assertion method that produces a
NegIntgiven a validIntvalue, or throwsAssertionError, if given an invalidIntvalue.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
Intvalue and if it is a negativeInt, it will return aNegIntrepresenting that value. Otherwise, the passedIntvalue is not negative, so this method will throwAssertionError.This factory method differs from the
applyfactory method in thatapplyis implemented via a macro that inspectsIntliterals at compile time, whereas this method inspectsIntvalues 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 anIntis negative.- value
 the
Intto inspect, and if negative, return wrapped in aNegInt.- returns
 the specified
Intvalue wrapped in aNegInt, if it is negative, else throwsAssertionError.
- Exceptions thrown
 AssertionErrorif the passed value is not negative
 -   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: Int): Option[NegInt]
A factory method that produces an
Option[NegInt]given anIntvalue.A factory method that produces an
Option[NegInt]given anIntvalue.This method will inspect the passed
Intvalue and if it is a negativeInt, i.e., a negative integer value, it will return aNegIntrepresenting that value, wrapped in aSome. Otherwise, the passedIntvalue is not negative integer value, so this method will returnNone.This factory method differs from the
applyfactory method in thatapplyis implemented via a macro that inspectsIntliterals at compile time, whereasfrominspectsIntvalues at run time.- value
 the
Intto inspect, and if negative, return wrapped in aSome[NegInt].- returns
 the specified
Intvalue wrapped in aSome[NegInt], if it is negative, elseNone.
 -    def fromOrElse(value: Int, default: => NegInt): NegInt
A factory method that produces a
NegIntgiven aIntvalue and a defaultNegInt.A factory method that produces a
NegIntgiven aIntvalue and a defaultNegInt.This method will inspect the passed
Intvalue and if it is a positiveInt, i.e., a value greater than 0.0, it will return aNegIntrepresenting that value. Otherwise, the passedIntvalue is 0 or negative, so this method will return the passeddefaultvalue.This factory method differs from the
applyfactory method in thatapplyis implemented via a macro that inspectsIntliterals at compile time, whereasfrominspectsIntvalues at run time.- value
 the
Intto inspect, and if positive, return.- default
 the
NegIntto return if the passedIntvalue is not positive.- returns
 the specified
Intvalue wrapped in aNegInt, if it is positive, else thedefaultNegIntvalue.
 -   final  def getClass(): Class[_ <: AnyRef]
- Definition Classes
 - AnyRef → Any
 - Annotations
 - @native()
 
 -    def goodOrElse[B](value: Int)(f: (Int) => B): Or[NegInt, B]
A factory/validation method that produces a
NegInt, wrapped in aGood, given a validIntvalue, or if the givenIntis invalid, an error value of typeBproduced by passing the given invalidIntvalue to the given functionf, wrapped in aBad.A factory/validation method that produces a
NegInt, wrapped in aGood, given a validIntvalue, or if the givenIntis invalid, an error value of typeBproduced by passing the given invalidIntvalue to the given functionf, wrapped in aBad.This method will inspect the passed
Intvalue and if it is a negativeInt, it will return aNegIntrepresenting that value, wrapped in aGood. Otherwise, the passedIntvalue is not negative, so this method will return a result of typeBobtained by passing the invalidIntvalue to the given functionf, wrapped in aBad.This factory method differs from the
applyfactory method in thatapplyis implemented via a macro that inspectsIntliterals at compile time, whereas this method inspectsIntvalues at run time.- value
 the
Intto inspect, and if negative, return wrapped in aGood(NegInt).- returns
 the specified
Intvalue wrapped in aGood(NegInt), if it is negative, else aBad(f(value)).
 -    def hashCode(): Int
- Definition Classes
 - AnyRef → Any
 - Annotations
 - @native()
 
 -   final  def isInstanceOf[T0]: Boolean
- Definition Classes
 - Any
 
 -    def isValid(value: Int): Boolean
A predicate method that returns true if a given
Intvalue is negative.A predicate method that returns true if a given
Intvalue is negative.- value
 the
Intto inspect, and if negative, return true.- returns
 true if the specified
Intis negative, 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()
 
 -   implicit  val ordering: Ordering[NegInt]
Implicit Ordering instance.
 -    def passOrElse[E](value: Int)(f: (Int) => E): Validation[E]
A validation method that produces a
Passgiven a validIntvalue, or an error value of typeEproduced by passing the given invalidIntvalue to the given functionf, wrapped in aFail.A validation method that produces a
Passgiven a validIntvalue, or an error value of typeEproduced by passing the given invalidIntvalue to the given functionf, wrapped in aFail.This method will inspect the passed
Intvalue and if it is a negativeInt, it will return aPass. Otherwise, the passedIntvalue is negative, so this method will return a result of typeEobtained by passing the invalidIntvalue to the given functionf, wrapped in aFail.This factory method differs from the
applyfactory method in thatapplyis implemented via a macro that inspectsIntliterals at compile time, whereas this method inspectsIntvalues at run time.- value
 the
Intto validate that it is negative.- returns
 a
Passif the specifiedIntvalue is negative, else aFailcontaining an error value produced by passing the specifiedIntto the given functionf.
 -    def rightOrElse[L](value: Int)(f: (Int) => L): Either[L, NegInt]
A factory/validation method that produces a
NegInt, wrapped in aRight, given a validIntvalue, or if the givenIntis invalid, an error value of typeLproduced by passing the given invalidIntvalue to the given functionf, wrapped in aLeft.A factory/validation method that produces a
NegInt, wrapped in aRight, given a validIntvalue, or if the givenIntis invalid, an error value of typeLproduced by passing the given invalidIntvalue to the given functionf, wrapped in aLeft.This method will inspect the passed
Intvalue and if it is a negativeInt, it will return aNegIntrepresenting that value, wrapped in aRight. Otherwise, the passedIntvalue is not negative, so this method will return a result of typeLobtained by passing the invalidIntvalue to the given functionf, wrapped in aLeft.This factory method differs from the
applyfactory method in thatapplyis implemented via a macro that inspectsIntliterals at compile time, whereas this method inspectsIntvalues at run time.- value
 the
Intto inspect, and if negative, return wrapped in aRight(NegInt).- returns
 the specified
Intvalue wrapped in aRight(NegInt), if it is negative, else aLeft(f(value)).
 -   final  def synchronized[T0](arg0: => T0): T0
- Definition Classes
 - AnyRef
 
 -    def toString(): String
- Definition Classes
 - AnyRef → Any
 
 -    def tryingValid(value: Int): Try[NegInt]
A factory/validation method that produces a
NegInt, wrapped in aSuccess, given a validIntvalue, or if the givenIntis invalid, anAssertionError, wrapped in aFailure.A factory/validation method that produces a
NegInt, wrapped in aSuccess, given a validIntvalue, or if the givenIntis invalid, anAssertionError, wrapped in aFailure.This method will inspect the passed
Intvalue and if it is a negativeInt, it will return aNegIntrepresenting that value, wrapped in aSuccess. Otherwise, the passedIntvalue is not negative, so this method will return anAssertionError, wrapped in aFailure.This factory method differs from the
applyfactory method in thatapplyis implemented via a macro that inspectsIntliterals at compile time, whereas this method inspectsIntvalues at run time.- value
 the
Intto inspect, and if negative, return wrapped in aSuccess(NegInt).- returns
 the specified
Intvalue wrapped in aSuccess(NegInt), if it is negative, 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(pos: NegInt): Double
Implicit widening conversion from
NegInttoDouble.Implicit widening conversion from
NegInttoDouble.- pos
 the
NegIntto widen- returns
 the
Intvalue underlying the specifiedNegInt, widened toDouble.
 -   implicit  def widenToFloat(pos: NegInt): Float
Implicit widening conversion from
NegInttoFloat.Implicit widening conversion from
NegInttoFloat.- pos
 the
NegIntto widen- returns
 the
Intvalue underlying the specifiedNegInt, widened toFloat.
 -   implicit  def widenToInt(pos: NegInt): Int
Implicit widening conversion from
NegInttoInt.Implicit widening conversion from
NegInttoInt.- pos
 the
NegIntto widen- returns
 the
Intvalue underlying the specifiedNegInt.
 -   implicit  def widenToLong(pos: NegInt): Long
Implicit widening conversion from
NegInttoLong.Implicit widening conversion from
NegInttoLong.- pos
 the
NegIntto widen- returns
 the
Intvalue underlying the specifiedNegInt, widened toLong.
 -   implicit  def widenToNegDouble(pos: NegInt): NegDouble
Implicit widening conversion from
NegInttoNegDouble.Implicit widening conversion from
NegInttoNegDouble.- pos
 the
NegIntto widen- returns
 the
Intvalue underlying the specifiedNegInt, widened toDoubleand wrapped in aNegDouble.
 -   implicit  def widenToNegFloat(pos: NegInt): NegFloat
Implicit widening conversion from
NegInttoNegFloat.Implicit widening conversion from
NegInttoNegFloat.- pos
 the
NegIntto widen- returns
 the
Intvalue underlying the specifiedNegInt, widened toFloatand wrapped in aNegFloat.
 -   implicit  def widenToNegLong(pos: NegInt): NegLong
Implicit widening conversion from
NegInttoNegLong.Implicit widening conversion from
NegInttoNegLong.- pos
 the
NegIntto widen- returns
 the
Intvalue underlying the specifiedNegInt, widened toLongand wrapped in aNegLong.
 -   implicit  def widenToNegZDouble(pos: NegInt): NegZDouble
Implicit widening conversion from
NegInttoNegZDouble.Implicit widening conversion from
NegInttoNegZDouble.- pos
 the
NegIntto widen- returns
 the
Intvalue underlying the specifiedNegInt, widened toDoubleand wrapped in aNegZDouble.
 -   implicit  def widenToNegZFloat(pos: NegInt): NegZFloat
Implicit widening conversion from
NegInttoNegZFloat.Implicit widening conversion from
NegInttoNegZFloat.- pos
 the
NegIntto widen- returns
 the
Intvalue underlying the specifiedNegInt, widened toFloatand wrapped in aNegZFloat.
 -   implicit  def widenToNegZInt(pos: NegInt): NegZInt
Implicit widening conversion from
NegInttoNegZInt.Implicit widening conversion from
NegInttoNegZInt.- pos
 the
NegIntto widen- returns
 the
Intvalue underlying the specifiedNegInt, widened toIntand wrapped in aNegZInt.
 -   implicit  def widenToNegZLong(pos: NegInt): NegZLong
Implicit widening conversion from
NegInttoNegZLong.Implicit widening conversion from
NegInttoNegZLong.- pos
 the
NegIntto widen- returns
 the
Intvalue underlying the specifiedNegInt, widened toLongand wrapped in aNegZLong.
 -   implicit  def widenToNonZeroDouble(pos: NegInt): NonZeroDouble
Implicit widening conversion from
NegInttoNonZeroDouble.Implicit widening conversion from
NegInttoNonZeroDouble.- pos
 the
NegIntto widen- returns
 the
Intvalue underlying the specifiedNegInt, widened toDoubleand wrapped in aNonZeroDouble.
 -   implicit  def widenToNonZeroFloat(pos: NegInt): NonZeroFloat
Implicit widening conversion from
NegInttoNonZeroFloat.Implicit widening conversion from
NegInttoNonZeroFloat.- pos
 the
NegIntto widen- returns
 the
Intvalue underlying the specifiedNegInt, widened toFloatand wrapped in aNonZeroFloat.
 -   implicit  def widenToNonZeroInt(pos: NegInt): NonZeroInt
Implicit widening conversion from
NegInttoNonZeroInt.Implicit widening conversion from
NegInttoNonZeroInt.- pos
 the
NegIntto widen- returns
 the
Intvalue underlying the specifiedNegInt, widened toIntand wrapped in aNonZeroInt.
 -   implicit  def widenToNonZeroLong(pos: NegInt): NonZeroLong
Implicit widening conversion from
NegInttoNonZeroLong.Implicit widening conversion from
NegInttoNonZeroLong.- pos
 the
NegIntto widen- returns
 the
Intvalue underlying the specifiedNegInt, widened toLongand wrapped in aNonZeroLong.