object NegLong
The companion object for NegLong
that offers
factory methods that produce NegLong
s, implicit
widening conversions from NegLong
to other
numeric types, and maximum and minimum constant values for
NegLong
.
- Source
- NegLong.scala
- Alphabetic
- By Inheritance
- NegLong
- 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: NegLong
The largest value representable as a negative
Long
, which isNegLong(-1L)
. - final val MinValue: NegLong
The smallest value representable as a positive
Long
, which isNegLong(-9223372036854775808)
. - implicit macro def apply(value: Long): NegLong
A factory method, implemented via a macro, that produces a
NegLong
if passed a validLong
literal, otherwise a compile time error.A factory method, implemented via a macro, that produces a
NegLong
if passed a validLong
literal, otherwise a compile time error.The macro that implements this method will inspect the specified
Long
expression at compile time. If the expression is a negativeLong
literal, it will return aNegLong
representing that value. Otherwise, the passedLong
expression is either a literal that is not negative, 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 inspectsLong
literals at compile time, whereasfrom
inspectsLong
values at run time.- value
the
Long
literal expression to inspect at compile time, and if negative, to return wrapped in aNegLong
at run time.- returns
the specified, valid
Long
literal value wrapped in aNegLong
. (If the specified expression is not a validLong
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: Long): NegLong
A factory/assertion method that produces an
NegLong
given a validLong
value, or throwsAssertionError
, if given an invalidLong
value.A factory/assertion method that produces an
NegLong
given a validLong
value, or throwsAssertionError
, if given an invalidLong
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
Long
value and if it is a negativeLong
, it will return aNegLong
representing that value. Otherwise, the passedLong
value is not negative, so this method will throwAssertionError
.This factory method differs from the
apply
factory method in thatapply
is implemented via a macro that inspectsLong
literals at compile time, whereasfrom
inspectsLong
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 aLong
is positive.- value
the
Long
to inspect, and if negative, return wrapped in aNegLong
.- returns
the specified
Long
value wrapped in aNegLong
, if it is negative, else throwsAssertionError
.
- Exceptions thrown
AssertionError
if 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: Long): Option[NegLong]
A factory method that produces an
Option[NegLong]
given aLong
value.A factory method that produces an
Option[NegLong]
given aLong
value.This method will inspect the passed
Long
value and if it is a negativeLong
, it will return aNegLong
representing that value, wrapped in aSome
. Otherwise, the passedLong
value is not negative, so this method will returnNone
.This factory method differs from the
apply
factory method in thatapply
is implemented via a macro that inspectsLong
literals at compile time, whereasfrom
inspectsLong
values at run time.- value
the
Long
to inspect, and if negative, return wrapped in aSome[NegLong]
.- returns
the specified
Long
value wrapped in aSome[NegLong]
, if it is negative, elseNone
.
- def fromOrElse(value: Long, default: => NegLong): NegLong
A factory method that produces a
NegLong
given aLong
value and a defaultNegLong
.A factory method that produces a
NegLong
given aLong
value and a defaultNegLong
.This method will inspect the passed
Long
value and if it is a negativeLong
, it will return aNegLong
representing that value. Otherwise, the passedLong
value is not negative, 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 inspectsLong
literals at compile time, whereasfrom
inspectsLong
values at run time.- value
the
Long
to inspect, and if negative, return.- default
the
NegLong
to return if the passedLong
value is not negative.- returns
the specified
Long
value wrapped in aNegLong
, if it is negative, else thedefault
NegLong
value.
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def goodOrElse[B](value: Long)(f: (Long) => B): Or[NegLong, B]
A factory/validation method that produces a
NegLong
, wrapped in aGood
, given a validLong
value, or if the givenLong
is invalid, an error value of typeB
produced by passing the given invalidLong
value to the given functionf
, wrapped in aBad
.A factory/validation method that produces a
NegLong
, wrapped in aGood
, given a validLong
value, or if the givenLong
is invalid, an error value of typeB
produced by passing the given invalidLong
value to the given functionf
, wrapped in aBad
.This method will inspect the passed
Long
value and if it is a negativeLong
, it will return aNegLong
representing that value, wrapped in aGood
. Otherwise, the passedLong
value is not negative, so this method will return a result of typeB
obtained by passing the invalidLong
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 inspectsLong
literals at compile time, whereas this method inspectsLong
values at run time.- value
the
Long
to inspect, and if negative, return wrapped in aGood(NegLong)
.- returns
the specified
Long
value wrapped in aGood(NegLong)
, 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: Long): Boolean
A predicate method that returns true if a given
Long
value is negative.A predicate method that returns true if a given
Long
value is negative.- value
the
Long
to inspect, and if negative, return true.- returns
true if the specified
Long
is 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[NegLong]
Implicit Ordering instance.
- def passOrElse[E](value: Long)(f: (Long) => E): Validation[E]
A validation method that produces a
Pass
given a validLong
value, or an error value of typeE
produced by passing the given invalidInt
value to the given functionf
, wrapped in aFail
.A validation method that produces a
Pass
given a validLong
value, or an error value of typeE
produced by passing the given invalidInt
value to the given functionf
, wrapped in aFail
.This method will inspect the passed
Long
value and if it is a negativeLong
, it will return aPass
. Otherwise, the passedLong
value is negative, so this method will return a result of typeE
obtained by passing the invalidLong
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 inspectsLong
literals at compile time, whereas this method inspectsLong
values at run time.- value
the
Long
to validate that it is negative.- returns
a
Pass
if the specifiedLong
value is negative, else aFail
containing an error value produced by passing the specifiedLong
to the given functionf
.
- def rightOrElse[L](value: Long)(f: (Long) => L): Either[L, NegLong]
A factory/validation method that produces a
NegLong
, wrapped in aRight
, given a validInt
value, or if the givenInt
is invalid, an error value of typeL
produced by passing the given invalidInt
value to the given functionf
, wrapped in aLeft
.A factory/validation method that produces a
NegLong
, wrapped in aRight
, given a validInt
value, or if the givenInt
is invalid, an error value of typeL
produced by passing the given invalidInt
value to the given functionf
, wrapped in aLeft
.This method will inspect the passed
Int
value and if it is a negativeInt
, it will return aNegLong
representing that value, wrapped in aRight
. Otherwise, the passedInt
value is not negative, so this method will return a result of typeL
obtained by passing the invalidInt
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 inspectsInt
literals at compile time, whereas this method inspectsInt
values at run time.- value
the
Int
to inspect, and if negative, return wrapped in aRight(NegLong)
.- returns
the specified
Int
value wrapped in aRight(NegLong)
, 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: Long): Try[NegLong]
A factory/validation method that produces a
NegLong
, wrapped in aSuccess
, given a validLong
value, or if the givenLong
is invalid, anAssertionError
, wrapped in aFailure
.A factory/validation method that produces a
NegLong
, wrapped in aSuccess
, given a validLong
value, or if the givenLong
is invalid, anAssertionError
, wrapped in aFailure
.This method will inspect the passed
Long
value and if it is a negativeLong
, it will return aNegLong
representing that value, wrapped in aSuccess
. Otherwise, the passedLong
value is not negative, 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 inspectsLong
literals at compile time, whereas this method inspectsLong
values at run time.- value
the
Long
to inspect, and if negative, return wrapped in aSuccess(NegLong)
.- returns
the specified
Long
value wrapped in aSuccess(NegLong)
, 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: NegLong): Double
Implicit widening conversion from
NegLong
toDouble
.Implicit widening conversion from
NegLong
toDouble
.- pos
the
NegLong
to widen- returns
the
Long
value underlying the specifiedNegLong
, widened toDouble
.
- implicit def widenToFloat(pos: NegLong): Float
Implicit widening conversion from
NegLong
toFloat
.Implicit widening conversion from
NegLong
toFloat
.- pos
the
NegLong
to widen- returns
the
Long
value underlying the specifiedNegLong
, widened toFloat
.
- implicit def widenToLong(pos: NegLong): Long
Implicit widening conversion from
NegLong
toLong
.Implicit widening conversion from
NegLong
toLong
.- pos
the
NegLong
to widen- returns
the
Long
value underlying the specifiedNegLong
.
- implicit def widenToNegDouble(pos: NegLong): NegDouble
Implicit widening conversion from
NegLong
toNegDouble
.Implicit widening conversion from
NegLong
toNegDouble
.- pos
the
NegLong
to widen- returns
the
Long
value underlying the specifiedNegLong
, widened toDouble
and wrapped in aNegDouble
.
- implicit def widenToNegFloat(pos: NegLong): NegFloat
Implicit widening conversion from
NegLong
toNegFloat
.Implicit widening conversion from
NegLong
toNegFloat
.- pos
the
NegLong
to widen- returns
the
Long
value underlying the specifiedNegLong
, widened toFloat
and wrapped in aNegFloat
.
- implicit def widenToNegZDouble(pos: NegLong): NegZDouble
Implicit widening conversion from
NegLong
toNegZDouble
.Implicit widening conversion from
NegLong
toNegZDouble
.- pos
the
NegLong
to widen- returns
the
Long
value underlying the specifiedNegLong
, widened toDouble
and wrapped in aNegZDouble
.
- implicit def widenToNegZFloat(pos: NegLong): NegZFloat
Implicit widening conversion from
NegLong
toNegZFloat
.Implicit widening conversion from
NegLong
toNegZFloat
.- pos
the
NegLong
to widen- returns
the
Long
value underlying the specifiedNegLong
, widened toFloat
and wrapped in aNegZFloat
.
- implicit def widenToNegZLong(pos: NegLong): NegZLong
Implicit widening conversion from
NegLong
toNegZLong
.Implicit widening conversion from
NegLong
toNegZLong
.- pos
the
NegLong
to widen- returns
the
Long
value underlying the specifiedNegLong
, widened toLong
and wrapped in aNegZLong
.
- implicit def widenToNonZeroDouble(pos: NegLong): NonZeroDouble
Implicit widening conversion from
NegLong
toNonZeroDouble
.Implicit widening conversion from
NegLong
toNonZeroDouble
.- pos
the
NegLong
to widen- returns
the
Long
value underlying the specifiedNegLong
, widened toDouble
and wrapped in aNonZeroDouble
.
- implicit def widenToNonZeroFloat(pos: NegLong): NonZeroFloat
Implicit widening conversion from
NegLong
toNonZeroFloat
.Implicit widening conversion from
NegLong
toNonZeroFloat
.- pos
the
NegLong
to widen- returns
the
Long
value underlying the specifiedNegLong
, widened toFloat
and wrapped in aNonZeroFloat
.
- implicit def widenToNonZeroLong(pos: NegLong): NonZeroLong
Implicit widening conversion from
NegLong
toNonZeroLong
.Implicit widening conversion from
NegLong
toNonZeroLong
.- pos
the
NegLong
to widen- returns
the
Long
value underlying the specifiedNegLong
, widened toLong
and wrapped in aNonZeroLong
.