object NegZInt
The companion object for NegZInt that offers factory methods that
produce NegZInts, implicit widening conversions from NegZInt
to other numeric types, and maximum and minimum constant values for NegZInt.
- Source
- NegZInt.scala
- Alphabetic
- By Inheritance
- NegZInt
- 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: NegZInt
The largest value representable as a non-positive
Int, which isNegZInt(0). - final val MinValue: NegZInt
The smallest value representable as a non-positive
Int, which isNegZInt(-2147483648). - implicit macro def apply(value: Int): NegZInt
A factory method, implemented via a macro, that produces a
NegZIntif passed a validIntliteral, otherwise a compile time error.A factory method, implemented via a macro, that produces a
NegZIntif 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 aNegZIntrepresenting 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 aNegZIntat run time.- returns
the specified, valid
Intliteral value wrapped in aNegZInt. (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): NegZInt
A factory/assertion method that produces a
NegZIntgiven a validIntvalue, or throwsAssertionError, if given an invalidIntvalue.A factory/assertion method that produces a
NegZIntgiven 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 non-positiveInt, it will return aNegZIntrepresenting that value. Otherwise, the passedIntvalue is not non-positive, 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 non-positive.- value
the
Intto inspect, and if non-positive, return wrapped in aNegZInt.- returns
the specified
Intvalue wrapped in aNegZInt, if it is non-positive, else throwsAssertionError.
- Exceptions thrown
AssertionErrorif the passed value is not non-positive
- 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[NegZInt]
A factory method that produces an
Option[NegZInt]given anIntvalue.A factory method that produces an
Option[NegZInt]given anIntvalue.This method will inspect the passed
Intvalue and if it is a non-positiveInt, i.e., a non-positive integer value, it will return aNegZIntrepresenting that value, wrapped in aSome. Otherwise, the passedIntvalue is not non-positive 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 non-positive, return wrapped in aSome[NegZInt].- returns
the specified
Intvalue wrapped in aSome[NegZInt], if it is non-positive, elseNone.
- def fromOrElse(value: Int, default: => NegZInt): NegZInt
A factory method that produces a
NegZIntgiven aIntvalue and a defaultNegZInt.A factory method that produces a
NegZIntgiven aIntvalue and a defaultNegZInt.This method will inspect the passed
Intvalue and if it is a positiveInt, i.e., a value greater than 0.0, it will return aNegZIntrepresenting 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
NegZIntto return if the passedIntvalue is not positive.- returns
the specified
Intvalue wrapped in aNegZInt, if it is positive, else thedefaultNegZIntvalue.
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def goodOrElse[B](value: Int)(f: (Int) => B): Or[NegZInt, B]
A factory/validation method that produces a
NegZInt, 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
NegZInt, 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 non-positiveInt, it will return aNegZIntrepresenting that value, wrapped in aGood. Otherwise, the passedIntvalue is not non-positive, 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 non-positive, return wrapped in aGood(NegZInt).- returns
the specified
Intvalue wrapped in aGood(NegZInt), if it is non-positive, 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 non-positive.A predicate method that returns true if a given
Intvalue is non-positive.- value
the
Intto inspect, and if non-positive, return true.- returns
true if the specified
Intis non-positive, 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[NegZInt]
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 non-positiveInt, it will return aPass. Otherwise, the passedIntvalue is non-positive, 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 non-positive.- returns
a
Passif the specifiedIntvalue is non-positive, else aFailcontaining an error value produced by passing the specifiedIntto the given functionf.
- def rightOrElse[L](value: Int)(f: (Int) => L): Either[L, NegZInt]
A factory/validation method that produces a
NegZInt, 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
NegZInt, 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 non-positiveInt, it will return aNegZIntrepresenting that value, wrapped in aRight. Otherwise, the passedIntvalue is not non-positive, 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 non-positive, return wrapped in aRight(NegZInt).- returns
the specified
Intvalue wrapped in aRight(NegZInt), if it is non-positive, 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[NegZInt]
A factory/validation method that produces a
NegZInt, wrapped in aSuccess, given a validIntvalue, or if the givenIntis invalid, anAssertionError, wrapped in aFailure.A factory/validation method that produces a
NegZInt, 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 non-positiveInt, it will return aNegZIntrepresenting that value, wrapped in aSuccess. Otherwise, the passedIntvalue is not non-positive, 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 non-positive, return wrapped in aSuccess(NegZInt).- returns
the specified
Intvalue wrapped in aSuccess(NegZInt), if it is non-positive, 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: NegZInt): Double
Implicit widening conversion from
NegZInttoDouble.Implicit widening conversion from
NegZInttoDouble.- pos
the
NegZIntto widen- returns
the
Intvalue underlying the specifiedNegZInt, widened toDouble.
- implicit def widenToFloat(pos: NegZInt): Float
Implicit widening conversion from
NegZInttoFloat.Implicit widening conversion from
NegZInttoFloat.- pos
the
NegZIntto widen- returns
the
Intvalue underlying the specifiedNegZInt, widened toFloat.
- implicit def widenToInt(pos: NegZInt): Int
Implicit widening conversion from
NegZInttoInt.Implicit widening conversion from
NegZInttoInt.- pos
the
NegZIntto widen- returns
the
Intvalue underlying the specifiedNegZInt.
- implicit def widenToLong(pos: NegZInt): Long
Implicit widening conversion from
NegZInttoLong.Implicit widening conversion from
NegZInttoLong.- pos
the
NegZIntto widen- returns
the
Intvalue underlying the specifiedNegZInt, widened toLong.
- implicit def widenToNegZDouble(pos: NegZInt): NegZDouble
Implicit widening conversion from
NegZInttoNegZDouble.Implicit widening conversion from
NegZInttoNegZDouble.- pos
the
NegZIntto widen- returns
the
Intvalue underlying the specifiedNegZInt, widened toDoubleand wrapped in aNegZDouble.
- implicit def widenToNegZFloat(pos: NegZInt): NegZFloat
Implicit widening conversion from
NegZInttoNegZFloat.Implicit widening conversion from
NegZInttoNegZFloat.- pos
the
NegZIntto widen- returns
the
Intvalue underlying the specifiedNegZInt, widened toFloatand wrapped in aNegZFloat.
- implicit def widenToNegZLong(pos: NegZInt): NegZLong
Implicit widening conversion from
NegZInttoNegZLong.Implicit widening conversion from
NegZInttoNegZLong.- pos
the
NegZIntto widen- returns
the
Intvalue underlying the specifiedNegZInt, widened toLongand wrapped in aNegZLong.