Removing the code which has been deprecated since 2.8.0. Contributed by
Simon Ochsenreither, although deleting code is such fun one hesitates to call it a contribution. Still, we will. Closes SI-4860, no review. git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@25511 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
This commit is contained in:
parent
be61acff42
commit
34fa938a38
|
@ -27,14 +27,6 @@ abstract class Future[+T] extends Responder[T] with Function0[T] {
|
|||
private[actors] var fvalue: Option[Any] = None
|
||||
private[actors] def fvalueTyped = fvalue.get.asInstanceOf[T]
|
||||
|
||||
@deprecated("this member is going to be removed in a future release", "2.8.0")
|
||||
def ch: InputChannel[Any] = inputChannel
|
||||
|
||||
@deprecated("this member is going to be removed in a future release", "2.8.0")
|
||||
protected def value: Option[Any] = fvalue
|
||||
@deprecated("this member is going to be removed in a future release", "2.8.0")
|
||||
protected def value_=(x: Option[Any]) { fvalue = x }
|
||||
|
||||
/** Tests whether the future's result is available.
|
||||
*
|
||||
* @return `true` if the future's result is available,
|
||||
|
|
|
@ -37,25 +37,4 @@ object Scheduler extends DelegatingScheduler {
|
|||
Debug.info(this+": starting new "+sched+" ["+sched.getClass+"]")
|
||||
sched
|
||||
}
|
||||
|
||||
/* Only `ForkJoinScheduler` implements this method.
|
||||
*/
|
||||
@deprecated("snapshot will be removed", "2.8.0")
|
||||
def snapshot() {
|
||||
if (sched.isInstanceOf[ForkJoinScheduler]) {
|
||||
sched.asInstanceOf[ForkJoinScheduler].snapshot()
|
||||
} else
|
||||
sys.error("scheduler does not implement snapshot")
|
||||
}
|
||||
|
||||
/* Only `ForkJoinScheduler` implements this method.
|
||||
*/
|
||||
@deprecated("restart will be removed", "2.8.0")
|
||||
def restart() {
|
||||
if (sched.isInstanceOf[ForkJoinScheduler]) {
|
||||
sched.asInstanceOf[ForkJoinScheduler].restart()
|
||||
} else
|
||||
sys.error("scheduler does not implement restart")
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,29 +19,4 @@ package object actors {
|
|||
|
||||
// type of Reactors tracked by termination detector
|
||||
private[actors] type TrackedReactor = Reactor[A] forSome { type A >: Null }
|
||||
|
||||
@deprecated("use scheduler.ForkJoinScheduler instead", "2.8.0")
|
||||
type FJTaskScheduler2 = scala.actors.scheduler.ForkJoinScheduler
|
||||
|
||||
@deprecated("use scheduler.ForkJoinScheduler instead", "2.8.0")
|
||||
type TickedScheduler = scala.actors.scheduler.ForkJoinScheduler
|
||||
|
||||
@deprecated("use scheduler.ForkJoinScheduler instead", "2.8.0")
|
||||
type WorkerThreadScheduler = scala.actors.scheduler.ForkJoinScheduler
|
||||
|
||||
@deprecated("this class is going to be removed in a future release", "2.8.0")
|
||||
type WorkerThread = java.lang.Thread
|
||||
|
||||
@deprecated("use scheduler.SingleThreadedScheduler instead", "2.8.0")
|
||||
type SingleThreadedScheduler = scala.actors.scheduler.SingleThreadedScheduler
|
||||
|
||||
// This used to do a blind cast and throw a CCE after the package
|
||||
// object was loaded. I have replaced with a variation that should work
|
||||
// in whatever cases that was working but fail less exceptionally for
|
||||
// those not intentionally using it.
|
||||
@deprecated("this value is going to be removed in a future release", "2.8.0")
|
||||
val ActorGC = scala.actors.Scheduler.impl match {
|
||||
case x: scala.actors.scheduler.ActorGC => x
|
||||
case _ => null
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,10 +81,6 @@ object RemoteActor {
|
|||
kern
|
||||
}
|
||||
|
||||
@deprecated("this member is going to be removed in a future release", "2.8.0")
|
||||
def createKernelOnPort(port: Int): NetKernel =
|
||||
createNetKernelOnPort(port)
|
||||
|
||||
/**
|
||||
* Registers <code>a</code> under <code>name</code> on this
|
||||
* node.
|
||||
|
@ -120,10 +116,6 @@ object RemoteActor {
|
|||
|
||||
private[remote] def someNetKernel: NetKernel =
|
||||
kernels.valuesIterator.next
|
||||
|
||||
@deprecated("this member is going to be removed in a future release", "2.8.0")
|
||||
def someKernel: NetKernel =
|
||||
someNetKernel
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -238,7 +238,7 @@ class Function(val i: Int) extends Group("Function") with Arity {
|
|||
curryComment +
|
||||
" def curried: %s => R = {\n %s\n }\n".format(
|
||||
targs mkString " => ", body
|
||||
) + """ @deprecated("Use `curried` instead", "2.8.0")""" + "\n def curry = curried\n"
|
||||
)
|
||||
}
|
||||
|
||||
override def moreMethods = curryMethod + tupleMethod
|
||||
|
|
|
@ -122,9 +122,6 @@ object ByteCodecs {
|
|||
dst
|
||||
}
|
||||
|
||||
@deprecated("use 2-argument version instead", "2.8.0")
|
||||
def decode7to8(src: Array[Byte], srclen: Int, dstlen: Int) { decode7to8(src, srclen) }
|
||||
|
||||
def decode7to8(src: Array[Byte], srclen: Int): Int = {
|
||||
var i = 0
|
||||
var j = 0
|
||||
|
@ -193,9 +190,6 @@ object ByteCodecs {
|
|||
|
||||
def encode(xs: Array[Byte]): Array[Byte] = avoidZero(encode8to7(xs))
|
||||
|
||||
@deprecated("use 1-argument version instead", "2.8.0")
|
||||
def decode(xs: Array[Byte], dstlen: Int) { decode(xs) }
|
||||
|
||||
/**
|
||||
* Destructively decodes array xs and returns the length of the decoded array.
|
||||
*
|
||||
|
|
|
@ -230,7 +230,7 @@ object Array extends FallbackArrayBuilding {
|
|||
*
|
||||
* Note that this means that `elem` is computed a total of n times:
|
||||
* {{{
|
||||
* scala> Array.fill(3){ java.lang.Math.random }
|
||||
* scala> Array.fill(3){ math.random }
|
||||
* res3: Array[Double] = Array(0.365461167592537, 1.550395944913685E-4, 0.7907242137333306)
|
||||
* }}}
|
||||
*
|
||||
|
@ -423,65 +423,6 @@ object Array extends FallbackArrayBuilding {
|
|||
if (x == null) None else Some(x.toIndexedSeq)
|
||||
// !!! the null check should to be necessary, but without it 2241 fails. Seems to be a bug
|
||||
// in pattern matcher. @PP: I noted in #4364 I think the behavior is correct.
|
||||
|
||||
/** Creates an array containing several copies of an element.
|
||||
*
|
||||
* @param n the length of the resulting array
|
||||
* @param elem the element composing the resulting array
|
||||
* @return an array composed of n elements all equal to elem
|
||||
*/
|
||||
@deprecated("use `Array.fill` instead", "2.8.0")
|
||||
def make[T: ClassManifest](n: Int, elem: T): Array[T] = {
|
||||
val a = new Array[T](n)
|
||||
var i = 0
|
||||
while (i < n) {
|
||||
a(i) = elem
|
||||
i += 1
|
||||
}
|
||||
a
|
||||
}
|
||||
|
||||
/** Creates an array containing the values of a given function `f`
|
||||
* over given range `[0..n)`
|
||||
*/
|
||||
@deprecated("use `Array.tabulate` instead", "2.8.0")
|
||||
def fromFunction[T: ClassManifest](f: Int => T)(n: Int): Array[T] = {
|
||||
val a = new Array[T](n)
|
||||
var i = 0
|
||||
while (i < n) {
|
||||
a(i) = f(i)
|
||||
i += 1
|
||||
}
|
||||
a
|
||||
}
|
||||
|
||||
/** Creates an array containing the values of a given function `f`
|
||||
* over given range `[0..n1, 0..n2)`
|
||||
*/
|
||||
@deprecated("use `Array.tabulate` instead", "2.8.0")
|
||||
def fromFunction[T: ClassManifest](f: (Int, Int) => T)(n1: Int, n2: Int): Array[Array[T]] =
|
||||
fromFunction(i => fromFunction(f(i, _))(n2))(n1)
|
||||
|
||||
/** Creates an array containing the values of a given function `f`
|
||||
* over given range `[0..n1, 0..n2, 0..n3)`
|
||||
*/
|
||||
@deprecated("use `Array.tabulate` instead", "2.8.0")
|
||||
def fromFunction[T: ClassManifest](f: (Int, Int, Int) => T)(n1: Int, n2: Int, n3: Int): Array[Array[Array[T]]] =
|
||||
fromFunction(i => fromFunction(f(i, _, _))(n2, n3))(n1)
|
||||
|
||||
/** Creates an array containing the values of a given function `f`
|
||||
* over given range `[0..n1, 0..n2, 0..n3, 0..n4)`
|
||||
*/
|
||||
@deprecated("use `Array.tabulate` instead", "2.8.0")
|
||||
def fromFunction[T: ClassManifest](f: (Int, Int, Int, Int) => T)(n1: Int, n2: Int, n3: Int, n4: Int): Array[Array[Array[Array[T]]]] =
|
||||
fromFunction(i => fromFunction(f(i, _, _, _))(n2, n3, n4))(n1)
|
||||
|
||||
/** Creates an array containing the values of a given function `f`
|
||||
* over given range `[0..n1, 0..n2, 0..n3, 0..n4, 0..n5)`
|
||||
*/
|
||||
@deprecated("use `Array.tabulate` instead", "2.8.0")
|
||||
def fromFunction[T: ClassManifest](f: (Int, Int, Int, Int, Int) => T)(n1: Int, n2: Int, n3: Int, n4: Int, n5: Int): Array[Array[Array[Array[Array[T]]]]] =
|
||||
fromFunction(i => fromFunction(f(i, _, _, _, _))(n2, n3, n4, n5))(n1)
|
||||
}
|
||||
|
||||
/** Arrays are mutable, indexed collections of values. `Array[T]` is Scala's representation
|
||||
|
@ -529,38 +470,6 @@ object Array extends FallbackArrayBuilding {
|
|||
*/
|
||||
final class Array[T](_length: Int) extends java.io.Serializable with java.lang.Cloneable {
|
||||
|
||||
/** Multidimensional array creation */
|
||||
@deprecated("use `Array.ofDim` instead", "2.8.0")
|
||||
def this(dim1: Int, dim2: Int) = this(dim1)
|
||||
|
||||
/** Multidimensional array creation */
|
||||
@deprecated("use `Array.ofDim` instead", "2.8.0")
|
||||
def this(dim1: Int, dim2: Int, dim3: Int) = this(dim1)
|
||||
|
||||
/** Multidimensional array creation */
|
||||
@deprecated("use `Array.ofDim` instead", "2.8.0")
|
||||
def this(dim1: Int, dim2: Int, dim3: Int, dim4: Int) = this(dim1)
|
||||
|
||||
/** Multidimensional array creation */
|
||||
@deprecated("use `Array.ofDim` instead", "2.8.0")
|
||||
def this(dim1: Int, dim2: Int, dim3: Int, dim4: Int, dim5: Int) = this(dim1)
|
||||
|
||||
/** Multidimensional array creation */
|
||||
@deprecated("use `Array.ofDim` instead", "2.8.0")
|
||||
def this(dim1: Int, dim2: Int, dim3: Int, dim4: Int, dim5: Int, dim6: Int) = this(dim1)
|
||||
|
||||
/** Multidimensional array creation */
|
||||
@deprecated("use `Array.ofDim` instead", "2.8.0")
|
||||
def this(dim1: Int, dim2: Int, dim3: Int, dim4: Int, dim5: Int, dim6: Int, dim7: Int) = this(dim1)
|
||||
|
||||
/** Multidimensional array creation */
|
||||
@deprecated("use `Array.ofDim` instead", "2.8.0")
|
||||
def this(dim1: Int, dim2: Int, dim3: Int, dim4: Int, dim5: Int, dim6: Int, dim7: Int, dim8: Int) = this(dim1)
|
||||
|
||||
/** Multidimensional array creation */
|
||||
@deprecated("use `Array.ofDim` instead", "2.8.0")
|
||||
def this(dim1: Int, dim2: Int, dim3: Int, dim4: Int, dim5: Int, dim6: Int, dim7: Int, dim8: Int, dim9: Int) = this(dim1)
|
||||
|
||||
/** The length of the array */
|
||||
def length: Int = throw new Error()
|
||||
|
||||
|
|
|
@ -17,17 +17,93 @@ package scala
|
|||
* which provides useful non-primitive operations.
|
||||
*/
|
||||
final class Boolean extends AnyVal {
|
||||
/**
|
||||
* Negates a Boolean expression.
|
||||
*
|
||||
* - `!a` results in `false` if and only if `a` evaluates to `true` and
|
||||
* - `!a` results in `true` if and only if `a` evaluates to `false`.
|
||||
*
|
||||
* @return the negated expression
|
||||
*/
|
||||
def unary_! : Boolean = sys.error("stub")
|
||||
|
||||
/**
|
||||
* Compares two Boolean expressions and returns `true` if they evaluate to the same value.
|
||||
*
|
||||
* `a == b` returns `true` if and only if
|
||||
* - `a` and `b` are `true` or
|
||||
* - `a` and `b` are `false`.
|
||||
*/
|
||||
def ==(x: Boolean): Boolean = sys.error("stub")
|
||||
|
||||
/**
|
||||
* Compares two Boolean expressions and returns `true` if they evaluate to a different value.
|
||||
*
|
||||
* `a != b` returns `true` if and only if
|
||||
* - `a` is `true` and `b` is `false` or
|
||||
* - `a` is `false` and `b` is `true`.
|
||||
*/
|
||||
def !=(x: Boolean): Boolean = sys.error("stub")
|
||||
|
||||
/**
|
||||
* Compares two Boolean expressions and returns `true` if one or both of them evaluate to true.
|
||||
*
|
||||
* `a || b` returns `true` if and only if
|
||||
* - `a` is `true` or
|
||||
* - `b` is `true` or
|
||||
* - `a` and `b` are `true`.
|
||||
*
|
||||
* @note This method uses 'short-circuit' evaluation and
|
||||
* behaves as if it was declared as `def ||(x: => Boolean): Boolean`.
|
||||
* If `a` evaluates to `true`, `true` is returned without evaluating `b`.
|
||||
*/
|
||||
def ||(x: Boolean): Boolean = sys.error("stub")
|
||||
|
||||
/**
|
||||
* Compares two Boolean expressions and returns `true` if both of them evaluate to true.
|
||||
*
|
||||
* `a && b` returns `true` if and only if
|
||||
* - `a` and `b` are `true`.
|
||||
*
|
||||
* @note This method uses 'short-circuit' evaluation and
|
||||
* behaves as if it was declared as `def &&(x: => Boolean): Boolean`.
|
||||
* If `a` evaluates to `false`, `false` is returned without evaluating `b`.
|
||||
*/
|
||||
def &&(x: Boolean): Boolean = sys.error("stub")
|
||||
|
||||
// Compiler won't build with these seemingly more accurate signatures
|
||||
// def ||(x: => Boolean): Boolean = sys.error("stub")
|
||||
// def &&(x: => Boolean): Boolean = sys.error("stub")
|
||||
|
||||
/**
|
||||
* Compares two Boolean expressions and returns `true` if one or both of them evaluate to true.
|
||||
*
|
||||
* `a | b` returns `true` if and only if
|
||||
* - `a` is `true` or
|
||||
* - `b` is `true` or
|
||||
* - `a` and `b` are `true`.
|
||||
*
|
||||
* @note This method evaluates both `a` and `b`, even if the result is already determined after evaluating `a`.
|
||||
*/
|
||||
def |(x: Boolean): Boolean = sys.error("stub")
|
||||
|
||||
/**
|
||||
* Compares two Boolean expressions and returns `true` if both of them evaluate to true.
|
||||
*
|
||||
* `a & b` returns `true` if and only if
|
||||
* - `a` and `b` are `true`.
|
||||
*
|
||||
* @note This method evaluates both `a` and `b`, even if the result is already determined after evaluating `a`.
|
||||
*/
|
||||
def &(x: Boolean): Boolean = sys.error("stub")
|
||||
|
||||
/**
|
||||
* Compares two Boolean expressions and returns `true` if they evaluate to a different value.
|
||||
*
|
||||
* `a ^ b` returns `true` if and only if
|
||||
* - `a` is `true` and `b` is `false` or
|
||||
* - `a` is `false` and `b` is `true`.
|
||||
*/
|
||||
def ^(x: Boolean): Boolean = sys.error("stub")
|
||||
|
||||
def getClass(): Class[Boolean] = sys.error("stub")
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
/* __ *\
|
||||
** ________ ___ / / ___ Scala API **
|
||||
** / __/ __// _ | / / / _ | (c) 2003-2011, LAMP/EPFL **
|
||||
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
|
||||
** /____/\___/_/ |_/____/_/ | | **
|
||||
** |/ **
|
||||
\* */
|
||||
|
||||
|
||||
|
||||
package scala
|
||||
|
||||
/** A `Cell` is a generic wrapper which completely
|
||||
* hides the functionality of the wrapped object. The wrapped
|
||||
* object is accessible via the `elem` accessor method.
|
||||
*
|
||||
* @author Martin Odersky
|
||||
* @version 1.0, 08/08/2003
|
||||
*/
|
||||
@deprecated("use `scala.Option` or `scala.Some` instead", "2.9.0")
|
||||
case class Cell[+T](elem: T)
|
|
@ -1,24 +0,0 @@
|
|||
/* __ *\
|
||||
** ________ ___ / / ___ Scala API **
|
||||
** / __/ __// _ | / / / _ | (c) 2003-2011, LAMP/EPFL **
|
||||
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
|
||||
** /____/\___/_/ |_/____/_/ | | **
|
||||
** |/ **
|
||||
\* */
|
||||
|
||||
|
||||
|
||||
package scala
|
||||
|
||||
/** Counted iterators keep track of the number of elements seen so far
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
@deprecated("use iterator.zipWithIndex instead", "2.8.0")
|
||||
trait CountedIterator[+A] extends Iterator[A] {
|
||||
/** counts the elements in this iterator; counts start at 0
|
||||
*/
|
||||
def count: Int
|
||||
|
||||
override def counted : this.type = this
|
||||
}
|
|
@ -310,24 +310,6 @@ object Either {
|
|||
}
|
||||
}
|
||||
|
||||
@deprecated("use `x.joinLeft'", "2.8.0")
|
||||
def joinLeft[A, B](es: Either[Either[A, B], B]) =
|
||||
es.left.flatMap(x => x)
|
||||
|
||||
@deprecated("use `x.joinRight'", "2.8.0")
|
||||
def joinRight[A, B](es: Either[A, Either[A, B]]) =
|
||||
es.right.flatMap(x => x)
|
||||
|
||||
/**
|
||||
* Takes an `Either` to its contained value within `Left` or
|
||||
* `Right`.
|
||||
*/
|
||||
@deprecated("use `x.merge'", "2.8.0")
|
||||
def merge[T](e: Either[T, T]) = e match {
|
||||
case Left(t) => t
|
||||
case Right(t) => t
|
||||
}
|
||||
|
||||
/** If the condition satisfies, return the given `A` in `Left`,
|
||||
* otherwise, return the given `B` in `Right`.
|
||||
*/
|
||||
|
|
|
@ -45,41 +45,6 @@ object Function {
|
|||
override def lift: T => Option[R] = f
|
||||
}
|
||||
|
||||
/** Currying for functions of arity 2. This transforms a function
|
||||
* of arity 2 into a a unary function returning another unary function.
|
||||
*
|
||||
* @param f ...
|
||||
* @return ...
|
||||
*/
|
||||
@deprecated("Use `f.curried` instead", "2.8.0")
|
||||
def curried[a1, a2, b](f: (a1, a2) => b): a1 => a2 => b = {
|
||||
x1 => x2 => f(x1, x2)
|
||||
}
|
||||
|
||||
/** Currying for functions of arity 3.
|
||||
*
|
||||
* @param f ...
|
||||
* @return ...
|
||||
*/
|
||||
@deprecated("Use `f.curried` instead", "2.8.0")
|
||||
def curried[a1, a2, a3, b](f: (a1, a2, a3) => b): a1 => a2 => a3 => b = {
|
||||
x1 => x2 => x3 => f(x1, x2, x3)
|
||||
}
|
||||
|
||||
/** Currying for functions of arity 4.
|
||||
*/
|
||||
@deprecated("Use `f.curried` instead", "2.8.0")
|
||||
def curried[a1, a2, a3, a4, b](f: (a1, a2, a3, a4) => b): a1 => a2 => a3 => a4 => b = {
|
||||
x1 => x2 => x3 => x4 => f(x1, x2, x3, x4)
|
||||
}
|
||||
|
||||
/** Currying for functions of arity 5.
|
||||
*/
|
||||
@deprecated("Use `f.curried` instead", "2.8.0")
|
||||
def curried[a1, a2, a3, a4, a5, b](f: (a1, a2, a3, a4, a5) => b): a1 => a2 => a3 => a4 => a5 => b = {
|
||||
x1 => x2 => x3 => x4 => x5 => f(x1, x2, x3, x4, x5)
|
||||
}
|
||||
|
||||
/** Uncurrying for functions of arity 2. This transforms a unary function
|
||||
* returning another unary function into a function of arity 2.
|
||||
*/
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
** |/ **
|
||||
\* */
|
||||
// GENERATED CODE: DO NOT EDIT.
|
||||
// genprod generated these sources at: Thu Apr 14 13:08:25 PDT 2011
|
||||
// genprod generated these sources at: Sun Jul 31 00:37:30 CEST 2011
|
||||
|
||||
package scala
|
||||
|
||||
|
|
|
@ -26,8 +26,6 @@ trait Function10[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, +R] extends
|
|||
def curried: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => T9 => T10 => R = {
|
||||
(x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10)).curried
|
||||
}
|
||||
@deprecated("Use 'curried' instead", "2.8.0")
|
||||
def curry = curried
|
||||
|
||||
/** Creates a tupled version of this function: instead of 10 arguments,
|
||||
* it accepts a single [[scala.Tuple10]] argument.
|
||||
|
|
|
@ -26,8 +26,6 @@ trait Function11[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, +R] ex
|
|||
def curried: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => T9 => T10 => T11 => R = {
|
||||
(x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10, x11: T11) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11)).curried
|
||||
}
|
||||
@deprecated("Use 'curried' instead", "2.8.0")
|
||||
def curry = curried
|
||||
|
||||
/** Creates a tupled version of this function: instead of 11 arguments,
|
||||
* it accepts a single [[scala.Tuple11]] argument.
|
||||
|
|
|
@ -26,8 +26,6 @@ trait Function12[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12,
|
|||
def curried: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => T9 => T10 => T11 => T12 => R = {
|
||||
(x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10, x11: T11, x12: T12) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12)).curried
|
||||
}
|
||||
@deprecated("Use 'curried' instead", "2.8.0")
|
||||
def curry = curried
|
||||
|
||||
/** Creates a tupled version of this function: instead of 12 arguments,
|
||||
* it accepts a single [[scala.Tuple12]] argument.
|
||||
|
|
|
@ -26,8 +26,6 @@ trait Function13[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12,
|
|||
def curried: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => T9 => T10 => T11 => T12 => T13 => R = {
|
||||
(x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10, x11: T11, x12: T12, x13: T13) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13)).curried
|
||||
}
|
||||
@deprecated("Use 'curried' instead", "2.8.0")
|
||||
def curry = curried
|
||||
|
||||
/** Creates a tupled version of this function: instead of 13 arguments,
|
||||
* it accepts a single [[scala.Tuple13]] argument.
|
||||
|
|
|
@ -26,8 +26,6 @@ trait Function14[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12,
|
|||
def curried: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => T9 => T10 => T11 => T12 => T13 => T14 => R = {
|
||||
(x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10, x11: T11, x12: T12, x13: T13, x14: T14) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14)).curried
|
||||
}
|
||||
@deprecated("Use 'curried' instead", "2.8.0")
|
||||
def curry = curried
|
||||
|
||||
/** Creates a tupled version of this function: instead of 14 arguments,
|
||||
* it accepts a single [[scala.Tuple14]] argument.
|
||||
|
|
|
@ -26,8 +26,6 @@ trait Function15[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12,
|
|||
def curried: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => T9 => T10 => T11 => T12 => T13 => T14 => T15 => R = {
|
||||
(x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10, x11: T11, x12: T12, x13: T13, x14: T14, x15: T15) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15)).curried
|
||||
}
|
||||
@deprecated("Use 'curried' instead", "2.8.0")
|
||||
def curry = curried
|
||||
|
||||
/** Creates a tupled version of this function: instead of 15 arguments,
|
||||
* it accepts a single [[scala.Tuple15]] argument.
|
||||
|
|
|
@ -26,8 +26,6 @@ trait Function16[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12,
|
|||
def curried: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => T9 => T10 => T11 => T12 => T13 => T14 => T15 => T16 => R = {
|
||||
(x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10, x11: T11, x12: T12, x13: T13, x14: T14, x15: T15, x16: T16) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16)).curried
|
||||
}
|
||||
@deprecated("Use 'curried' instead", "2.8.0")
|
||||
def curry = curried
|
||||
|
||||
/** Creates a tupled version of this function: instead of 16 arguments,
|
||||
* it accepts a single [[scala.Tuple16]] argument.
|
||||
|
|
|
@ -26,8 +26,6 @@ trait Function17[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12,
|
|||
def curried: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => T9 => T10 => T11 => T12 => T13 => T14 => T15 => T16 => T17 => R = {
|
||||
(x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10, x11: T11, x12: T12, x13: T13, x14: T14, x15: T15, x16: T16, x17: T17) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17)).curried
|
||||
}
|
||||
@deprecated("Use 'curried' instead", "2.8.0")
|
||||
def curry = curried
|
||||
|
||||
/** Creates a tupled version of this function: instead of 17 arguments,
|
||||
* it accepts a single [[scala.Tuple17]] argument.
|
||||
|
|
|
@ -26,8 +26,6 @@ trait Function18[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12,
|
|||
def curried: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => T9 => T10 => T11 => T12 => T13 => T14 => T15 => T16 => T17 => T18 => R = {
|
||||
(x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10, x11: T11, x12: T12, x13: T13, x14: T14, x15: T15, x16: T16, x17: T17, x18: T18) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18)).curried
|
||||
}
|
||||
@deprecated("Use 'curried' instead", "2.8.0")
|
||||
def curry = curried
|
||||
|
||||
/** Creates a tupled version of this function: instead of 18 arguments,
|
||||
* it accepts a single [[scala.Tuple18]] argument.
|
||||
|
|
|
@ -26,8 +26,6 @@ trait Function19[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12,
|
|||
def curried: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => T9 => T10 => T11 => T12 => T13 => T14 => T15 => T16 => T17 => T18 => T19 => R = {
|
||||
(x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10, x11: T11, x12: T12, x13: T13, x14: T14, x15: T15, x16: T16, x17: T17, x18: T18, x19: T19) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19)).curried
|
||||
}
|
||||
@deprecated("Use 'curried' instead", "2.8.0")
|
||||
def curry = curried
|
||||
|
||||
/** Creates a tupled version of this function: instead of 19 arguments,
|
||||
* it accepts a single [[scala.Tuple19]] argument.
|
||||
|
|
|
@ -39,8 +39,6 @@ trait Function2[@specialized(scala.Int, scala.Long, scala.Double) -T1, @speciali
|
|||
def curried: T1 => T2 => R = {
|
||||
(x1: T1) => (x2: T2) => apply(x1, x2)
|
||||
}
|
||||
@deprecated("Use 'curried' instead", "2.8.0")
|
||||
def curry = curried
|
||||
|
||||
/** Creates a tupled version of this function: instead of 2 arguments,
|
||||
* it accepts a single [[scala.Tuple2]] argument.
|
||||
|
|
|
@ -26,8 +26,6 @@ trait Function20[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12,
|
|||
def curried: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => T9 => T10 => T11 => T12 => T13 => T14 => T15 => T16 => T17 => T18 => T19 => T20 => R = {
|
||||
(x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10, x11: T11, x12: T12, x13: T13, x14: T14, x15: T15, x16: T16, x17: T17, x18: T18, x19: T19, x20: T20) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20)).curried
|
||||
}
|
||||
@deprecated("Use 'curried' instead", "2.8.0")
|
||||
def curry = curried
|
||||
|
||||
/** Creates a tupled version of this function: instead of 20 arguments,
|
||||
* it accepts a single [[scala.Tuple20]] argument.
|
||||
|
|
|
@ -26,8 +26,6 @@ trait Function21[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12,
|
|||
def curried: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => T9 => T10 => T11 => T12 => T13 => T14 => T15 => T16 => T17 => T18 => T19 => T20 => T21 => R = {
|
||||
(x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10, x11: T11, x12: T12, x13: T13, x14: T14, x15: T15, x16: T16, x17: T17, x18: T18, x19: T19, x20: T20, x21: T21) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20, x21)).curried
|
||||
}
|
||||
@deprecated("Use 'curried' instead", "2.8.0")
|
||||
def curry = curried
|
||||
|
||||
/** Creates a tupled version of this function: instead of 21 arguments,
|
||||
* it accepts a single [[scala.Tuple21]] argument.
|
||||
|
|
|
@ -26,8 +26,6 @@ trait Function22[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12,
|
|||
def curried: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => T9 => T10 => T11 => T12 => T13 => T14 => T15 => T16 => T17 => T18 => T19 => T20 => T21 => T22 => R = {
|
||||
(x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10, x11: T11, x12: T12, x13: T13, x14: T14, x15: T15, x16: T16, x17: T17, x18: T18, x19: T19, x20: T20, x21: T21, x22: T22) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20, x21, x22)).curried
|
||||
}
|
||||
@deprecated("Use 'curried' instead", "2.8.0")
|
||||
def curry = curried
|
||||
|
||||
/** Creates a tupled version of this function: instead of 22 arguments,
|
||||
* it accepts a single [[scala.Tuple22]] argument.
|
||||
|
|
|
@ -26,8 +26,6 @@ trait Function3[-T1, -T2, -T3, +R] extends AnyRef { self =>
|
|||
def curried: T1 => T2 => T3 => R = {
|
||||
(x1: T1) => (x2: T2) => (x3: T3) => apply(x1, x2, x3)
|
||||
}
|
||||
@deprecated("Use 'curried' instead", "2.8.0")
|
||||
def curry = curried
|
||||
|
||||
/** Creates a tupled version of this function: instead of 3 arguments,
|
||||
* it accepts a single [[scala.Tuple3]] argument.
|
||||
|
|
|
@ -26,8 +26,6 @@ trait Function4[-T1, -T2, -T3, -T4, +R] extends AnyRef { self =>
|
|||
def curried: T1 => T2 => T3 => T4 => R = {
|
||||
(x1: T1) => (x2: T2) => (x3: T3) => (x4: T4) => apply(x1, x2, x3, x4)
|
||||
}
|
||||
@deprecated("Use 'curried' instead", "2.8.0")
|
||||
def curry = curried
|
||||
|
||||
/** Creates a tupled version of this function: instead of 4 arguments,
|
||||
* it accepts a single [[scala.Tuple4]] argument.
|
||||
|
|
|
@ -26,8 +26,6 @@ trait Function5[-T1, -T2, -T3, -T4, -T5, +R] extends AnyRef { self =>
|
|||
def curried: T1 => T2 => T3 => T4 => T5 => R = {
|
||||
(x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5) => self.apply(x1, x2, x3, x4, x5)).curried
|
||||
}
|
||||
@deprecated("Use 'curried' instead", "2.8.0")
|
||||
def curry = curried
|
||||
|
||||
/** Creates a tupled version of this function: instead of 5 arguments,
|
||||
* it accepts a single [[scala.Tuple5]] argument.
|
||||
|
|
|
@ -26,8 +26,6 @@ trait Function6[-T1, -T2, -T3, -T4, -T5, -T6, +R] extends AnyRef { self =>
|
|||
def curried: T1 => T2 => T3 => T4 => T5 => T6 => R = {
|
||||
(x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6) => self.apply(x1, x2, x3, x4, x5, x6)).curried
|
||||
}
|
||||
@deprecated("Use 'curried' instead", "2.8.0")
|
||||
def curry = curried
|
||||
|
||||
/** Creates a tupled version of this function: instead of 6 arguments,
|
||||
* it accepts a single [[scala.Tuple6]] argument.
|
||||
|
|
|
@ -26,8 +26,6 @@ trait Function7[-T1, -T2, -T3, -T4, -T5, -T6, -T7, +R] extends AnyRef { self =>
|
|||
def curried: T1 => T2 => T3 => T4 => T5 => T6 => T7 => R = {
|
||||
(x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7) => self.apply(x1, x2, x3, x4, x5, x6, x7)).curried
|
||||
}
|
||||
@deprecated("Use 'curried' instead", "2.8.0")
|
||||
def curry = curried
|
||||
|
||||
/** Creates a tupled version of this function: instead of 7 arguments,
|
||||
* it accepts a single [[scala.Tuple7]] argument.
|
||||
|
|
|
@ -26,8 +26,6 @@ trait Function8[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, +R] extends AnyRef { sel
|
|||
def curried: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => R = {
|
||||
(x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8)).curried
|
||||
}
|
||||
@deprecated("Use 'curried' instead", "2.8.0")
|
||||
def curry = curried
|
||||
|
||||
/** Creates a tupled version of this function: instead of 8 arguments,
|
||||
* it accepts a single [[scala.Tuple8]] argument.
|
||||
|
|
|
@ -26,8 +26,6 @@ trait Function9[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, +R] extends AnyRef
|
|||
def curried: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => T9 => R = {
|
||||
(x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8, x9)).curried
|
||||
}
|
||||
@deprecated("Use 'curried' instead", "2.8.0")
|
||||
def curry = curried
|
||||
|
||||
/** Creates a tupled version of this function: instead of 9 arguments,
|
||||
* it accepts a single [[scala.Tuple9]] argument.
|
||||
|
|
|
@ -1,95 +0,0 @@
|
|||
/* __ *\
|
||||
** ________ ___ / / ___ Scala API **
|
||||
** / __/ __// _ | / / / _ | (c) 2002-2011, LAMP/EPFL **
|
||||
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
|
||||
** /____/\___/_/ |_/____/_/ | | **
|
||||
** |/ **
|
||||
\* */
|
||||
|
||||
|
||||
package scala
|
||||
|
||||
/** The object `Math` contains methods for performing basic numeric
|
||||
* operations such as the elementary exponential, logarithm, square root,
|
||||
* and trigonometric functions.
|
||||
*/
|
||||
@deprecated("use the scala.math package object instead.\n(Example package object usage: scala.math.Pi )", "2.8.0")
|
||||
object Math extends MathCommon {
|
||||
@deprecated("Use `scala.Byte.MinValue` instead", "2.8.0")
|
||||
val MIN_BYTE = java.lang.Byte.MIN_VALUE
|
||||
|
||||
@deprecated("Use `scala.Byte.MaxValue` instead", "2.8.0")
|
||||
val MAX_BYTE = java.lang.Byte.MAX_VALUE
|
||||
|
||||
@deprecated("Use `scala.Short.MinValue` instead", "2.8.0")
|
||||
val MIN_SHORT = java.lang.Short.MIN_VALUE
|
||||
|
||||
@deprecated("Use `scala.Short.MaxValue` instead", "2.8.0")
|
||||
val MAX_SHORT = java.lang.Short.MAX_VALUE
|
||||
|
||||
@deprecated("Use `scala.Char.MinValue` instead", "2.8.0")
|
||||
val MIN_CHAR = java.lang.Character.MIN_VALUE
|
||||
|
||||
@deprecated("Use `scala.Char.MaxValue` instead", "2.8.0")
|
||||
val MAX_CHAR = java.lang.Character.MAX_VALUE
|
||||
|
||||
@deprecated("Use `scala.Int.MinValue` instead", "2.8.0")
|
||||
val MIN_INT = java.lang.Integer.MIN_VALUE
|
||||
|
||||
@deprecated("Use `scala.Int.MaxValue` instead", "2.8.0")
|
||||
val MAX_INT = java.lang.Integer.MAX_VALUE
|
||||
|
||||
@deprecated("Use `scala.Long.MinValue` instead", "2.8.0")
|
||||
val MIN_LONG = java.lang.Long.MIN_VALUE
|
||||
|
||||
@deprecated("Use `scala.Long.MaxValue` instead", "2.8.0")
|
||||
val MAX_LONG = java.lang.Long.MAX_VALUE
|
||||
|
||||
/** The smallest possible value for [[scala.Float]]. */
|
||||
@deprecated("Use `scala.Float.MinValue` instead", "2.8.0")
|
||||
val MIN_FLOAT = -java.lang.Float.MAX_VALUE
|
||||
|
||||
/** The smallest difference between two values of [[scala.Float]]. */
|
||||
@deprecated("Use `scala.Float.MinPositiveValue` instead", "2.8.0")
|
||||
val EPS_FLOAT = java.lang.Float.MIN_VALUE
|
||||
|
||||
/** The greatest possible value for [[scala.Float]]. */
|
||||
@deprecated("Use `scala.Float.MaxValue` instead", "2.8.0")
|
||||
val MAX_FLOAT = java.lang.Float.MAX_VALUE
|
||||
|
||||
/** A value of type [[scala.Float]] that represents no number. */
|
||||
@deprecated("Use `scala.Float.NaN` instead", "2.8.0")
|
||||
val NaN_FLOAT = java.lang.Float.NaN
|
||||
|
||||
/** Negative infinity of type [[scala.Float]]. */
|
||||
@deprecated("Use `scala.Float.NegativeInfinity` instead", "2.8.0")
|
||||
val NEG_INF_FLOAT = java.lang.Float.NEGATIVE_INFINITY
|
||||
|
||||
/** Positive infinity of type [[scala.Float]]. */
|
||||
@deprecated("Use `scala.Float.PositiveInfinity` instead", "2.8.0")
|
||||
val POS_INF_FLOAT = java.lang.Float.POSITIVE_INFINITY
|
||||
|
||||
/** The smallest possible value for [[scala.Double]]. */
|
||||
@deprecated("Use `scala.Double.MinValue` instead", "2.8.0")
|
||||
val MIN_DOUBLE = -java.lang.Double.MAX_VALUE
|
||||
|
||||
/** The smallest difference between two values of [[scala.Double]]. */
|
||||
@deprecated("Use `scala.Double.MinPositiveValue` instead", "2.8.0")
|
||||
val EPS_DOUBLE = java.lang.Double.MIN_VALUE
|
||||
|
||||
/** The greatest possible value for [[scala.Double]]. */
|
||||
@deprecated("Use `scala.Double.MaxValue` instead", "2.8.0")
|
||||
val MAX_DOUBLE = java.lang.Double.MAX_VALUE
|
||||
|
||||
/** A value of type [[scala.Double]] that represents no number. */
|
||||
@deprecated("Use `scala.Double.NaN` instead", "2.8.0")
|
||||
val NaN_DOUBLE = java.lang.Double.NaN
|
||||
|
||||
/** Negative infinity of type [[scala.Double]]. */
|
||||
@deprecated("Use `scala.Double.NegativeInfinity` instead", "2.8.0")
|
||||
val NEG_INF_DOUBLE = java.lang.Double.NEGATIVE_INFINITY
|
||||
|
||||
/** Positive infinity of type [[scala.Double]]. */
|
||||
@deprecated("Use `scala.Double.PositiveInfinity` instead", "2.8.0")
|
||||
val POS_INF_DOUBLE = java.lang.Double.POSITIVE_INFINITY
|
||||
}
|
|
@ -1,139 +0,0 @@
|
|||
/* __ *\
|
||||
** ________ ___ / / ___ Scala API **
|
||||
** / __/ __// _ | / / / _ | (c) 2002-2011, LAMP/EPFL **
|
||||
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
|
||||
** /____/\___/_/ |_/____/_/ | | **
|
||||
** |/ **
|
||||
\* */
|
||||
|
||||
|
||||
package scala
|
||||
|
||||
/** Common code between the deprecated `scala.Math` object and
|
||||
* the `scala.math` package object.
|
||||
*/
|
||||
private[scala] class MathCommon {
|
||||
/** The `double` value that is closer than any other to `e`, the base of
|
||||
* the natural logarithms.
|
||||
*/
|
||||
val E = java.lang.Math.E
|
||||
|
||||
/** The `double` value that is closer than any other to `pi`, the ratio of
|
||||
* the circumference of a circle to its diameter.
|
||||
*/
|
||||
val Pi = java.lang.Math.PI
|
||||
|
||||
/** Returns a `double` value with a positive sign, greater than or equal
|
||||
* to `0.0` and less than `1.0`.
|
||||
*/
|
||||
def random: Double = java.lang.Math.random()
|
||||
|
||||
def sin(x: Double): Double = java.lang.Math.sin(x)
|
||||
def cos(x: Double): Double = java.lang.Math.cos(x)
|
||||
def tan(x: Double): Double = java.lang.Math.tan(x)
|
||||
def asin(x: Double): Double = java.lang.Math.asin(x)
|
||||
def acos(x: Double): Double = java.lang.Math.acos(x)
|
||||
def atan(x: Double): Double = java.lang.Math.atan(x)
|
||||
|
||||
/** Converts an angle measured in degrees to an approximately equivalent
|
||||
* angle measured in radians.
|
||||
*
|
||||
* @param x an angle, in degrees
|
||||
* @return the measurement of the angle `x` in radians.
|
||||
*/
|
||||
def toRadians(x: Double): Double = java.lang.Math.toRadians(x)
|
||||
|
||||
/** Converts an angle measured in radians to an approximately equivalent
|
||||
* angle measured in degrees.
|
||||
*
|
||||
* @param x angle, in radians
|
||||
* @return the measurement of the angle `x` in degrees.
|
||||
*/
|
||||
def toDegrees(x: Double): Double = java.lang.Math.toDegrees(x)
|
||||
|
||||
/** Returns Euler's number `e` raised to the power of a `double` value.
|
||||
*
|
||||
* @param x the exponent to raise `e` to.
|
||||
* @return the value `e^a^`, where `e` is the base of the natural
|
||||
* logarithms.
|
||||
*/
|
||||
def exp(x: Double): Double = java.lang.Math.exp(x)
|
||||
def log(x: Double): Double = java.lang.Math.log(x)
|
||||
def sqrt(x: Double): Double = java.lang.Math.sqrt(x)
|
||||
def IEEEremainder(x: Double, y: Double): Double = java.lang.Math.IEEEremainder(x, y)
|
||||
|
||||
def ceil(x: Double): Double = java.lang.Math.ceil(x)
|
||||
def floor(x: Double): Double = java.lang.Math.floor(x)
|
||||
|
||||
/** Returns the `double` value that is closest in value to the
|
||||
* argument and is equal to a mathematical integer.
|
||||
*
|
||||
* @param x a `double` value
|
||||
* @return the closest floating-point value to a that is equal to a
|
||||
* mathematical integer.
|
||||
*/
|
||||
def rint(x: Double): Double = java.lang.Math.rint(x)
|
||||
|
||||
/** Converts rectangular coordinates `(x, y)` to polar `(r, theta)`.
|
||||
*
|
||||
* @param x the ordinate coordinate
|
||||
* @param y the abscissa coordinate
|
||||
* @return the ''theta'' component of the point `(r, theta)` in polar
|
||||
* coordinates that corresponds to the point `(x, y)` in
|
||||
* Cartesian coordinates.
|
||||
*/
|
||||
def atan2(y: Double, x: Double): Double = java.lang.Math.atan2(y, x)
|
||||
|
||||
/** Returns the value of the first argument raised to the power of the
|
||||
* second argument.
|
||||
*
|
||||
* @param x the base.
|
||||
* @param y the exponent.
|
||||
* @return the value `x^y^`.
|
||||
*/
|
||||
def pow(x: Double, y: Double): Double = java.lang.Math.pow(x, y)
|
||||
|
||||
/** Returns the closest `long` to the argument.
|
||||
*
|
||||
* @param x a floating-point value to be rounded to a `long`.
|
||||
* @return the value of the argument rounded to the nearest`long` value.
|
||||
*/
|
||||
def round(x: Float): Int = java.lang.Math.round(x)
|
||||
def round(x: Double): Long = java.lang.Math.round(x)
|
||||
def abs(x: Int): Int = java.lang.Math.abs(x)
|
||||
def abs(x: Long): Long = java.lang.Math.abs(x)
|
||||
def abs(x: Float): Float = java.lang.Math.abs(x)
|
||||
def abs(x: Double): Double = java.lang.Math.abs(x)
|
||||
|
||||
def max(x: Int, y: Int): Int = java.lang.Math.max(x, y)
|
||||
def max(x: Long, y: Long): Long = java.lang.Math.max(x, y)
|
||||
def max(x: Float, y: Float): Float = java.lang.Math.max(x, y)
|
||||
def max(x: Double, y: Double): Double = java.lang.Math.max(x, y)
|
||||
|
||||
def min(x: Int, y: Int): Int = java.lang.Math.min(x, y)
|
||||
def min(x: Long, y: Long): Long = java.lang.Math.min(x, y)
|
||||
def min(x: Float, y: Float): Float = java.lang.Math.min(x, y)
|
||||
def min(x: Double, y: Double): Double = java.lang.Math.min(x, y)
|
||||
|
||||
def signum(x: Double): Double =
|
||||
if (x == 0d) 0d
|
||||
else if (x < 0) -1.0
|
||||
else if (x > 0) 1.0
|
||||
else x // NaN
|
||||
|
||||
def signum(x: Float): Float =
|
||||
if (x == 0f) 0f
|
||||
else if (x < 0) -1.0f
|
||||
else if (x > 0) 1.0f
|
||||
else x // NaN
|
||||
|
||||
def signum(x: Long): Long =
|
||||
if (x == 0l) 0l
|
||||
else if (x < 0) -1l
|
||||
else 1l
|
||||
|
||||
def signum(x: Int): Int =
|
||||
if (x == 0) 0
|
||||
else if (x < 0) -1
|
||||
else 1
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
/* __ *\
|
||||
** ________ ___ / / ___ Scala API **
|
||||
** / __/ __// _ | / / / _ | (c) 2002-2011, LAMP/EPFL **
|
||||
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
|
||||
** /____/\___/_/ |_/____/_/ | | **
|
||||
** |/ **
|
||||
\* */
|
||||
|
||||
|
||||
|
||||
package scala
|
||||
|
||||
/**
|
||||
* @since 2.0
|
||||
*/
|
||||
@deprecated("Use a custom Error class instead", "2.8.0")
|
||||
final class NotDefinedError(msg: String) extends Error("not defined: " + msg)
|
|
@ -42,9 +42,6 @@ trait Product extends Equals {
|
|||
def next() = { val result = productElement(c); c += 1; result }
|
||||
}
|
||||
|
||||
@deprecated("use productIterator instead", "2.8.0")
|
||||
def productElements: Iterator[Any] = productIterator
|
||||
|
||||
/** A string used in the `toString` methods of derived classes.
|
||||
* Implementations may override this method to prepend a string prefix
|
||||
* to the result of `toString` methods.
|
||||
|
|
|
@ -13,11 +13,8 @@ package scala
|
|||
/** This class implements errors which are thrown whenever a
|
||||
* field is used before it has been initialized.
|
||||
*
|
||||
* Such runtime checks are not emitted by default. See the
|
||||
* compiler documentation for knowing how to turn them on.
|
||||
*
|
||||
* Note: This check requires the initialization order
|
||||
* first implemented in scala 2.8.
|
||||
* Such runtime checks are not emitted by default.
|
||||
* They can be enabled by the `-Xcheckinit` compiler option.
|
||||
*
|
||||
* @since 2.7
|
||||
*/
|
||||
|
|
|
@ -48,15 +48,4 @@ object Iterable extends TraversableFactory[Iterable] {
|
|||
implicit def canBuildFrom[A]: CanBuildFrom[Coll, A, Iterable[A]] = ReusableCBF.asInstanceOf[GenericCanBuildFrom[A]]
|
||||
|
||||
def newBuilder[A]: Builder[A, Iterable[A]] = immutable.Iterable.newBuilder[A]
|
||||
|
||||
/** The minimum element of a non-empty sequence of ordered elements */
|
||||
@deprecated("use <seq>.min instead, where <seq> is the sequence for which you want to compute the minimum", "2.8.0")
|
||||
def min[A](seq: Iterable[A])(implicit ord: Ordering[A]): A = seq.min
|
||||
|
||||
/** The maximum element of a non-empty sequence of ordered elements */
|
||||
@deprecated("use <seq>.max instead, where <seq> is the sequence for which you want to compute the maximum", "2.8.0")
|
||||
def max[A](seq: Iterable[A])(implicit ord: Ordering[A]): A = seq.max
|
||||
|
||||
@deprecated("use View instead", "2.8.0")
|
||||
type Projection[A] = IterableView[A, Coll]
|
||||
}
|
||||
|
|
|
@ -298,23 +298,4 @@ self =>
|
|||
}
|
||||
|
||||
override /*TraversableLike*/ def view(from: Int, until: Int) = view.slice(from, until)
|
||||
|
||||
@deprecated("use `iterator` instead", "2.8.0")
|
||||
def elements = iterator
|
||||
|
||||
@deprecated("use `head` instead", "2.8.0")
|
||||
def first: A = head
|
||||
|
||||
/** `None` if iterable is empty.
|
||||
*/
|
||||
@deprecated("use `headOption` instead", "2.8.0")
|
||||
def firstOption: Option[A] = headOption
|
||||
|
||||
/**
|
||||
* returns a projection that can be used to call non-strict `filter`,
|
||||
* `map`, and `flatMap` methods that build projections
|
||||
* of the collection.
|
||||
*/
|
||||
@deprecated("use `view` instead", "2.8.0")
|
||||
def projection = view
|
||||
}
|
||||
|
|
|
@ -149,86 +149,6 @@ object Iterator {
|
|||
def hasNext = true
|
||||
def next = elem
|
||||
}
|
||||
|
||||
@deprecated("use `xs.iterator` or `Iterator(xs)` instead", "2.8.0")
|
||||
def fromValues[a](xs: a*) = xs.iterator
|
||||
|
||||
/** @param xs the array of elements
|
||||
* @see also: IndexedSeq.iterator and slice
|
||||
*/
|
||||
@deprecated("use `xs.iterator` instead", "2.8.0")
|
||||
def fromArray[a](xs: Array[a]): Iterator[a] =
|
||||
fromArray(xs, 0, xs.length)
|
||||
|
||||
/**
|
||||
* @param xs the array of elements
|
||||
* @param start the start index
|
||||
* @param length the length
|
||||
* @see also: IndexedSeq.iterator and slice
|
||||
*/
|
||||
@deprecated("use `xs.slice(start, start + length).iterator` instead", "2.8.0")
|
||||
def fromArray[a](xs: Array[a], start: Int, length: Int): Iterator[a] =
|
||||
xs.slice(start, start + length).iterator
|
||||
|
||||
/**
|
||||
* @param n the product arity
|
||||
* @return the iterator on `Product<n>`.
|
||||
*/
|
||||
@deprecated("use `product.productIterator instead`", "2.8.0")
|
||||
def fromProduct(n: Product): Iterator[Any] = new Iterator[Any] {
|
||||
private var c: Int = 0
|
||||
private val cmax = n.productArity
|
||||
def hasNext = c < cmax
|
||||
def next() = { val a = n productElement c; c += 1; a }
|
||||
}
|
||||
|
||||
/** Create an iterator with elements `e<sub>n+1</sub> = step(e<sub>n</sub>)` where `e<sub>0</sub> = start`
|
||||
* and elements are in the range between `start` (inclusive) and `end` (exclusive).
|
||||
*
|
||||
* @param start the start value of the iterator
|
||||
* @param end the end value of the iterator
|
||||
* @param step the increment function of the iterator, must be monotonically increasing or decreasing
|
||||
* @return the iterator with values in range `[start;end)`.
|
||||
*/
|
||||
@deprecated("use `Iterator.iterate(start, end - start)(step)` instead", "2.8.0")
|
||||
def range(start: Int, end: Int, step: Int => Int) = new Iterator[Int] {
|
||||
private val up = step(start) > start
|
||||
private val down = step(start) < start
|
||||
private var i = start
|
||||
def hasNext: Boolean = (!up || i < end) && (!down || i > end)
|
||||
def next(): Int =
|
||||
if (hasNext) { val j = i; i = step(i); j }
|
||||
else empty.next()
|
||||
}
|
||||
|
||||
/** Create an iterator with elements `e<sub>n+1</sub> = step(e<sub>n</sub>)` where `e<sub>0</sub> = start`.
|
||||
*
|
||||
* @param start the start value of the iterator
|
||||
* @param step the increment function of the iterator
|
||||
* @return the iterator starting at value `start`.
|
||||
*/
|
||||
@deprecated("use `iterate(start)(step)` instead", "2.8.0")
|
||||
def from(start: Int, step: Int => Int): Iterator[Int] = new Iterator[Int] {
|
||||
private var i = start
|
||||
override def hasNext: Boolean = true
|
||||
def next(): Int = { val j = i; i = step(i); j }
|
||||
}
|
||||
|
||||
/** Create an iterator that is the concatenation of all iterators returned by a given iterator of iterators.
|
||||
*
|
||||
* @param its The iterator which returns on each call to next
|
||||
* a new iterator whose elements are to be concatenated to the result.
|
||||
*/
|
||||
@deprecated("use `its.flatten` instead", "2.8.0")
|
||||
def flatten[T](its: Iterator[Iterator[T]]): Iterator[T] = new Iterator[T] {
|
||||
private var cur = its.next
|
||||
def hasNext: Boolean = {
|
||||
while (!cur.hasNext && its.hasNext) cur = its.next
|
||||
cur.hasNext
|
||||
}
|
||||
def next(): T =
|
||||
(if (hasNext) cur else empty).next()
|
||||
}
|
||||
}
|
||||
|
||||
import Iterator.empty
|
||||
|
@ -1030,52 +950,4 @@ trait Iterator[+A] extends TraversableOnce[A] {
|
|||
* whether or not the iterator is empty.
|
||||
*/
|
||||
override def toString = (if (hasNext) "non-empty" else "empty")+" iterator"
|
||||
|
||||
/** Returns a new iterator that first yields the elements of this
|
||||
* iterator followed by the elements provided by iterator `that`.
|
||||
*/
|
||||
@deprecated("use `++`", "2.3.2")
|
||||
def append[B >: A](that: Iterator[B]) = self ++ that
|
||||
|
||||
/** Returns index of the first element satisfying a predicate, or -1. */
|
||||
@deprecated("use `indexWhere` instead", "2.8.0")
|
||||
def findIndexOf(p: A => Boolean): Int = indexWhere(p)
|
||||
|
||||
/** Returns a counted iterator from this iterator.
|
||||
*/
|
||||
@deprecated("use `zipWithIndex` in `Iterator`", "2.8.0")
|
||||
def counted = new CountedIterator[A] {
|
||||
private var cnt = 0
|
||||
def count = cnt
|
||||
def hasNext: Boolean = self.hasNext
|
||||
def next(): A = { cnt += 1; self.next }
|
||||
}
|
||||
|
||||
/** Fills the given array `xs` with the elements of
|
||||
* this sequence starting at position `start`. Like `copyToArray`,
|
||||
* but designed to accomodate IO stream operations.
|
||||
*
|
||||
* '''Note:''' the array must be large enough to hold `sz` elements.
|
||||
* @param xs the array to fill.
|
||||
* @param start the starting index.
|
||||
* @param sz the maximum number of elements to be read.
|
||||
*/
|
||||
@deprecated("use `copyToArray` instead", "2.8.0")
|
||||
def readInto[B >: A](xs: Array[B], start: Int, sz: Int) {
|
||||
var i = start
|
||||
while (hasNext && i - start < sz) {
|
||||
xs(i) = next
|
||||
i += 1
|
||||
}
|
||||
}
|
||||
|
||||
@deprecated("use `copyToArray` instead", "2.8.0")
|
||||
def readInto[B >: A](xs: Array[B], start: Int) {
|
||||
readInto(xs, start, xs.length - start)
|
||||
}
|
||||
|
||||
@deprecated("use copyToArray instead", "2.8.0")
|
||||
def readInto[B >: A](xs: Array[B]) {
|
||||
readInto(xs, 0, xs.length)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,9 +73,6 @@ object JavaConversions {
|
|||
case _ => IteratorWrapper(i)
|
||||
}
|
||||
|
||||
@deprecated("use asJavaIterator instead", "2.8.1")
|
||||
def asIterator[A](i : Iterator[A]): ju.Iterator[A] = asJavaIterator[A](i)
|
||||
|
||||
/**
|
||||
* Implicitly converts a Scala Iterator to a Java Enumeration.
|
||||
* The returned Java Enumeration is backed by the provided Scala
|
||||
|
@ -94,9 +91,6 @@ object JavaConversions {
|
|||
case _ => IteratorWrapper(i)
|
||||
}
|
||||
|
||||
@deprecated("use asJavaEnmeration instead", "2.8.1")
|
||||
def asEnumeration[A](i : Iterator[A]): ju.Enumeration[A] = asJavaEnumeration[A](i)
|
||||
|
||||
/**
|
||||
* Implicitly converts a Scala Iterable to a Java Iterable.
|
||||
* The returned Java Iterable is backed by the provided Scala
|
||||
|
@ -115,9 +109,6 @@ object JavaConversions {
|
|||
case _ => IterableWrapper(i)
|
||||
}
|
||||
|
||||
@deprecated("use asJavaIterable instead", "2.8.1")
|
||||
def asIterable[A](i : Iterable[A]): jl.Iterable[A] = asJavaIterable[A](i)
|
||||
|
||||
/**
|
||||
* Implicitly converts a Scala Iterable to an immutable Java
|
||||
* Collection.
|
||||
|
@ -134,9 +125,6 @@ object JavaConversions {
|
|||
case _ => new IterableWrapper(i)
|
||||
}
|
||||
|
||||
@deprecated("use asJavaCollection instead", "2.8.1")
|
||||
def asCollection[A](i : Iterable[A]): ju.Collection[A] = asJavaCollection[A](i)
|
||||
|
||||
/**
|
||||
* Implicitly converts a Scala mutable Buffer to a Java List.
|
||||
* The returned Java List is backed by the provided Scala
|
||||
|
@ -156,8 +144,6 @@ object JavaConversions {
|
|||
}
|
||||
@deprecated("use bufferAsJavaList instead", "2.9.0")
|
||||
def asJavaList[A](b : mutable.Buffer[A]): ju.List[A] = bufferAsJavaList[A](b)
|
||||
@deprecated("use bufferAsJavaList instead", "2.8.1")
|
||||
def asList[A](b : mutable.Buffer[A]): ju.List[A] = bufferAsJavaList[A](b)
|
||||
|
||||
/**
|
||||
* Implicitly converts a Scala mutable Seq to a Java List.
|
||||
|
@ -178,8 +164,6 @@ object JavaConversions {
|
|||
}
|
||||
@deprecated("use mutableSeqAsJavaList instead", "2.9.0")
|
||||
def asJavaList[A](b : mutable.Seq[A]): ju.List[A] = mutableSeqAsJavaList[A](b)
|
||||
@deprecated("use mutableSeqAsJavaList instead", "2.8.1")
|
||||
def asList[A](b : mutable.Seq[A]): ju.List[A] = mutableSeqAsJavaList[A](b)
|
||||
|
||||
/**
|
||||
* Implicitly converts a Scala Seq to a Java List.
|
||||
|
@ -201,8 +185,6 @@ object JavaConversions {
|
|||
|
||||
@deprecated("use seqAsJavaList instead", "2.9.0")
|
||||
def asJavaList[A](b : Seq[A]): ju.List[A] = seqAsJavaList[A](b)
|
||||
@deprecated("use seqAsJavaList instead", "2.8.1")
|
||||
def asList[A](b : Seq[A]): ju.List[A] = seqAsJavaList[A](b)
|
||||
|
||||
/**
|
||||
* Implicitly converts a Scala mutable Set to a Java Set.
|
||||
|
@ -224,8 +206,6 @@ object JavaConversions {
|
|||
|
||||
@deprecated("use mutableSetAsJavaSet instead", "2.9.0")
|
||||
def asJavaSet[A](s : mutable.Set[A]): ju.Set[A] = mutableSetAsJavaSet[A](s)
|
||||
@deprecated("use mutableSetAsJavaSet instead", "2.8.1")
|
||||
def asSet[A](s : mutable.Set[A]): ju.Set[A] = mutableSetAsJavaSet[A](s)
|
||||
|
||||
/**
|
||||
* Implicitly converts a Scala Set to a Java Set.
|
||||
|
@ -247,8 +227,6 @@ object JavaConversions {
|
|||
|
||||
@deprecated("use setAsJavaSet instead", "2.9.0")
|
||||
def asJavaSet[A](s: Set[A]): ju.Set[A] = setAsJavaSet[A](s)
|
||||
@deprecated("use setAsJavaSet instead", "2.8.1")
|
||||
def asSet[A](s : Set[A]): ju.Set[A] = setAsJavaSet[A](s)
|
||||
|
||||
/**
|
||||
* Implicitly converts a Scala mutable Map to a Java Map.
|
||||
|
@ -271,8 +249,6 @@ object JavaConversions {
|
|||
|
||||
@deprecated("use mutableMapAsJavaMap instead", "2.9.0")
|
||||
def asJavaMap[A, B](m : mutable.Map[A, B]): ju.Map[A, B] = mutableMapAsJavaMap[A, B](m)
|
||||
@deprecated("use mutableMapAsJavaMap instead", "2.8.1")
|
||||
def asMap[A, B](m : mutable.Map[A, B]): ju.Map[A, B] = mutableMapAsJavaMap[A, B](m)
|
||||
|
||||
/**
|
||||
* Implicitly converts a Scala mutable `Map` to a Java `Dictionary`.
|
||||
|
@ -294,9 +270,6 @@ object JavaConversions {
|
|||
case _ => new DictionaryWrapper(m)
|
||||
}
|
||||
|
||||
@deprecated("use asJavaDictionary instead", "2.8.1")
|
||||
def asDictionary[A, B](m : mutable.Map[A, B]): ju.Dictionary[A, B] = asJavaDictionary[A, B](m)
|
||||
|
||||
/**
|
||||
* Implicitly converts a Scala `Map` to a Java `Map`.
|
||||
*
|
||||
|
@ -319,8 +292,6 @@ object JavaConversions {
|
|||
|
||||
@deprecated("use mapAsJavaMap instead", "2.9.0")
|
||||
def asJavaMap[A, B](m : Map[A, B]): ju.Map[A, B] = mapAsJavaMap[A, B](m)
|
||||
@deprecated("use mapAsJavaMap instead", "2.8.1")
|
||||
def asMap[A, B](m : Map[A, B]): ju.Map[A, B] = mapAsJavaMap[A, B](m)
|
||||
|
||||
/**
|
||||
* Implicitly converts a Scala mutable `ConcurrentMap` to a Java
|
||||
|
@ -342,9 +313,6 @@ object JavaConversions {
|
|||
case _ => new ConcurrentMapWrapper(m)
|
||||
}
|
||||
|
||||
@deprecated("use asJavaConcurrentMap instead", "2.8.1")
|
||||
def asConcurrentMap[A, B](m: mutable.ConcurrentMap[A, B]): juc.ConcurrentMap[A, B] = asJavaConcurrentMap[A, B](m)
|
||||
|
||||
// Java => Scala
|
||||
|
||||
/**
|
||||
|
@ -366,9 +334,6 @@ object JavaConversions {
|
|||
case _ => JIteratorWrapper(i)
|
||||
}
|
||||
|
||||
@deprecated("use asScalaIterator instead", "2.8.1")
|
||||
def asIterator[A](i : ju.Iterator[A]): Iterator[A] = asScalaIterator[A](i)
|
||||
|
||||
/**
|
||||
* Implicitly converts a Java Enumeration to a Scala Iterator.
|
||||
* The returned Scala Iterator is backed by the provided Java
|
||||
|
@ -387,9 +352,6 @@ object JavaConversions {
|
|||
case _ => JEnumerationWrapper(i)
|
||||
}
|
||||
|
||||
@deprecated("use enumerationAsScalaIterator instead", "2.8.1")
|
||||
def asIterator[A](i : ju.Enumeration[A]): Iterator[A] = enumerationAsScalaIterator[A](i)
|
||||
|
||||
/**
|
||||
* Implicitly converts a Java `Iterable` to a Scala `Iterable`.
|
||||
*
|
||||
|
@ -411,8 +373,6 @@ object JavaConversions {
|
|||
|
||||
@deprecated("use iterableAsScalaIterable instead", "2.9.0")
|
||||
def asScalaIterable[A](i : jl.Iterable[A]): Iterable[A] = iterableAsScalaIterable[A](i)
|
||||
@deprecated("use iterableAsScalaIterable instead", "2.8.1")
|
||||
def asIterable[A](i : jl.Iterable[A]): Iterable[A] = iterableAsScalaIterable[A](i)
|
||||
|
||||
/**
|
||||
* Implicitly converts a Java `Collection` to an Scala `Iterable`.
|
||||
|
@ -430,8 +390,6 @@ object JavaConversions {
|
|||
}
|
||||
@deprecated("use collectionAsScalaIterable instead", "2.9.0")
|
||||
def asScalaIterable[A](i : ju.Collection[A]): Iterable[A] = collectionAsScalaIterable[A](i)
|
||||
@deprecated("use collectionAsScalaIterable instead", "2.8.1")
|
||||
def asIterable[A](i : ju.Collection[A]): Iterable[A] = collectionAsScalaIterable[A](i)
|
||||
|
||||
/**
|
||||
* Implicitly converts a Java `List` to a Scala mutable `Buffer`.
|
||||
|
@ -452,9 +410,6 @@ object JavaConversions {
|
|||
case _ =>new JListWrapper(l)
|
||||
}
|
||||
|
||||
@deprecated("use asScalaBuffer instead", "2.8.1")
|
||||
def asBuffer[A](l : ju.List[A]): mutable.Buffer[A] = asScalaBuffer[A](l)
|
||||
|
||||
/**
|
||||
* Implicitly converts a Java Set to a Scala mutable Set.
|
||||
* The returned Scala Set is backed by the provided Java
|
||||
|
@ -473,9 +428,6 @@ object JavaConversions {
|
|||
case _ =>new JSetWrapper(s)
|
||||
}
|
||||
|
||||
@deprecated("use asScalaSet instead", "2.8.1")
|
||||
def asSet[A](s : ju.Set[A]): mutable.Set[A] = asScalaSet[A](s)
|
||||
|
||||
/**
|
||||
* Implicitly converts a Java `Map` to a Scala mutable `Map`.
|
||||
*
|
||||
|
@ -498,8 +450,6 @@ object JavaConversions {
|
|||
|
||||
@deprecated("use mapAsScalaMap instead", "2.9.0")
|
||||
def asScalaMap[A, B](m : ju.Map[A, B]): mutable.Map[A, B] = mapAsScalaMap[A, B](m)
|
||||
@deprecated("use mapAsScalaMap instead", "2.8.1")
|
||||
def asMap[A, B](m : ju.Map[A, B]): mutable.Map[A, B] = mapAsScalaMap[A, B](m)
|
||||
|
||||
/**
|
||||
* Implicitly converts a Java ConcurrentMap to a Scala mutable ConcurrentMap.
|
||||
|
@ -519,9 +469,6 @@ object JavaConversions {
|
|||
case _ => new JConcurrentMapWrapper(m)
|
||||
}
|
||||
|
||||
@deprecated("use asScalaConcurrentMap instead", "2.8.1")
|
||||
def asConcurrentMap[A, B](m: juc.ConcurrentMap[A, B]): mutable.ConcurrentMap[A, B] = asScalaConcurrentMap[A, B](m)
|
||||
|
||||
/**
|
||||
* Implicitly converts a Java `Dictionary` to a Scala mutable
|
||||
* `Map[String, String]`.
|
||||
|
@ -538,9 +485,6 @@ object JavaConversions {
|
|||
case _ => new JDictionaryWrapper(p)
|
||||
}
|
||||
|
||||
@deprecated("use dictionaryAsScalaMap instead", "2.8.1")
|
||||
def asMap[A, B](p: ju.Dictionary[A, B]): mutable.Map[A, B] = dictionaryAsScalaMap[A, B](p)
|
||||
|
||||
/**
|
||||
* Implicitly converts a Java `Properties` to a Scala `mutable Map[String, String]`.
|
||||
*
|
||||
|
@ -557,8 +501,6 @@ object JavaConversions {
|
|||
|
||||
@deprecated("use propertiesAsScalaMap instead", "2.9.0")
|
||||
def asScalaMap(p: ju.Properties): mutable.Map[String, String] = propertiesAsScalaMap(p)
|
||||
@deprecated("use propertiesAsScalaMap instead", "2.8.1")
|
||||
def asMap(p: ju.Properties): mutable.Map[String, String] = propertiesAsScalaMap(p)
|
||||
|
||||
// Private implementations (shared by JavaConverters) ...
|
||||
|
||||
|
|
|
@ -246,9 +246,6 @@ self =>
|
|||
def get(key: A) = self.get(key).map(f)
|
||||
}
|
||||
|
||||
@deprecated("use `mapValues` instead", "2.8.0")
|
||||
def mapElements[C](f: B => C) = mapValues(f)
|
||||
|
||||
// The following 5 operations (updated, two times +, two times ++) should really be
|
||||
// generic, returning This[B]. We need better covariance support to express that though.
|
||||
// So right now we do the brute force approach of code duplication.
|
||||
|
|
|
@ -39,11 +39,5 @@ object Seq extends SeqFactory[Seq] {
|
|||
implicit def canBuildFrom[A]: CanBuildFrom[Coll, A, Seq[A]] = ReusableCBF.asInstanceOf[GenericCanBuildFrom[A]]
|
||||
|
||||
def newBuilder[A]: Builder[A, Seq[A]] = immutable.Seq.newBuilder[A]
|
||||
|
||||
@deprecated("use View instead", "2.8.0")
|
||||
type Projection[A] = SeqView[A, Coll]
|
||||
|
||||
@deprecated("use Seq(value) instead", "2.8.0")
|
||||
def singleton[A](value: A) = Seq(value)
|
||||
}
|
||||
|
||||
|
|
|
@ -118,11 +118,6 @@ trait SeqLike[+A, +Repr] extends IterableLike[A, Repr] with GenSeqLike[A, Repr]
|
|||
-1
|
||||
}
|
||||
|
||||
/** Returns index of the first element satisfying a predicate, or `-1`.
|
||||
*/
|
||||
@deprecated("Use indexWhere(p) instead.", "2.8.0")
|
||||
def findIndexOf(p: A => Boolean): Int = indexWhere(p)
|
||||
|
||||
def lastIndexWhere(p: A => Boolean, end: Int): Int = {
|
||||
var i = length - 1
|
||||
val it = reverseIterator
|
||||
|
@ -290,9 +285,6 @@ trait SeqLike[+A, +Repr] extends IterableLike[A, Repr] with GenSeqLike[A, Repr]
|
|||
*/
|
||||
def reverseIterator: Iterator[A] = toCollection(reverse).iterator
|
||||
|
||||
@deprecated("use `reverseIterator` instead", "2.8.0")
|
||||
def reversedElements = reverseIterator
|
||||
|
||||
def startsWith[B](that: GenSeq[B], offset: Int): Boolean = {
|
||||
val i = this.iterator drop offset
|
||||
val j = that.iterator
|
||||
|
@ -678,31 +670,6 @@ trait SeqLike[+A, +Repr] extends IterableLike[A, Repr] with GenSeqLike[A, Repr]
|
|||
/* Need to override string, so that it's not the Function1's string that gets mixed in.
|
||||
*/
|
||||
override def toString = super[IterableLike].toString
|
||||
|
||||
/** Returns index of the last element satisfying a predicate, or -1.
|
||||
*/
|
||||
@deprecated("use `lastIndexWhere` instead", "2.8.0")
|
||||
def findLastIndexOf(p: A => Boolean): Int = lastIndexWhere(p)
|
||||
|
||||
/** Tests whether every element of this $coll relates to the
|
||||
* corresponding element of another sequence by satisfying a test predicate.
|
||||
*
|
||||
* @param that the other sequence
|
||||
* @param p the test predicate, which relates elements from both sequences
|
||||
* @tparam B the type of the elements of `that`
|
||||
* @return `true` if both sequences have the same length and
|
||||
* `p(x, y)` is `true` for all corresponding elements `x` of this $coll
|
||||
* and `y` of `that`, otherwise `false`.
|
||||
*/
|
||||
@deprecated("use `corresponds` instead", "2.8.0")
|
||||
def equalsWith[B](that: Seq[B])(f: (A,B) => Boolean): Boolean = corresponds(that)(f)
|
||||
|
||||
/**
|
||||
* returns a projection that can be used to call non-strict `filter`,
|
||||
* `map`, and `flatMap` methods that build projections of the collection.
|
||||
*/
|
||||
@deprecated("use `view` instead", "2.8.0")
|
||||
override def projection = view
|
||||
}
|
||||
|
||||
/** The companion object for trait `SeqLike`.
|
||||
|
|
|
@ -33,7 +33,6 @@ trait SeqProxyLike[+A, +Repr <: SeqLike[A, Repr] with Seq[A]] extends SeqLike[A,
|
|||
override def prefixLength(p: A => Boolean) = self.prefixLength(p)
|
||||
override def indexWhere(p: A => Boolean): Int = self.indexWhere(p)
|
||||
override def indexWhere(p: A => Boolean, from: Int): Int = self.indexWhere(p, from)
|
||||
override def findIndexOf(p: A => Boolean): Int = self.indexWhere(p)
|
||||
override def indexOf[B >: A](elem: B): Int = self.indexOf(elem)
|
||||
override def indexOf[B >: A](elem: B, from: Int): Int = self.indexOf(elem, from)
|
||||
override def lastIndexOf[B >: A](elem: B): Int = self.lastIndexOf(elem)
|
||||
|
|
|
@ -144,15 +144,6 @@ self =>
|
|||
*/
|
||||
override def isEmpty: Boolean = size == 0
|
||||
|
||||
/** This method is an alias for `intersect`.
|
||||
* It computes an intersection with set `that`.
|
||||
* It removes all the elements that are not present in `that`.
|
||||
*
|
||||
* @param that the set to intersect with
|
||||
*/
|
||||
@deprecated("use & instead", "2.8.0")
|
||||
def ** (that: Set[A]): This = &(that)
|
||||
|
||||
/** Computes the union between of set and another set.
|
||||
*
|
||||
* @param that the set to form the union with.
|
||||
|
|
|
@ -24,8 +24,6 @@ object TraversableView {
|
|||
class NoBuilder[A] extends Builder[A, Nothing] {
|
||||
def +=(elem: A): this.type = this
|
||||
def iterator: Iterator[A] = Iterator.empty
|
||||
@deprecated("use `iterator` instead", "2.8.0")
|
||||
def elements = iterator
|
||||
def result() = throw new UnsupportedOperationException("TraversableView.Builder.result")
|
||||
def clear() {}
|
||||
}
|
||||
|
|
|
@ -1,61 +0,0 @@
|
|||
/* __ *\
|
||||
** ________ ___ / / ___ Scala API **
|
||||
** / __/ __// _ | / / / _ | (c) 2003-2011, LAMP/EPFL **
|
||||
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
|
||||
** /____/\___/_/ |_/____/_/ | | **
|
||||
** |/ **
|
||||
\* */
|
||||
|
||||
|
||||
package scala.collection
|
||||
package generic
|
||||
|
||||
import annotation.bridge
|
||||
|
||||
/** This trait represents collection-like objects that can be added to
|
||||
* using a '+' operator. It defines variants of `+` and `++`
|
||||
* as convenience methods in terms of single-element addition `+`.
|
||||
* @tparam A the type of the elements of the $coll
|
||||
* @tparam Repr the type of the $coll itself
|
||||
* @author Martin Odersky
|
||||
* @version 2.8
|
||||
* @since 2.8
|
||||
* @define coll collection
|
||||
* @define Coll Addable
|
||||
*/
|
||||
@deprecated("Will be removed after scala 2.9", "2.8.0")
|
||||
trait Addable[A, +Repr <: Addable[A, Repr]] { self =>
|
||||
|
||||
/** The representation object of type `Repr` which contains the collection's elements
|
||||
*/
|
||||
protected def repr: Repr
|
||||
|
||||
/** Creates a new $coll with an additional element, unless the element is already present.
|
||||
* @param elem the element to add
|
||||
* @return a fresh collection with `elem` added.
|
||||
*/
|
||||
def +(elem: A): Repr
|
||||
|
||||
/** Creates a new $coll with additional elements.
|
||||
*
|
||||
* This method takes two or more elements to be added. Another overloaded
|
||||
* variant of this method handles the case where a single element is
|
||||
* added.
|
||||
* @param elem1 the first element to add.
|
||||
* @param elem2 the second element to add.
|
||||
* @param elems the remaining elements to add.
|
||||
* @return a new $coll with the given elements added.
|
||||
*/
|
||||
def + (elem1: A, elem2: A, elems: A*): Repr =
|
||||
this + elem1 + elem2 ++ elems
|
||||
|
||||
/** Creates a new $coll by adding all elements contained in another collection to this $coll.
|
||||
*
|
||||
* @param elems the collection containing the added elements.
|
||||
* @return a new $coll with the given elements added.
|
||||
*/
|
||||
def ++ (xs: GenTraversableOnce[A]): Repr = (repr /: xs.seq) (_ + _)
|
||||
|
||||
@bridge
|
||||
def ++ (xs: TraversableOnce[A]): Repr = ++ (xs: GenTraversableOnce[A])
|
||||
}
|
|
@ -35,7 +35,6 @@ trait SeqForwarder[+A] extends Seq[A] with IterableForwarder[A] {
|
|||
override def prefixLength(p: A => Boolean) = underlying prefixLength p
|
||||
override def indexWhere(p: A => Boolean): Int = underlying indexWhere p
|
||||
override def indexWhere(p: A => Boolean, from: Int): Int = underlying.indexWhere(p, from)
|
||||
override def findIndexOf(p: A => Boolean): Int = underlying indexWhere p
|
||||
override def indexOf[B >: A](elem: B): Int = underlying indexOf elem
|
||||
override def indexOf[B >: A](elem: B, from: Int): Int = underlying.indexOf(elem, from)
|
||||
override def lastIndexOf[B >: A](elem: B): Int = underlying lastIndexOf elem
|
||||
|
|
|
@ -245,114 +245,6 @@ sealed abstract class List[+A] extends LinearSeq[A]
|
|||
override def toStream : Stream[A] =
|
||||
if (isEmpty) Stream.Empty
|
||||
else new Stream.Cons(head, tail.toStream)
|
||||
|
||||
/** Like `span` but with the predicate inverted.
|
||||
*/
|
||||
@deprecated("use `span { x => !p(x) }` instead", "2.8.0")
|
||||
def break(p: A => Boolean): (List[A], List[A]) = span { x => !p(x) }
|
||||
|
||||
@deprecated("use `filterNot` instead", "2.8.0")
|
||||
def remove(p: A => Boolean): List[A] = filterNot(p)
|
||||
|
||||
/** Computes the difference between this list and the given list `that`.
|
||||
*
|
||||
* @param that the list of elements to remove from this list.
|
||||
* @return this list without the elements of the given list `that`.
|
||||
*/
|
||||
@deprecated("use `list1 filterNot (list2 contains)` instead", "2.8.0")
|
||||
def -- [B >: A](that: List[B]): List[B] = {
|
||||
val b = new ListBuffer[B]
|
||||
var these = this
|
||||
while (!these.isEmpty) {
|
||||
if (!that.contains(these.head)) b += these.head
|
||||
these = these.tail
|
||||
}
|
||||
b.toList
|
||||
}
|
||||
|
||||
/** Computes the difference between this list and the given object `x`.
|
||||
*
|
||||
* @param x the object to remove from this list.
|
||||
* @return this list without occurrences of the given object
|
||||
* `x`.
|
||||
*/
|
||||
@deprecated("use `filterNot (_ == x)` instead", "2.8.0")
|
||||
def - [B >: A](x: B): List[B] = {
|
||||
val b = new ListBuffer[B]
|
||||
var these = this
|
||||
while (!these.isEmpty) {
|
||||
if (these.head != x) b += these.head
|
||||
these = these.tail
|
||||
}
|
||||
b.toList
|
||||
}
|
||||
|
||||
@deprecated("use `distinct` instead", "2.8.0")
|
||||
def removeDuplicates: List[A] = distinct
|
||||
|
||||
@deprecated("use `sortWith` instead", "2.8.0")
|
||||
def sort(lt : (A,A) => Boolean): List[A] = {
|
||||
/** Merge two already-sorted lists */
|
||||
def merge(l1: List[A], l2: List[A]): List[A] = {
|
||||
val res = new ListBuffer[A]
|
||||
var left1 = l1
|
||||
var left2 = l2
|
||||
|
||||
while (!left1.isEmpty && !left2.isEmpty) {
|
||||
if(lt(left1.head, left2.head)) {
|
||||
res += left1.head
|
||||
left1 = left1.tail
|
||||
} else {
|
||||
res += left2.head
|
||||
left2 = left2.tail
|
||||
}
|
||||
}
|
||||
|
||||
res ++= left1
|
||||
res ++= left2
|
||||
|
||||
res.toList
|
||||
}
|
||||
|
||||
/** Split a list `lst` into two lists of about the same size */
|
||||
def split(lst: List[A]) = {
|
||||
val res1 = new ListBuffer[A]
|
||||
val res2 = new ListBuffer[A]
|
||||
var left = lst
|
||||
|
||||
while (!left.isEmpty) {
|
||||
res1 += left.head
|
||||
left = left.tail
|
||||
if (!left.isEmpty) {
|
||||
res2 += left.head
|
||||
left = left.tail
|
||||
}
|
||||
}
|
||||
|
||||
(res1.toList, res2.toList)
|
||||
}
|
||||
|
||||
/** Merge-sort the specified list */
|
||||
def ms(lst: List[A]): List[A] =
|
||||
lst match {
|
||||
case Nil => lst
|
||||
case x :: Nil => lst
|
||||
case x :: y :: Nil =>
|
||||
if (lt(x,y))
|
||||
lst
|
||||
else
|
||||
y :: x :: Nil
|
||||
|
||||
case lst =>
|
||||
val (l1, l2) = split(lst)
|
||||
val l1s = ms(l1)
|
||||
val l2s = ms(l2)
|
||||
merge(l1s, l2s)
|
||||
}
|
||||
|
||||
ms(this)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/** The empty list.
|
||||
|
@ -419,8 +311,6 @@ final case class ::[B](private var hd: B, private[scala] var tl: List[B]) extend
|
|||
*/
|
||||
object List extends SeqFactory[List] {
|
||||
|
||||
import scala.collection.{Iterable, Seq, IndexedSeq}
|
||||
|
||||
/** $genericCanBuildFromInfo */
|
||||
implicit def canBuildFrom[A]: CanBuildFrom[Coll, A, List[A]] =
|
||||
ReusableCBF.asInstanceOf[GenericCanBuildFrom[A]]
|
||||
|
@ -430,337 +320,6 @@ object List extends SeqFactory[List] {
|
|||
override def empty[A]: List[A] = Nil
|
||||
|
||||
override def apply[A](xs: A*): List[A] = xs.toList
|
||||
|
||||
/** Create a sorted list with element values `v,,>n+1,, = step(v,,n,,)`
|
||||
* where `v,,0,, = start` and elements are in the range between `start`
|
||||
* (inclusive) and `end` (exclusive).
|
||||
*
|
||||
* @param start the start value of the list
|
||||
* @param end the end value of the list
|
||||
* @param step the increment function of the list, which given `v,,n,,`,
|
||||
* computes `v,,n+1,,`. Must be monotonically increasing
|
||||
* or decreasing.
|
||||
* @return the sorted list of all integers in range `[start;end)`.
|
||||
*/
|
||||
@deprecated("use `iterate` instead", "2.8.0")
|
||||
def range(start: Int, end: Int, step: Int => Int): List[Int] = {
|
||||
val up = step(start) > start
|
||||
val down = step(start) < start
|
||||
val b = new ListBuffer[Int]
|
||||
var i = start
|
||||
while ((!up || i < end) && (!down || i > end)) {
|
||||
b += i
|
||||
val next = step(i)
|
||||
if (i == next)
|
||||
throw new IllegalArgumentException("the step function did not make any progress on "+ i)
|
||||
i = next
|
||||
}
|
||||
b.toList
|
||||
}
|
||||
|
||||
/** Create a list containing several copies of an element.
|
||||
*
|
||||
* @param n the length of the resulting list
|
||||
* @param elem the element composing the resulting list
|
||||
* @return a list composed of `n` elements all equal to `elem`
|
||||
*/
|
||||
@deprecated("use `fill` instead", "2.8.0")
|
||||
def make[A](n: Int, elem: A): List[A] = {
|
||||
val b = new ListBuffer[A]
|
||||
var i = 0
|
||||
while (i < n) {
|
||||
b += elem
|
||||
i += 1
|
||||
}
|
||||
b.toList
|
||||
}
|
||||
|
||||
/** Concatenate all the elements of a given list of lists.
|
||||
*
|
||||
* @param xss the list of lists that are to be concatenated
|
||||
* @return the concatenation of all the lists
|
||||
*/
|
||||
@deprecated("use `xss.flatten` instead of `List.flatten(xss)`", "2.8.0")
|
||||
def flatten[A](xss: List[List[A]]): List[A] = {
|
||||
val b = new ListBuffer[A]
|
||||
for (xs <- xss) {
|
||||
var xc = xs
|
||||
while (!xc.isEmpty) {
|
||||
b += xc.head
|
||||
xc = xc.tail
|
||||
}
|
||||
}
|
||||
b.toList
|
||||
}
|
||||
|
||||
/** Transforms a list of pairs into a pair of lists.
|
||||
*
|
||||
* @param xs the list of pairs to unzip
|
||||
* @return a pair of lists.
|
||||
*/
|
||||
@deprecated("use `xs.unzip` instead of `List.unzip(xs)`", "2.8.0")
|
||||
def unzip[A,B](xs: List[(A,B)]): (List[A], List[B]) = {
|
||||
val b1 = new ListBuffer[A]
|
||||
val b2 = new ListBuffer[B]
|
||||
var xc = xs
|
||||
while (!xc.isEmpty) {
|
||||
b1 += xc.head._1
|
||||
b2 += xc.head._2
|
||||
xc = xc.tail
|
||||
}
|
||||
(b1.toList, b2.toList)
|
||||
}
|
||||
|
||||
/** Transforms an iterable of pairs into a pair of lists.
|
||||
*
|
||||
* @param xs the iterable of pairs to unzip
|
||||
* @return a pair of lists.
|
||||
*/
|
||||
@deprecated("use `xs.unzip` instead of `List.unzip(xs)`", "2.8.0")
|
||||
def unzip[A,B](xs: Iterable[(A,B)]): (List[A], List[B]) =
|
||||
xs.foldRight[(List[A], List[B])]((Nil, Nil)) {
|
||||
case ((x, y), (xs, ys)) => (x :: xs, y :: ys)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the `Left` values in the given `Iterable` of `Either`s.
|
||||
*/
|
||||
@deprecated("use `xs collect { case Left(x: A) => x }` instead of `List.lefts(xs)`", "2.8.0")
|
||||
def lefts[A, B](es: Iterable[Either[A, B]]) =
|
||||
es.foldRight[List[A]](Nil)((e, as) => e match {
|
||||
case Left(a) => a :: as
|
||||
case Right(_) => as
|
||||
})
|
||||
|
||||
/**
|
||||
* Returns the `Right` values in the given `Iterable` of `Either`s.
|
||||
*/
|
||||
@deprecated("use `xs collect { case Right(x: B) => x }` instead of `List.rights(xs)`", "2.8.0")
|
||||
def rights[A, B](es: Iterable[Either[A, B]]) =
|
||||
es.foldRight[List[B]](Nil)((e, bs) => e match {
|
||||
case Left(_) => bs
|
||||
case Right(b) => b :: bs
|
||||
})
|
||||
|
||||
/** Transforms an Iterable of Eithers into a pair of lists.
|
||||
*
|
||||
* @param xs the iterable of Eithers to separate
|
||||
* @return a pair of lists.
|
||||
*/
|
||||
@deprecated("use `(for (Left(x) <- es) yield x, for (Right(x) <- es) yield x)` instead", "2.8.0")
|
||||
def separate[A,B](es: Iterable[Either[A, B]]): (List[A], List[B]) =
|
||||
es.foldRight[(List[A], List[B])]((Nil, Nil)) {
|
||||
case (Left(a), (lefts, rights)) => (a :: lefts, rights)
|
||||
case (Right(b), (lefts, rights)) => (lefts, b :: rights)
|
||||
}
|
||||
|
||||
/** Converts an iterator to a list.
|
||||
*
|
||||
* @param it the iterator to convert
|
||||
* @return a list that contains the elements returned by successive
|
||||
* calls to `it.next`
|
||||
*/
|
||||
@deprecated("use `it.toList` instead of `List.toList(it)`", "2.8.0")
|
||||
def fromIterator[A](it: Iterator[A]): List[A] = it.toList
|
||||
|
||||
/** Converts an array into a list.
|
||||
*
|
||||
* @param arr the array to convert
|
||||
* @return a list that contains the same elements than `arr`
|
||||
* in the same order
|
||||
*/
|
||||
@deprecated("use `array.toList` instead of `List.fromArray(array)`", "2.8.0")
|
||||
def fromArray[A](arr: Array[A]): List[A] = fromArray(arr, 0, arr.length)
|
||||
|
||||
/** Converts a range of an array into a list.
|
||||
*
|
||||
* @param arr the array to convert
|
||||
* @param start the first index to consider
|
||||
* @param len the length of the range to convert
|
||||
* @return a list that contains the same elements than `arr`
|
||||
* in the same order
|
||||
*/
|
||||
@deprecated("use `array.view(start, end).toList` instead of `List.fromArray(array, start, end)`", "2.8.0")
|
||||
def fromArray[A](arr: Array[A], start: Int, len: Int): List[A] = {
|
||||
var res: List[A] = Nil
|
||||
var i = start + len
|
||||
while (i > start) {
|
||||
i -= 1
|
||||
res = arr(i) :: res
|
||||
}
|
||||
res
|
||||
}
|
||||
|
||||
/** Parses a string which contains substrings separated by a
|
||||
* separator character and returns a list of all substrings.
|
||||
*
|
||||
* @param str the string to parse
|
||||
* @param separator the separator character
|
||||
* @return the list of substrings
|
||||
*/
|
||||
@deprecated("use `str.split(separator).toList` instead of `List.fromString(str, separator)`", "2.8.0")
|
||||
def fromString(str: String, separator: Char): List[String] = {
|
||||
var words: List[String] = Nil
|
||||
var pos = str.length()
|
||||
while (pos > 0) {
|
||||
val pos1 = str.lastIndexOf(separator, pos - 1)
|
||||
if (pos1 + 1 < pos)
|
||||
words = str.substring(pos1 + 1, pos) :: words
|
||||
pos = pos1
|
||||
}
|
||||
words
|
||||
}
|
||||
|
||||
/** Returns the given list of characters as a string.
|
||||
*
|
||||
* @param xs the list to convert.
|
||||
* @return the list in form of a string.
|
||||
*/
|
||||
@deprecated("use `xs.mkString` instead of `List.toString(xs)`", "2.8.0")
|
||||
def toString(xs: List[Char]): String = {
|
||||
val sb = new StringBuilder()
|
||||
var xc = xs
|
||||
while (!xc.isEmpty) {
|
||||
sb.append(xc.head)
|
||||
xc = xc.tail
|
||||
}
|
||||
sb.toString()
|
||||
}
|
||||
|
||||
/** Like xs map f, but returns `xs` unchanged if function
|
||||
* `f` maps all elements to themselves.
|
||||
*/
|
||||
@deprecated("use `xs.mapConserve(f)` instead of `List.mapConserve(xs, f)`", "2.8.0")
|
||||
def mapConserve[A <: AnyRef](xs: List[A])(f: A => A): List[A] = {
|
||||
def loop(ys: List[A]): List[A] =
|
||||
if (ys.isEmpty) xs
|
||||
else {
|
||||
val head0 = ys.head
|
||||
val head1 = f(head0)
|
||||
if (head1 eq head0) {
|
||||
loop(ys.tail)
|
||||
} else {
|
||||
val ys1 = head1 :: mapConserve(ys.tail)(f)
|
||||
if (xs eq ys) ys1
|
||||
else {
|
||||
val b = new ListBuffer[A]
|
||||
var xc = xs
|
||||
while (xc ne ys) {
|
||||
b += xc.head
|
||||
xc = xc.tail
|
||||
}
|
||||
b.prependToList(ys1)
|
||||
}
|
||||
}
|
||||
}
|
||||
loop(xs)
|
||||
}
|
||||
|
||||
/** Returns the list resulting from applying the given function `f`
|
||||
* to corresponding elements of the argument lists.
|
||||
*
|
||||
* @param f function to apply to each pair of elements.
|
||||
* @return `[f(a,,0,,,b,,0,,), ..., f(a,,n,,,b,,n,,)]` if the lists are
|
||||
* `[a,,0,,, ..., a,,k,,]`, `[b,,0,,, ..., b,,l,,]` and
|
||||
* `n = min(k,l)`
|
||||
*/
|
||||
@deprecated("use `(xs, ys).zipped.map(f)` instead of `List.map2(xs, ys)(f)`", "2.8.0")
|
||||
def map2[A,B,C](xs: List[A], ys: List[B])(f: (A, B) => C): List[C] = {
|
||||
val b = new ListBuffer[C]
|
||||
var xc = xs
|
||||
var yc = ys
|
||||
while (!xc.isEmpty && !yc.isEmpty) {
|
||||
b += f(xc.head, yc.head)
|
||||
xc = xc.tail
|
||||
yc = yc.tail
|
||||
}
|
||||
b.toList
|
||||
}
|
||||
|
||||
/** Returns the list resulting from applying the given function
|
||||
* `f` to corresponding elements of the argument lists.
|
||||
*
|
||||
* @param f function to apply to each pair of elements.
|
||||
* @return `[f(a,,0,,,b,,0,,,c,,0,,), ..., f(a,,n,,,b,,n,,,c,,n,,)]`
|
||||
* if the lists are `[a,,0,,, ..., a,,k,,]`,
|
||||
* `[b<sub>0</sub>, ..., b,,l,,]`,
|
||||
* `[c<sub>0</sub>, ..., c,,m,,]` and `n = min(k,l,m)`
|
||||
*/
|
||||
@deprecated("use `(xs, ys, zs).zipped.map(f)` instead of `List.map3(xs, ys, zs)(f)`", "2.8.0")
|
||||
def map3[A,B,C,D](xs: List[A], ys: List[B], zs: List[C])(f: (A, B, C) => D): List[D] = {
|
||||
val b = new ListBuffer[D]
|
||||
var xc = xs
|
||||
var yc = ys
|
||||
var zc = zs
|
||||
while (!xc.isEmpty && !yc.isEmpty && !zc.isEmpty) {
|
||||
b += f(xc.head, yc.head, zc.head)
|
||||
xc = xc.tail
|
||||
yc = yc.tail
|
||||
zc = zc.tail
|
||||
}
|
||||
b.toList
|
||||
}
|
||||
|
||||
/** Tests whether the given predicate `p` holds
|
||||
* for all corresponding elements of the argument lists.
|
||||
*
|
||||
* @param p function to apply to each pair of elements.
|
||||
* @return `(p(a<sub>0</sub>,b<sub>0</sub>) &&
|
||||
* ... && p(a<sub>n</sub>,b<sub>n</sub>))]`
|
||||
* if the lists are `[a<sub>0</sub>, ..., a<sub>k</sub>]`;
|
||||
* `[b<sub>0</sub>, ..., b<sub>l</sub>]`
|
||||
* and `n = min(k,l)`
|
||||
*/
|
||||
@deprecated("use `(xs, ys).zipped.forall(f)` instead of `List.forall2(xs, ys)(f)`", "2.8.0")
|
||||
def forall2[A,B](xs: List[A], ys: List[B])(f: (A, B) => Boolean): Boolean = {
|
||||
var xc = xs
|
||||
var yc = ys
|
||||
while (!xc.isEmpty && !yc.isEmpty) {
|
||||
if (!f(xc.head, yc.head)) return false
|
||||
xc = xc.tail
|
||||
yc = yc.tail
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
/** Tests whether the given predicate `p` holds
|
||||
* for some corresponding elements of the argument lists.
|
||||
*
|
||||
* @param p function to apply to each pair of elements.
|
||||
* @return `n != 0 && (p(a<sub>0</sub>,b<sub>0</sub>) ||
|
||||
* ... || p(a<sub>n</sub>,b<sub>n</sub>))]` if the lists are
|
||||
* `[a<sub>0</sub>, ..., a<sub>k</sub>]`,
|
||||
* `[b<sub>0</sub>, ..., b<sub>l</sub>]` and
|
||||
* `n = min(k,l)`
|
||||
*/
|
||||
@deprecated("use `(xs, ys).zipped.exists(f)` instead of `List.exists2(xs, ys)(f)`", "2.8.0")
|
||||
def exists2[A,B](xs: List[A], ys: List[B])(f: (A, B) => Boolean): Boolean = {
|
||||
var xc = xs
|
||||
var yc = ys
|
||||
while (!xc.isEmpty && !yc.isEmpty) {
|
||||
if (f(xc.head, yc.head)) return true
|
||||
xc = xc.tail
|
||||
yc = yc.tail
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
/** Transposes a list of lists.
|
||||
* pre: All element lists have the same length.
|
||||
*
|
||||
* @param xss the list of lists
|
||||
* @return the transposed list of lists
|
||||
*/
|
||||
@deprecated("use `xss.transpose` instead of `List.transpose(xss)`", "2.8.0")
|
||||
def transpose[A](xss: List[List[A]]): List[List[A]] = {
|
||||
val buf = new ListBuffer[List[A]]
|
||||
var yss = xss
|
||||
while (!yss.head.isEmpty) {
|
||||
buf += (yss map (_.head))
|
||||
yss = (yss map (_.tail))
|
||||
}
|
||||
buf.toList
|
||||
}
|
||||
}
|
||||
|
||||
/** Only used for list serialization */
|
||||
|
|
|
@ -93,16 +93,6 @@ object Map extends ImmutableMapFactory[Map] {
|
|||
def - (key: Any): Map[Any, Nothing] = this
|
||||
}
|
||||
|
||||
@deprecated("use `Map.empty` instead", "2.8.0")
|
||||
class EmptyMap[A,B] extends Map[A,B] with Serializable {
|
||||
override def size: Int = 0
|
||||
def get(key: A): Option[B] = None
|
||||
def iterator: Iterator[(A, B)] = Iterator.empty
|
||||
override def updated [B1] (key: A, value: B1): Map[A, B1] = new Map1(key, value)
|
||||
def + [B1](kv: (A, B1)): Map[A, B1] = updated(kv._1, kv._2)
|
||||
def - (key: A): Map[A, B] = this
|
||||
}
|
||||
|
||||
class Map1[A, +B](key1: A, value1: B) extends Map[A, B] with Serializable {
|
||||
override def size = 1
|
||||
def get(key: A): Option[B] =
|
||||
|
|
|
@ -129,7 +129,4 @@ object Queue extends SeqFactory[Queue] {
|
|||
override def apply[A](xs: A*): Queue[A] = new Queue[A](Nil, xs.toList)
|
||||
|
||||
private object EmptyQueue extends Queue[Nothing](Nil, Nil) { }
|
||||
|
||||
@deprecated("Use Queue.empty instead", "2.8.0")
|
||||
val Empty: Queue[Nothing] = Queue()
|
||||
}
|
||||
|
|
|
@ -35,12 +35,8 @@ abstract class RedBlack[A] extends Serializable {
|
|||
def delete(k: A): Tree[B] = blacken(del(k))
|
||||
def range(from: Option[A], until: Option[A]): Tree[B] = blacken(rng(from, until))
|
||||
def foreach[U](f: (A, B) => U)
|
||||
@deprecated("use `foreach` instead", "2.8.0")
|
||||
def visit[T](input: T)(f: (T, A, B) => (Boolean, T)): (Boolean, T)
|
||||
def toStream: Stream[(A,B)]
|
||||
def iterator: Iterator[(A, B)]
|
||||
@deprecated("use `iterator` instead", "2.8.0")
|
||||
def elements = iterator
|
||||
def upd[B1 >: B](k: A, v: B1): Tree[B1]
|
||||
def del(k: A): Tree[B]
|
||||
def smallest: NonEmpty[B]
|
||||
|
@ -165,14 +161,6 @@ abstract class RedBlack[A] extends Serializable {
|
|||
right foreach f
|
||||
}
|
||||
|
||||
@deprecated("use `foreach` instead", "2.8.0")
|
||||
def visit[T](input: T)(f: (T,A,B) => (Boolean, T)): (Boolean, T) = {
|
||||
val left = this.left.visit(input)(f)
|
||||
if (!left._1) return left
|
||||
val middle = f(left._2, key, value)
|
||||
if (!middle._1) return middle
|
||||
return this.right.visit(middle._2)(f)
|
||||
}
|
||||
override def rng(from: Option[A], until: Option[A]): Tree[B] = {
|
||||
if (from == None && until == None) return this
|
||||
if (from != None && isSmaller(key, from.get)) return right.rng(from, until);
|
||||
|
@ -281,9 +269,6 @@ abstract class RedBlack[A] extends Serializable {
|
|||
|
||||
def foreach[U](f: (A, Nothing) => U) {}
|
||||
|
||||
@deprecated("use `foreach` instead", "2.8.0")
|
||||
def visit[T](input: T)(f: (T, A, Nothing) => (Boolean, T)) = (true, input)
|
||||
|
||||
def rng(from: Option[A], until: Option[A]) = this
|
||||
def first = throw new NoSuchElementException("empty map")
|
||||
def last = throw new NoSuchElementException("empty map")
|
||||
|
|
|
@ -58,16 +58,6 @@ object Set extends ImmutableSetFactory[Set] {
|
|||
override def foreach[U](f: Any => U): Unit = {}
|
||||
}
|
||||
|
||||
@deprecated("use `Set.empty` instead", "2.8.0")
|
||||
class EmptySet[A] extends Set[A] with Serializable {
|
||||
override def size: Int = 0
|
||||
def contains(elem: A): Boolean = false
|
||||
def + (elem: A): Set[A] = new Set1(elem)
|
||||
def - (elem: A): Set[A] = this
|
||||
def iterator: Iterator[A] = Iterator.empty
|
||||
override def foreach[U](f: A => U): Unit = {}
|
||||
}
|
||||
|
||||
/** An optimized representation for immutable sets of size 1 */
|
||||
@SerialVersionUID(1233385750652442003L)
|
||||
class Set1[A] private[collection] (elem1: A) extends Set[A] with Serializable {
|
||||
|
|
|
@ -20,9 +20,6 @@ object Stack extends SeqFactory[Stack] {
|
|||
/** $genericCanBuildFromInfo */
|
||||
implicit def canBuildFrom[A]: CanBuildFrom[Coll, A, Stack[A]] = ReusableCBF.asInstanceOf[GenericCanBuildFrom[A]]
|
||||
def newBuilder[A]: Builder[A, Stack[A]] = new ArrayBuffer[A] mapResult (buf => new Stack(buf.toList))
|
||||
|
||||
@deprecated("Use Stack.empty instead", "2.8.0")
|
||||
val Empty: Stack[Nothing] = Stack()
|
||||
}
|
||||
|
||||
/** This class implements immutable stacks using a list-based data
|
||||
|
|
|
@ -605,9 +605,6 @@ object Stream extends SeqFactory[Stream] {
|
|||
else Some((xs.head, xs.tail))
|
||||
}
|
||||
|
||||
@deprecated("use #:: instead", "2.8.0")
|
||||
lazy val lazy_:: = #::
|
||||
|
||||
/** An alternative way of building and matching Streams using Stream.cons(hd, tl).
|
||||
*/
|
||||
object cons {
|
||||
|
@ -702,54 +699,6 @@ object Stream extends SeqFactory[Stream] {
|
|||
private[immutable] def collectedTail[A, B, That](stream: Stream[A], pf: PartialFunction[A, B], bf: CanBuildFrom[Stream[A], B, That]) = {
|
||||
cons(pf(stream.head), stream.tail.collect(pf)(bf).asInstanceOf[Stream[B]])
|
||||
}
|
||||
|
||||
/** A stream containing all elements of a given iterator, in the order they are produced.
|
||||
* @param it The iterator producing the stream's elements
|
||||
*/
|
||||
@deprecated("use it.toStream instead", "2.8.0")
|
||||
def fromIterator[A](it: Iterator[A]): Stream[A] = it.toStream
|
||||
|
||||
/** The concatenation of a sequence of streams
|
||||
*/
|
||||
@deprecated("use xs.flatten instead", "2.8.0")
|
||||
def concat[A](xs: Iterable[Stream[A]]): Stream[A] = concat(xs.iterator)
|
||||
|
||||
/** The concatenation of all streams returned by an iterator
|
||||
*/
|
||||
@deprecated("use xs.toStream.flatten instead", "2.8.0")
|
||||
def concat[A](xs: Iterator[Stream[A]]): Stream[A] = xs.toStream.flatten //(conforms[Stream[A], scala.collection.Traversable[A]])
|
||||
|
||||
/**
|
||||
* Create a stream with element values `v,,n+1,, = step(v,,n,,)` where
|
||||
* `v,,0,, = start` and elements are in the range between `start` (inclusive)
|
||||
* and `end` (exclusive).
|
||||
*
|
||||
* @param start the start value of the stream
|
||||
* @param end the end value of the stream
|
||||
* @param step the increment function of the stream, must be monotonically increasing or decreasing
|
||||
* @return the stream starting at value `start`.
|
||||
*/
|
||||
@deprecated("use `iterate` instead.", "2.8.0")
|
||||
def range(start: Int, end: Int, step: Int => Int): Stream[Int] =
|
||||
iterate(start, end - start)(step)
|
||||
|
||||
/**
|
||||
* Create an infinite stream containing the given element.
|
||||
*
|
||||
* @param elem the element composing the resulting stream
|
||||
* @return the stream containing an infinite number of elem
|
||||
*/
|
||||
@deprecated("use `continually` instead", "2.8.0")
|
||||
def const[A](elem: A): Stream[A] = cons(elem, const(elem))
|
||||
|
||||
/** Create a stream containing several copies of an element.
|
||||
*
|
||||
* @param n the length of the resulting stream
|
||||
* @param elem the element composing the resulting stream
|
||||
* @return the stream composed of n elements all equal to elem
|
||||
*/
|
||||
@deprecated("use fill(n, elem) instead", "2.8.0")
|
||||
def make[A](n: Int, elem: A): Stream[A] = fill(n)(elem)
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,36 +0,0 @@
|
|||
/* __ *\
|
||||
** ________ ___ / / ___ Scala API **
|
||||
** / __/ __// _ | / / / _ | (c) 2003-2011, LAMP/EPFL **
|
||||
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
|
||||
** /____/\___/_/ |_/____/_/ | | **
|
||||
** |/ **
|
||||
\* */
|
||||
|
||||
package scala.collection
|
||||
package mutable
|
||||
|
||||
import generic._
|
||||
|
||||
/** The canonical builder for collections that are addable, i.e. that support
|
||||
* an efficient `+` method which adds an element to the collection.
|
||||
*
|
||||
* Collections are built from their empty element using this `+` method.
|
||||
* @param empty the empty element of the collection.
|
||||
* @tparam Elem the type of elements that get added to the builder.
|
||||
* @tparam To the type of the built collection.
|
||||
*
|
||||
* @note "efficient `+`" is not idle talk. Do not use this on mutable collections or any others
|
||||
* for which `+` may perform an unshared copy! See GrowingBuilder comments for more.
|
||||
*
|
||||
* @author Martin Odersky
|
||||
* @version 2.8
|
||||
* @since 2.8
|
||||
*/
|
||||
@deprecated("Will be removed after scala 2.9", "2.8.0")
|
||||
class AddingBuilder[Elem, To <: Addable[Elem, To] with collection.Iterable[Elem] with collection.IterableLike[Elem, To]](empty: To)
|
||||
extends Builder[Elem, To] {
|
||||
protected var elems: To = empty
|
||||
def +=(x: Elem): this.type = { elems = elems + x; this }
|
||||
def clear() { elems = empty }
|
||||
def result: To = elems
|
||||
}
|
|
@ -46,22 +46,4 @@ trait ArrayLike[A, +Repr] extends IndexedSeqOptimized[A, Repr] { self =>
|
|||
}
|
||||
override def stringPrefix = "Array"
|
||||
}
|
||||
|
||||
@deprecated("use deep.toString instead", "2.8.0")
|
||||
final def deepToString() =
|
||||
deep.toString
|
||||
|
||||
@deprecated("use deep.mkString instead", "2.8.0")
|
||||
final def deepMkString(start: String, sep: String, end: String): String =
|
||||
deep.mkString(start, sep, end)
|
||||
|
||||
@deprecated("use deep.mkString instead", "2.8.0")
|
||||
final def deepMkString(sep: String): String =
|
||||
deepMkString("", sep, "")
|
||||
|
||||
@deprecated("use array1.deep.equals(array2.deep) instead", "2.8.0")
|
||||
final def deepEquals(that: Any): Boolean = that match {
|
||||
case x: AnyRef if x.getClass.isArray => deep.equals(WrappedArray.make(x).deep)
|
||||
case _ => false
|
||||
}
|
||||
}
|
||||
|
|
|
@ -117,10 +117,6 @@ extends Seq[T]
|
|||
x
|
||||
}
|
||||
|
||||
/** View the top element of the stack. */
|
||||
@deprecated("use top instead", "2.8.0")
|
||||
def peek = top
|
||||
|
||||
/** View the top element of the stack.
|
||||
*
|
||||
* Does not remove the element on the top. If the stack is empty,
|
||||
|
|
|
@ -214,51 +214,6 @@ trait BufferLike[A, +This <: BufferLike[A, This] with Buffer[A]]
|
|||
*/
|
||||
def readOnly: scala.collection.Seq[A] = toSeq
|
||||
|
||||
/** Adds a number of elements in an array
|
||||
*
|
||||
* @param src the array
|
||||
* @param start the first element to append
|
||||
* @param len the number of elements to append
|
||||
*/
|
||||
@deprecated("replace by: `buf ++= src.view(start, end)`", "2.8.0")
|
||||
def ++=(src: Array[A], start: Int, len: Int) {
|
||||
var i = start
|
||||
val end = i + len
|
||||
while (i < end) {
|
||||
this += src(i)
|
||||
i += 1
|
||||
}
|
||||
}
|
||||
|
||||
/** Adds a single element to this collection and returns
|
||||
* the collection itself.
|
||||
*
|
||||
* $compatMutate
|
||||
* You are strongly recommended to use `+=` instead.
|
||||
*
|
||||
* @param elem the element to add.
|
||||
*/
|
||||
@deprecated("Use += instead if you intend to add by side effect to an existing collection.\n"+
|
||||
"Use `clone() +=` if you intend to create a new collection.", "2.8.0")
|
||||
def + (elem: A): This = { +=(elem); repr }
|
||||
|
||||
/** Adds two or more elements to this collection and returns
|
||||
* the collection itself.
|
||||
*
|
||||
* $compatMutate
|
||||
* You are strongly recommended to use `++=` instead.
|
||||
*
|
||||
* @param elem1 the first element to add.
|
||||
* @param elem2 the second element to add.
|
||||
* @param elems the remaining elements to add.
|
||||
*/
|
||||
@deprecated("Use ++= instead if you intend to add by side effect to an existing collection.\n"+
|
||||
"Use `clone() ++=` if you intend to create a new collection.", "2.8.0")
|
||||
def + (elem1: A, elem2: A, elems: A*): This = {
|
||||
this += elem1 += elem2 ++= elems
|
||||
repr
|
||||
}
|
||||
|
||||
/** Creates a new collection containing both the elements of this collection and the provided
|
||||
* traversable object.
|
||||
*
|
||||
|
|
|
@ -38,16 +38,6 @@ trait BufferProxy[A] extends Buffer[A] with Proxy {
|
|||
|
||||
def apply(n: Int): A = self.apply(n)
|
||||
|
||||
/** Append a single element to this buffer and return
|
||||
* the identity of the buffer.
|
||||
*
|
||||
* @param elem the element to append.
|
||||
* @return the updated buffer.
|
||||
*/
|
||||
@deprecated("Use += instead if you intend to add by side effect to an existing collection.\n"+
|
||||
"Use `clone() ++=` if you intend to create a new collection.", "2.8.0")
|
||||
override def +(elem: A): Buffer[A] = self.+(elem)
|
||||
|
||||
/** Append a single element to this buffer.
|
||||
*
|
||||
* @param elem the element to append.
|
||||
|
@ -56,16 +46,6 @@ trait BufferProxy[A] extends Buffer[A] with Proxy {
|
|||
|
||||
override def readOnly = self.readOnly
|
||||
|
||||
/** Appends a number of elements provided by a traversable object via its
|
||||
* `foreach` method. The identity of the buffer is returned.
|
||||
*
|
||||
* @param iter the traversable object.
|
||||
* @return the updated buffer.
|
||||
*/
|
||||
@deprecated("Use ++= instead if you intend to add by side effect to an existing collection.\n"+
|
||||
"Use `clone() ++=` if you intend to create a new collection.", "2.8.0")
|
||||
override def ++(xs: GenTraversableOnce[A]): Buffer[A] = self.++(xs)
|
||||
|
||||
/** Appends a number of elements provided by a traversable object.
|
||||
*
|
||||
* @param xs the traversable object.
|
||||
|
|
|
@ -196,10 +196,6 @@ trait HashTable[A, Entry >: Null <: HashEntry[A, Entry]] extends HashTable.HashU
|
|||
}
|
||||
}
|
||||
|
||||
/** An iterator returning all entries */
|
||||
@deprecated("use entriesIterator instead", "2.8.0")
|
||||
protected def entries: Iterator[Entry] = entriesIterator
|
||||
|
||||
/** Remove all entries from table
|
||||
*/
|
||||
protected def clearTable() {
|
||||
|
|
|
@ -54,9 +54,6 @@ extends Map[A, B] with Serializable
|
|||
|
||||
def iterator: Iterator[(A, B)] = imap.iterator
|
||||
|
||||
@deprecated("use `iterator` instead", "2.8.0")
|
||||
override def elements = iterator
|
||||
|
||||
override def toList: List[(A, B)] = imap.toList
|
||||
|
||||
override def update(key: A, value: B): Unit = { imap = imap.updated(key, value) }
|
||||
|
|
|
@ -40,9 +40,6 @@ class ImmutableSetAdaptor[A](protected var set: immutable.Set[A]) extends Set[A]
|
|||
|
||||
def iterator: Iterator[A] = set.iterator
|
||||
|
||||
@deprecated("use `iterator` instead", "2.8.0")
|
||||
override def elements: Iterator[A] = iterator
|
||||
|
||||
def +=(elem: A): this.type = { set = set + elem; this }
|
||||
|
||||
def -=(elem: A): this.type = { set = set - elem; this }
|
||||
|
|
|
@ -160,13 +160,6 @@ trait MapLike[A, B, +This <: MapLike[A, B, This] with Map[A, B]]
|
|||
)
|
||||
override def -(key: A): This = clone() -= key
|
||||
|
||||
/** If given key is defined in this map, remove it and return associated value as an Option.
|
||||
* If key is not present return None.
|
||||
* @param key the key to be removed
|
||||
*/
|
||||
@deprecated("Use `remove` instead", "2.8.0")
|
||||
def removeKey(key: A): Option[B] = remove(key)
|
||||
|
||||
/** Removes all bindings from the map. After this operation has completed,
|
||||
* the map will be empty.
|
||||
*/
|
||||
|
|
|
@ -36,9 +36,6 @@ trait MultiMap[A, B] extends Map[A, Set[B]] {
|
|||
*/
|
||||
protected def makeSet: Set[B] = new HashSet[B]
|
||||
|
||||
@deprecated("use addBinding instead", "2.8.0")
|
||||
def add(key: A, value: B): this.type = addBinding(key, value)
|
||||
|
||||
/** Assigns the specified `value` to a specified `key`, replacing
|
||||
* the existing value assigned to that `key` if it is equal to
|
||||
* the specified value. Otherwise, simply adds another binding to
|
||||
|
|
|
@ -105,9 +105,6 @@ extends LinearSeq[A]
|
|||
}
|
||||
}
|
||||
|
||||
@deprecated("use clear() instead", "2.8.0")
|
||||
def reset() { clear() }
|
||||
|
||||
/** Returns an iterator over all elements of this list.
|
||||
*/
|
||||
override def iterator: Iterator[A] = first0.iterator
|
||||
|
|
|
@ -91,23 +91,6 @@ class PriorityQueue[A](implicit val ord: Ordering[A])
|
|||
}
|
||||
}
|
||||
|
||||
@deprecated(
|
||||
"Use `+=` instead if you intend to add by side effect to an existing collection.\n"+
|
||||
"Use `clone() +=` if you intend to create a new collection.", "2.8.0"
|
||||
)
|
||||
def +(elem: A): PriorityQueue[A] = { this.clone() += elem }
|
||||
|
||||
/** Add two or more elements to this set.
|
||||
* @param elem1 the first element.
|
||||
* @param kv2 the second element.
|
||||
* @param kvs the remaining elements.
|
||||
*/
|
||||
@deprecated(
|
||||
"Use `++=` instead if you intend to add by side effect to an existing collection.\n"+
|
||||
"Use `clone() ++=` if you intend to create a new collection.", "2.8.0"
|
||||
)
|
||||
def +(elem1: A, elem2: A, elems: A*) = { this.clone().+=(elem1, elem2, elems : _*) }
|
||||
|
||||
/** Inserts a single element into the priority queue.
|
||||
*
|
||||
* @param elem the element to insert.
|
||||
|
|
|
@ -121,10 +121,6 @@ extends Seq[A]
|
|||
*/
|
||||
def pushAll(xs: TraversableOnce[A]): this.type = { xs.seq foreach push ; this }
|
||||
|
||||
@deprecated("use pushAll", "2.8.0")
|
||||
@migration(2, 8, "Stack ++= now pushes arguments on the stack from left to right.")
|
||||
def ++=(xs: TraversableOnce[A]): this.type = pushAll(xs)
|
||||
|
||||
/** Returns the top element of the stack. This method will not remove
|
||||
* the element from the stack. An error is signaled if there is no
|
||||
* element on the stack.
|
||||
|
|
|
@ -49,16 +49,6 @@ trait StackProxy[A] extends Stack[A] with Proxy {
|
|||
|
||||
override def pushAll(xs: TraversableOnce[A]): this.type = { self pushAll xs; this }
|
||||
|
||||
/** Pushes all elements provided by an `Iterable` object on top of the
|
||||
* stack. The elements are pushed in the order they are given out by
|
||||
* the iterator.
|
||||
*
|
||||
* @param iter an iterable object
|
||||
*/
|
||||
@deprecated("use pushAll", "2.8.0")
|
||||
override def ++=(xs: TraversableOnce[A]): this.type = { self ++= xs ; this }
|
||||
|
||||
|
||||
override def push(elem1: A, elem2: A, elems: A*): this.type = {
|
||||
self.push(elem1).push(elem2).pushAll(elems)
|
||||
this
|
||||
|
|
|
@ -89,10 +89,6 @@ final class StringBuilder(private val underlying: JavaStringBuilder)
|
|||
*/
|
||||
def capacity: Int = underlying.capacity()
|
||||
|
||||
@deprecated("Use `ensureCapacity` instead. An assignment is misleading because\n"+
|
||||
"it can never decrease the capacity.", "2.8.0")
|
||||
def capacity_=(n: Int) { ensureCapacity(n) }
|
||||
|
||||
/** Ensure that the capacity is at least the given argument.
|
||||
* If the argument is greater than the current capacity, new
|
||||
* storage will be allocated with size equal to the given
|
||||
|
@ -368,31 +364,6 @@ final class StringBuilder(private val underlying: JavaStringBuilder)
|
|||
def insert(index: Int, x: Double): StringBuilder = insert(index, String.valueOf(x))
|
||||
def insert(index: Int, x: Char): StringBuilder = insert(index, String.valueOf(x))
|
||||
|
||||
@deprecated("Use appendAll instead. This method is deprecated because of the\n"+
|
||||
"possible confusion with `append(Any)`.", "2.8.0")
|
||||
def append(x: Seq[Char]): StringBuilder = appendAll(x)
|
||||
|
||||
@deprecated("use appendAll instead. This method is deprecated because\n"+
|
||||
"of the possible confusion with `append(Any)`.", "2.8.0")
|
||||
def append(x: Array[Char]): StringBuilder = appendAll(x)
|
||||
|
||||
@deprecated("use appendAll instead. This method is deprecated because\n"+
|
||||
"of the possible confusion with `append(Any, Int, Int)'.", "2.8.0")
|
||||
def append(x: Array[Char], offset: Int, len: Int): StringBuilder = appendAll(x, offset, len)
|
||||
|
||||
@deprecated("use insertAll instead. This method is deprecated because of the\n"+
|
||||
"possible confusion with `insert(Int, Any, Int, Int)'.", "2.8.0")
|
||||
def insert(index: Int, str: Array[Char], offset: Int, len: Int): StringBuilder =
|
||||
insertAll(index, str, offset, len)
|
||||
|
||||
@deprecated("use insertAll instead. This method is deprecated because of\n"+
|
||||
"the possible confusion with `insert(Int, Any)'.", "2.8.0")
|
||||
def insert(at: Int, x: Seq[Char]): StringBuilder = insertAll(at, x)
|
||||
|
||||
@deprecated("use insertAll instead. This method is deprecated because of\n"+
|
||||
"the possible confusion with `insert(Int, Any)'.", "2.8.0")
|
||||
def insert(at: Int, x: Array[Char]): StringBuilder = insertAll(at, x)
|
||||
|
||||
/** Finds the index of the first occurrence of the specified substring.
|
||||
*
|
||||
* @param str the target string to search for
|
||||
|
|
|
@ -40,15 +40,6 @@ trait SynchronizedBuffer[A] extends Buffer[A] {
|
|||
super.apply(n)
|
||||
}
|
||||
|
||||
/** Append a single element to this buffer and return
|
||||
* the identity of the buffer.
|
||||
*
|
||||
* @param elem the element to append.
|
||||
*/
|
||||
override def +(elem: A): Self = synchronized {
|
||||
super.+(elem)
|
||||
}
|
||||
|
||||
/** Append a single element to this buffer.
|
||||
*
|
||||
* @param elem the element to append.
|
||||
|
|
|
@ -1,177 +0,0 @@
|
|||
/* __ *\
|
||||
** ________ ___ / / ___ Scala API **
|
||||
** / __/ __// _ | / / / _ | (c) 2003-2011, LAMP/EPFL **
|
||||
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
|
||||
** /____/\___/_/ |_/____/_/ | | **
|
||||
** |/ **
|
||||
\* */
|
||||
|
||||
package scala.concurrent
|
||||
|
||||
/** This class ...
|
||||
*
|
||||
* @author Martin Odersky
|
||||
* @version 1.0, 12/03/2003
|
||||
*/
|
||||
//class MailBox with Monitor with LinkedListQueueCreator {
|
||||
@deprecated("use actors instead", "2.8.0")
|
||||
class MailBox extends AnyRef with ListQueueCreator {
|
||||
|
||||
type Message = AnyRef
|
||||
|
||||
private abstract class PreReceiver {
|
||||
var msg: Message = null
|
||||
def isDefinedAt(msg: Message): Boolean
|
||||
}
|
||||
|
||||
private class Receiver[A](receiver: PartialFunction[Message, A]) extends PreReceiver {
|
||||
|
||||
def isDefinedAt(msg: Message) = receiver.isDefinedAt(msg)
|
||||
|
||||
def receive(): A = synchronized {
|
||||
while (msg eq null) wait()
|
||||
receiver(msg)
|
||||
}
|
||||
|
||||
def receiveWithin(msec: Long): A = synchronized {
|
||||
if (msg eq null) wait(msec)
|
||||
receiver(if (msg ne null) msg else TIMEOUT)
|
||||
}
|
||||
}
|
||||
|
||||
private val messageQueue = queueCreate[Message]
|
||||
private val receiverQueue = queueCreate[PreReceiver]
|
||||
|
||||
/** Unconsumed messages. */
|
||||
private var sent = messageQueue.make
|
||||
|
||||
/** Pending receivers. */
|
||||
private var receivers = receiverQueue.make
|
||||
|
||||
/**
|
||||
* Check whether the receiver can be applied to an unconsumed message.
|
||||
* If yes, the message is extracted and associated with the receiver.
|
||||
* Otherwise the receiver is appended to the list of pending receivers.
|
||||
*/
|
||||
private def scanSentMsgs[A](receiver: Receiver[A]): Unit = synchronized {
|
||||
messageQueue.extractFirst(sent, msg => receiver.isDefinedAt(msg)) match {
|
||||
case None =>
|
||||
receivers = receiverQueue.append(receivers, receiver)
|
||||
case Some((msg, withoutMsg)) =>
|
||||
sent = withoutMsg
|
||||
receiver.msg = msg
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* First check whether a pending receiver is applicable to the sent
|
||||
* message. If yes, the receiver is notified. Otherwise the message
|
||||
* is appended to the linked list of sent messages.
|
||||
*/
|
||||
def send(msg: Message): Unit = synchronized {
|
||||
receiverQueue.extractFirst(receivers, r => r.isDefinedAt(msg)) match {
|
||||
case None =>
|
||||
sent = messageQueue.append(sent, msg)
|
||||
case Some((receiver, withoutReceiver)) =>
|
||||
receivers = withoutReceiver
|
||||
receiver.msg = msg
|
||||
receiver synchronized { receiver.notify() }
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Block until there is a message in the mailbox for which the processor
|
||||
* `f` is defined.
|
||||
*/
|
||||
def receive[A](f: PartialFunction[Message, A]): A = {
|
||||
val r = new Receiver(f)
|
||||
scanSentMsgs(r)
|
||||
r.receive()
|
||||
}
|
||||
|
||||
/**
|
||||
* Block until there is a message in the mailbox for which the processor
|
||||
* `f` is defined or the timeout is over.
|
||||
*/
|
||||
def receiveWithin[A](msec: Long)(f: PartialFunction[Message, A]): A = {
|
||||
val r = new Receiver(f)
|
||||
scanSentMsgs(r)
|
||||
r.receiveWithin(msec)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Module for dealing with queues.
|
||||
*/
|
||||
@deprecated("use actors instead", "2.8.0")
|
||||
trait QueueModule[A] {
|
||||
/** Type of queues. */
|
||||
type T
|
||||
/** Create an empty queue. */
|
||||
def make: T
|
||||
/** Append an element to a queue. */
|
||||
def append(l: T, x: A): T
|
||||
/** Extract an element satisfying a predicate from a queue. */
|
||||
def extractFirst(l: T, p: A => Boolean): Option[(A, T)]
|
||||
}
|
||||
|
||||
/** Inefficient but simple queue module creator. */
|
||||
@deprecated("use actors instead", "2.8.0")
|
||||
trait ListQueueCreator {
|
||||
def queueCreate[A]: QueueModule[A] = new QueueModule[A] {
|
||||
type T = List[A]
|
||||
def make: T = Nil
|
||||
def append(l: T, x: A): T = l ::: x :: Nil
|
||||
def extractFirst(l: T, p: A => Boolean): Option[(A, T)] =
|
||||
l match {
|
||||
case Nil => None
|
||||
case head :: tail =>
|
||||
if (p(head))
|
||||
Some((head, tail))
|
||||
else
|
||||
extractFirst(tail, p) match {
|
||||
case None => None
|
||||
case Some((x, without_x)) => Some((x, head :: without_x))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Efficient queue module creator based on linked lists. */
|
||||
@deprecated("use actors instead", "2.8.0")
|
||||
trait LinkedListQueueCreator {
|
||||
import scala.collection.mutable.LinkedList
|
||||
def queueCreate[A >: Null <: AnyRef]: QueueModule[A] = new QueueModule[A] {
|
||||
type T = (LinkedList[A], LinkedList[A]) // fst = the list, snd = last elem
|
||||
def make: T = {
|
||||
val l = new LinkedList[A](null, null)
|
||||
(l, l)
|
||||
}
|
||||
def append(l: T, x: A): T = {
|
||||
val atTail = new LinkedList(x, null)
|
||||
l._2 append atTail;
|
||||
(l._1, atTail)
|
||||
}
|
||||
def extractFirst(l: T, p: A => Boolean): Option[(A, T)] = {
|
||||
var xs = l._1
|
||||
var xs1 = xs.next
|
||||
while ((xs1 ne null) && !p(xs1.elem)) {
|
||||
xs = xs1
|
||||
xs1 = xs1.next
|
||||
}
|
||||
if (xs1 ne null) {
|
||||
xs.next = xs1.next
|
||||
if (xs.next eq null)
|
||||
Some((xs1.elem, (l._1, xs)))
|
||||
else
|
||||
Some((xs1.elem, l))
|
||||
}
|
||||
else
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
/* __ *\
|
||||
** ________ ___ / / ___ Scala API **
|
||||
** / __/ __// _ | / / / _ | (c) 2003-2011, LAMP/EPFL **
|
||||
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
|
||||
** /____/\___/_/ |_/____/_/ | | **
|
||||
** |/ **
|
||||
\* */
|
||||
|
||||
package scala.concurrent
|
||||
|
||||
/**
|
||||
* The message sent to a message box when the period specified in
|
||||
* `receiveWithin` expires.
|
||||
*
|
||||
* @author Martin Odersky
|
||||
* @version 1.0, 10/03/2003
|
||||
*/
|
||||
@deprecated("use actors instead", "2.8.0")
|
||||
case object TIMEOUT
|
|
@ -61,24 +61,6 @@ object ops
|
|||
(xp, getOrThrow(y.get))
|
||||
}
|
||||
|
||||
/**
|
||||
* @param start ...
|
||||
* @param end ...
|
||||
* @param p ...
|
||||
*/
|
||||
@deprecated("use `collection.parallel.ParIterable.foreach` instead", "2.9.0")
|
||||
def replicate(start: Int, end: Int)(p: Int => Unit)(implicit runner: TaskRunner = defaultRunner) {
|
||||
if (start == end)
|
||||
()
|
||||
else if (start + 1 == end)
|
||||
p(start)
|
||||
else {
|
||||
val mid = (start + end) / 2
|
||||
spawn { replicate(start, mid)(p) }
|
||||
replicate(mid, end)(p)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
def parMap[a,b](f: a => b, xs: Array[a]): Array[b] = {
|
||||
val results = new Array[b](xs.length);
|
||||
|
|
|
@ -1,206 +0,0 @@
|
|||
/* __ *\
|
||||
** ________ ___ / / ___ Scala API **
|
||||
** / __/ __// _ | / / / _ | (c) 2003-2011, LAMP/EPFL **
|
||||
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
|
||||
** /____/\___/_/ |_/____/_/ | | **
|
||||
** |/ **
|
||||
\* */
|
||||
|
||||
|
||||
|
||||
package scala.concurrent
|
||||
|
||||
/** Library for using Pi-calculus concurrent primitives in
|
||||
* [[http://scala-lang.org/#_top Scala]]. As an example, the definition of
|
||||
* a two-place buffer using the `pilib` library looks like:
|
||||
* {{{
|
||||
* def Buffer[a](put: Chan[a], get: Chan[a]) {
|
||||
* def B0 { choice ( put * { x => B1(x) } ) }
|
||||
* def B1(x: a) { choice ( get(x) * B0, put * { y => B2(x, y) } ) }
|
||||
* def B2(x: a, y: a) { choice ( get(x) * B1(y) ) }
|
||||
* B0
|
||||
* }
|
||||
* }}}
|
||||
*
|
||||
* @see <a href="http://scala-lang.org/docu/papers.html" target="_top">
|
||||
* PiLib: A Hosted Language for Pi-Calculus Style Concurrency</a>
|
||||
* @author Vincent Cremet, Martin Odersky
|
||||
* @version 1.0
|
||||
*/
|
||||
@deprecated("use actors instead", "2.8.0")
|
||||
object pilib {
|
||||
|
||||
import TaskRunners.threadRunner
|
||||
|
||||
//////////////////////////////// SPAWN /////////////////////////////////
|
||||
|
||||
/**
|
||||
* Run several processes in parallel using the following syntax:
|
||||
* `spawn < p,,1,, | ... | p,,n,, >`.
|
||||
*/
|
||||
abstract class Spawn {
|
||||
def <(p: => Unit): Spawn
|
||||
def |(p: => Unit): Spawn
|
||||
def > (): Unit
|
||||
}
|
||||
val spawn = new Spawn {
|
||||
//object spawn extends Spawn { // BUG !
|
||||
def <(p: => Unit): Spawn = { scala.concurrent.ops.spawn(p); this }
|
||||
def |(p: => Unit): Spawn = { scala.concurrent.ops.spawn(p); this }
|
||||
def > (): Unit = ()
|
||||
}
|
||||
|
||||
/////////////////////////// GUARDED PROCESSES //////////////////////////
|
||||
|
||||
/** Untyped channel. */
|
||||
class UChan {
|
||||
/** Default log function. */
|
||||
var log = (x: Any) => ()
|
||||
}
|
||||
|
||||
/** An untyped guarded process.
|
||||
*
|
||||
* @param n channel name
|
||||
* @param polarity input (true) or output (false)
|
||||
* @param v transmitted value
|
||||
* @param c continuation
|
||||
*/
|
||||
case class UGP(n: UChan, polarity: Boolean, v: Any, c: Any => Any)
|
||||
|
||||
/** Typed guarded process. */
|
||||
class GP[a](n: UChan, polarity: Boolean, v: Any, c: Any => a) {
|
||||
val untyped = UGP(n, polarity, v, c)
|
||||
}
|
||||
|
||||
//////////////////////////////// CHANNELS //////////////////////////////
|
||||
|
||||
/**
|
||||
* Name on which one can emit, receive or that can be emitted or received
|
||||
* during a communication.
|
||||
*/
|
||||
class Chan[A] extends UChan with Function1[A, Product[A]] {
|
||||
|
||||
var defaultValue: A = _
|
||||
|
||||
/** Creates an input guarded process. */
|
||||
def input[B](c: A => B) =
|
||||
new GP(this, true, (), x => c(x.asInstanceOf[A]))
|
||||
|
||||
/** Creates an input guarded process. */
|
||||
def output[B](v: A, c: () => B) =
|
||||
new GP(this, false, v, x => c())
|
||||
|
||||
/** Blocking read. */
|
||||
def read = {
|
||||
var res: A = defaultValue
|
||||
choice ( input(x => res = x) )
|
||||
res
|
||||
}
|
||||
|
||||
/** Blocking write. */
|
||||
def write(x: A) =
|
||||
choice ( output(x, () => ()) )
|
||||
|
||||
/** Syntactic sugar for input. */
|
||||
def *[B](f: A => B) =
|
||||
input(f)
|
||||
|
||||
/** Syntactic sugar for output. */
|
||||
def apply(v: A) =
|
||||
new Product(this, v)
|
||||
|
||||
/** Attach a function to be evaluated at each communication event
|
||||
* on this channel. Replace previous attached function.
|
||||
*/
|
||||
def attach(f: A => Unit) =
|
||||
log = x => f(x.asInstanceOf[A])
|
||||
}
|
||||
|
||||
class Product[A](c: Chan[A], v: A) {
|
||||
def *[B](f: => B) = c.output(v, () => f)
|
||||
}
|
||||
|
||||
/////////////////////// SUM OF GUARDED PROCESSES ///////////////////////
|
||||
|
||||
case class Sum(gs: List[UGP]) {
|
||||
|
||||
/** Continuation of the sum. */
|
||||
var cont: () => Any = _
|
||||
|
||||
var initialized = false
|
||||
|
||||
/** Block if not initialized otherwise continue with the
|
||||
* continuation.
|
||||
*/
|
||||
def continue = synchronized {
|
||||
if (!initialized) wait()
|
||||
cont()
|
||||
}
|
||||
|
||||
/** Set the values of parameters and awake the sleeping sum.
|
||||
*
|
||||
* @param f ...
|
||||
*/
|
||||
def set(f: () => Any) = synchronized {
|
||||
cont = f
|
||||
initialized = true
|
||||
notify()
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////// COMMUNICATION ////////////////////////////
|
||||
|
||||
private var sums: List[Sum] = Nil
|
||||
|
||||
/** Test if two lists of guarded processes can communicate.
|
||||
*
|
||||
* @param gs1 ...
|
||||
* @param gs2 ...
|
||||
* @return ...
|
||||
*/
|
||||
private def matches(gs1: List[UGP], gs2: List[UGP]): Option[(() => Unit, () => Any, () => Any)] =
|
||||
(gs1, gs2) match {
|
||||
case (Nil, _) => None
|
||||
case (_, Nil) => None
|
||||
case (UGP(a1, d1, v1, c1) :: rest1, UGP(a2, d2, v2, c2) :: rest2) =>
|
||||
if (a1 == a2 && d1 == !d2)
|
||||
Some(((() => if (d1) a1.log(v2) else a1.log(v1)), (() => c1(v2)), (() => c2(v1))))
|
||||
else matches(gs1, rest2) match {
|
||||
case None => matches(rest1, gs2)
|
||||
case Some(t) => Some(t)
|
||||
}
|
||||
}
|
||||
|
||||
/** Test if the given sum can react with one of the pending sums.
|
||||
* If yes then do the reaction otherwise append the sum at the end
|
||||
* of the pending sums.
|
||||
*
|
||||
* @param s1 ...
|
||||
* @param ss ...
|
||||
* @return ...
|
||||
*/
|
||||
private def compare(s1: Sum, ss: List[Sum]): List[Sum] =
|
||||
ss match {
|
||||
case Nil => ss ::: List(s1)
|
||||
case s2 :: rest => matches(s1.gs, s2.gs) match {
|
||||
case None => s2 :: compare(s1, rest)
|
||||
case Some((log, c1, c2)) =>
|
||||
log()
|
||||
s1.set(c1)
|
||||
s2.set(c2)
|
||||
rest
|
||||
}
|
||||
}
|
||||
|
||||
/** Pi-calculus non-deterministic choice.
|
||||
*
|
||||
* @param s ...
|
||||
* @return ...
|
||||
*/
|
||||
def choice[A](s: GP[A]*): A = {
|
||||
val sum = Sum(s.toList map { _.untyped })
|
||||
synchronized { sums = compare(sum, sums) }
|
||||
(sum.continue).asInstanceOf[A]
|
||||
}
|
||||
|
||||
}
|
|
@ -187,15 +187,6 @@ abstract class Source extends Iterator[Char] {
|
|||
var nerrors = 0
|
||||
var nwarnings = 0
|
||||
|
||||
/** Convenience method, returns given line (not including newline)
|
||||
* from Source.
|
||||
*
|
||||
* @param line the line index, first line is 1
|
||||
* @return the specified line.
|
||||
*
|
||||
*/
|
||||
@deprecated("Use a collections method such as getLines().toIndexedSeq for random access.", "2.8.0")
|
||||
def getLine(line: Int): String = lineNum(line)
|
||||
private def lineNum(line: Int): String = getLines() drop (line - 1) take 1 mkString
|
||||
|
||||
class LineIterator() extends Iterator[String] {
|
||||
|
|
|
@ -13,8 +13,7 @@ package scala.io
|
|||
* @author Martin Odersky
|
||||
* @version 1.0, 04/10/2004
|
||||
*/
|
||||
object UTF8Codec
|
||||
{
|
||||
object UTF8Codec {
|
||||
final val UNI_REPLACEMENT_CHAR: Int = 0x0000FFFD
|
||||
final val UNI_REPLACEMENT_BYTES = Array[Byte](-17, -65, -67)
|
||||
|
||||
|
@ -29,36 +28,4 @@ object UTF8Codec
|
|||
//
|
||||
// Some useful locations:
|
||||
// http://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-test.txt
|
||||
|
||||
@deprecated("""Use new String(Array(ch), 0, 1).getBytes("UTF-8") instead""", "2.8.0")
|
||||
def encode(ch: Int): Array[Byte] =
|
||||
if ((Character getType ch) == Character.SURROGATE.toInt) UNI_REPLACEMENT_BYTES
|
||||
else try new String(Array(ch), 0, 1) getBytes "UTF-8" catch {
|
||||
case _: IllegalArgumentException => UNI_REPLACEMENT_BYTES
|
||||
}
|
||||
|
||||
@deprecated("Use Codec.toUTF8 instead", "2.8.0")
|
||||
def encode(src: Array[Char], from: Int, dst: Array[Byte], to: Int, len: Int): Int = {
|
||||
val bytes = Codec toUTF8 src.slice(from, from + len)
|
||||
Array.copy(bytes, 0, dst, to, bytes.length)
|
||||
bytes.length
|
||||
}
|
||||
|
||||
@deprecated("Use Codec.toUTF8 instead", "2.8.0")
|
||||
def encode(s: String, dst: Array[Byte], to: Int): Int =
|
||||
encode(s.toArray, 0, dst, to, s.length)
|
||||
|
||||
@deprecated("Use Codec.toUTF8 instead", "2.8.0")
|
||||
def encode(s: String): Array[Byte] = Codec toUTF8 s
|
||||
|
||||
@deprecated("Use Codec.fromUTF8 instead", "2.8.0")
|
||||
def decode(src: Array[Byte], from: Int, dst: Array[Char], to: Int, len: Int): Int = {
|
||||
val chars = Codec fromUTF8 src.slice(from, from + len)
|
||||
Array.copy(chars, 0, dst, to, chars.length)
|
||||
chars.length
|
||||
}
|
||||
|
||||
@deprecated("Use Codec.fromUTF8 instead", "2.8.0")
|
||||
def decode(src: Array[Byte], from: Int, len: Int): String =
|
||||
Codec fromUTF8 src.slice(from, from + len) mkString
|
||||
}
|
||||
|
|
|
@ -12,7 +12,130 @@ package scala
|
|||
* numeric operations such as elementary exponential, logarithmic, root and
|
||||
* trigonometric functions.
|
||||
*/
|
||||
package object math extends MathCommon {
|
||||
package object math {
|
||||
/** The `double` value that is closer than any other to `e`, the base of
|
||||
* the natural logarithms.
|
||||
*/
|
||||
val E = java.lang.Math.E
|
||||
|
||||
/** The `double` value that is closer than any other to `pi`, the ratio of
|
||||
* the circumference of a circle to its diameter.
|
||||
*/
|
||||
val Pi = java.lang.Math.PI
|
||||
|
||||
/** Returns a `double` value with a positive sign, greater than or equal
|
||||
* to `0.0` and less than `1.0`.
|
||||
*/
|
||||
def random: Double = java.lang.Math.random()
|
||||
|
||||
def sin(x: Double): Double = java.lang.Math.sin(x)
|
||||
def cos(x: Double): Double = java.lang.Math.cos(x)
|
||||
def tan(x: Double): Double = java.lang.Math.tan(x)
|
||||
def asin(x: Double): Double = java.lang.Math.asin(x)
|
||||
def acos(x: Double): Double = java.lang.Math.acos(x)
|
||||
def atan(x: Double): Double = java.lang.Math.atan(x)
|
||||
|
||||
/** Converts an angle measured in degrees to an approximately equivalent
|
||||
* angle measured in radians.
|
||||
*
|
||||
* @param x an angle, in degrees
|
||||
* @return the measurement of the angle `x` in radians.
|
||||
*/
|
||||
def toRadians(x: Double): Double = java.lang.Math.toRadians(x)
|
||||
|
||||
/** Converts an angle measured in radians to an approximately equivalent
|
||||
* angle measured in degrees.
|
||||
*
|
||||
* @param x angle, in radians
|
||||
* @return the measurement of the angle `x` in degrees.
|
||||
*/
|
||||
def toDegrees(x: Double): Double = java.lang.Math.toDegrees(x)
|
||||
|
||||
/** Returns Euler's number `e` raised to the power of a `double` value.
|
||||
*
|
||||
* @param x the exponent to raise `e` to.
|
||||
* @return the value `e^a^`, where `e` is the base of the natural
|
||||
* logarithms.
|
||||
*/
|
||||
def exp(x: Double): Double = java.lang.Math.exp(x)
|
||||
def log(x: Double): Double = java.lang.Math.log(x)
|
||||
def sqrt(x: Double): Double = java.lang.Math.sqrt(x)
|
||||
def IEEEremainder(x: Double, y: Double): Double = java.lang.Math.IEEEremainder(x, y)
|
||||
|
||||
def ceil(x: Double): Double = java.lang.Math.ceil(x)
|
||||
def floor(x: Double): Double = java.lang.Math.floor(x)
|
||||
|
||||
/** Returns the `double` value that is closest in value to the
|
||||
* argument and is equal to a mathematical integer.
|
||||
*
|
||||
* @param x a `double` value
|
||||
* @return the closest floating-point value to a that is equal to a
|
||||
* mathematical integer.
|
||||
*/
|
||||
def rint(x: Double): Double = java.lang.Math.rint(x)
|
||||
|
||||
/** Converts rectangular coordinates `(x, y)` to polar `(r, theta)`.
|
||||
*
|
||||
* @param x the ordinate coordinate
|
||||
* @param y the abscissa coordinate
|
||||
* @return the ''theta'' component of the point `(r, theta)` in polar
|
||||
* coordinates that corresponds to the point `(x, y)` in
|
||||
* Cartesian coordinates.
|
||||
*/
|
||||
def atan2(y: Double, x: Double): Double = java.lang.Math.atan2(y, x)
|
||||
|
||||
/** Returns the value of the first argument raised to the power of the
|
||||
* second argument.
|
||||
*
|
||||
* @param x the base.
|
||||
* @param y the exponent.
|
||||
* @return the value `x^y^`.
|
||||
*/
|
||||
def pow(x: Double, y: Double): Double = java.lang.Math.pow(x, y)
|
||||
|
||||
/** Returns the closest `long` to the argument.
|
||||
*
|
||||
* @param x a floating-point value to be rounded to a `long`.
|
||||
* @return the value of the argument rounded to the nearest`long` value.
|
||||
*/
|
||||
def round(x: Float): Int = java.lang.Math.round(x)
|
||||
def round(x: Double): Long = java.lang.Math.round(x)
|
||||
def abs(x: Int): Int = java.lang.Math.abs(x)
|
||||
def abs(x: Long): Long = java.lang.Math.abs(x)
|
||||
def abs(x: Float): Float = java.lang.Math.abs(x)
|
||||
def abs(x: Double): Double = java.lang.Math.abs(x)
|
||||
|
||||
def max(x: Int, y: Int): Int = java.lang.Math.max(x, y)
|
||||
def max(x: Long, y: Long): Long = java.lang.Math.max(x, y)
|
||||
def max(x: Float, y: Float): Float = java.lang.Math.max(x, y)
|
||||
def max(x: Double, y: Double): Double = java.lang.Math.max(x, y)
|
||||
|
||||
def min(x: Int, y: Int): Int = java.lang.Math.min(x, y)
|
||||
def min(x: Long, y: Long): Long = java.lang.Math.min(x, y)
|
||||
def min(x: Float, y: Float): Float = java.lang.Math.min(x, y)
|
||||
def min(x: Double, y: Double): Double = java.lang.Math.min(x, y)
|
||||
|
||||
def signum(x: Double): Double =
|
||||
if (x == 0d) 0d
|
||||
else if (x < 0) -1.0
|
||||
else if (x > 0) 1.0
|
||||
else x // NaN
|
||||
|
||||
def signum(x: Float): Float =
|
||||
if (x == 0f) 0f
|
||||
else if (x < 0) -1.0f
|
||||
else if (x > 0) 1.0f
|
||||
else x // NaN
|
||||
|
||||
def signum(x: Long): Long =
|
||||
if (x == 0l) 0l
|
||||
else if (x < 0) -1l
|
||||
else 1l
|
||||
|
||||
def signum(x: Int): Int =
|
||||
if (x == 0) 0
|
||||
else if (x < 0) -1
|
||||
else 1
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// root functions
|
||||
|
|
|
@ -123,70 +123,6 @@ package object scala {
|
|||
type unchecked = annotation.unchecked.unchecked
|
||||
type volatile = annotation.volatile
|
||||
*/
|
||||
@deprecated("Use Tuple1(x) to create a 1-tuple.", "2.8.0")
|
||||
def Tuple[A1](x1: A1) = Tuple1(x1)
|
||||
@deprecated("Use ((x1, x2, ...)) syntax to create Tuples", "2.8.0")
|
||||
def Tuple[A1, A2](x1: A1, x2: A2) = Tuple2(x1, x2)
|
||||
@deprecated("Use ((x1, x2, ...)) syntax to create Tuples", "2.8.0")
|
||||
def Tuple[A1, A2, A3](x1: A1, x2: A2, x3: A3) = Tuple3(x1, x2, x3)
|
||||
@deprecated("Use ((x1, x2, ...)) syntax to create Tuples", "2.8.0")
|
||||
def Tuple[A1, A2, A3, A4](x1: A1, x2: A2, x3: A3, x4: A4) = Tuple4(x1, x2, x3, x4)
|
||||
@deprecated("Use ((x1, x2, ...)) syntax to create Tuples", "2.8.0")
|
||||
def Tuple[A1, A2, A3, A4, A5](x1: A1, x2: A2, x3: A3, x4: A4, x5: A5) = Tuple5(x1, x2, x3, x4, x5)
|
||||
@deprecated("Use ((x1, x2, ...)) syntax to create Tuples", "2.8.0")
|
||||
def Tuple[A1, A2, A3, A4, A5, A6](x1: A1, x2: A2, x3: A3, x4: A4, x5: A5, x6: A6) = Tuple6(x1, x2, x3, x4, x5, x6)
|
||||
@deprecated("Use ((x1, x2, ...)) syntax to create Tuples", "2.8.0")
|
||||
def Tuple[A1, A2, A3, A4, A5, A6, A7](x1: A1, x2: A2, x3: A3, x4: A4, x5: A5, x6: A6, x7: A7) = Tuple7(x1, x2, x3, x4, x5, x6, x7)
|
||||
@deprecated("Use ((x1, x2, ...)) syntax to create Tuples", "2.8.0")
|
||||
def Tuple[A1, A2, A3, A4, A5, A6, A7, A8](x1: A1, x2: A2, x3: A3, x4: A4, x5: A5, x6: A6, x7: A7, x8: A8) = Tuple8(x1, x2, x3, x4, x5, x6, x7, x8)
|
||||
@deprecated("Use ((x1, x2, ...)) syntax to create Tuples", "2.8.0")
|
||||
def Tuple[A1, A2, A3, A4, A5, A6, A7, A8, A9](x1: A1, x2: A2, x3: A3, x4: A4, x5: A5, x6: A6, x7: A7, x8: A8, x9: A9) = Tuple9(x1, x2, x3, x4, x5, x6, x7, x8, x9)
|
||||
@deprecated("Use ((x1, x2, ...)) syntax to create Tuples", "2.8.0")
|
||||
def Tuple[A1, A2, A3, A4, A5, A6, A7, A8, A9, A10](x1: A1, x2: A2, x3: A3, x4: A4, x5: A5, x6: A6, x7: A7, x8: A8, x9: A9, x10: A10) = Tuple10(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10)
|
||||
@deprecated("Use ((x1, x2, ...)) syntax to create Tuples", "2.8.0")
|
||||
def Tuple[A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11](x1: A1, x2: A2, x3: A3, x4: A4, x5: A5, x6: A6, x7: A7, x8: A8, x9: A9, x10: A10, x11: A11) = Tuple11(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11)
|
||||
@deprecated("Use ((x1, x2, ...)) syntax to create Tuples", "2.8.0")
|
||||
def Tuple[A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12](x1: A1, x2: A2, x3: A3, x4: A4, x5: A5, x6: A6, x7: A7, x8: A8, x9: A9, x10: A10, x11: A11, x12: A12) = Tuple12(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12)
|
||||
@deprecated("Use ((x1, x2, ...)) syntax to create Tuples", "2.8.0")
|
||||
def Tuple[A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13](x1: A1, x2: A2, x3: A3, x4: A4, x5: A5, x6: A6, x7: A7, x8: A8, x9: A9, x10: A10, x11: A11, x12: A12, x13: A13) = Tuple13(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13)
|
||||
@deprecated("Use ((x1, x2, ...)) syntax to create Tuples", "2.8.0")
|
||||
def Tuple[A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14](x1: A1, x2: A2, x3: A3, x4: A4, x5: A5, x6: A6, x7: A7, x8: A8, x9: A9, x10: A10, x11: A11, x12: A12, x13: A13, x14: A14) = Tuple14(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14)
|
||||
@deprecated("Use ((x1, x2, ...)) syntax to create Tuples", "2.8.0")
|
||||
def Tuple[A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15](x1: A1, x2: A2, x3: A3, x4: A4, x5: A5, x6: A6, x7: A7, x8: A8, x9: A9, x10: A10, x11: A11, x12: A12, x13: A13, x14: A14, x15: A15) = Tuple15(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15)
|
||||
@deprecated("Use ((x1, x2, ...)) syntax to create Tuples", "2.8.0")
|
||||
def Tuple[A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16](x1: A1, x2: A2, x3: A3, x4: A4, x5: A5, x6: A6, x7: A7, x8: A8, x9: A9, x10: A10, x11: A11, x12: A12, x13: A13, x14: A14, x15: A15, x16: A16) = Tuple16(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16)
|
||||
@deprecated("Use ((x1, x2, ...)) syntax to create Tuples", "2.8.0")
|
||||
def Tuple[A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17](x1: A1, x2: A2, x3: A3, x4: A4, x5: A5, x6: A6, x7: A7, x8: A8, x9: A9, x10: A10, x11: A11, x12: A12, x13: A13, x14: A14, x15: A15, x16: A16, x17: A17) = Tuple17(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17)
|
||||
@deprecated("Use ((x1, x2, ...)) syntax to create Tuples", "2.8.0")
|
||||
def Tuple[A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18](x1: A1, x2: A2, x3: A3, x4: A4, x5: A5, x6: A6, x7: A7, x8: A8, x9: A9, x10: A10, x11: A11, x12: A12, x13: A13, x14: A14, x15: A15, x16: A16, x17: A17, x18: A18) = Tuple18(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18)
|
||||
@deprecated("Use ((x1, x2, ...)) syntax to create Tuples", "2.8.0")
|
||||
def Tuple[A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19](x1: A1, x2: A2, x3: A3, x4: A4, x5: A5, x6: A6, x7: A7, x8: A8, x9: A9, x10: A10, x11: A11, x12: A12, x13: A13, x14: A14, x15: A15, x16: A16, x17: A17, x18: A18, x19: A19) = Tuple19(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19)
|
||||
@deprecated("Use ((x1, x2, ...)) syntax to create Tuples", "2.8.0")
|
||||
def Tuple[A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20](x1: A1, x2: A2, x3: A3, x4: A4, x5: A5, x6: A6, x7: A7, x8: A8, x9: A9, x10: A10, x11: A11, x12: A12, x13: A13, x14: A14, x15: A15, x16: A16, x17: A17, x18: A18, x19: A19, x20: A20) = Tuple20(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20)
|
||||
@deprecated("Use ((x1, x2, ...)) syntax to create Tuples", "2.8.0")
|
||||
def Tuple[A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21](x1: A1, x2: A2, x3: A3, x4: A4, x5: A5, x6: A6, x7: A7, x8: A8, x9: A9, x10: A10, x11: A11, x12: A12, x13: A13, x14: A14, x15: A15, x16: A16, x17: A17, x18: A18, x19: A19, x20: A20, x21: A21) = Tuple21(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20, x21)
|
||||
@deprecated("Use ((x1, x2, ...)) syntax to create Tuples", "2.8.0")
|
||||
def Tuple[A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22](x1: A1, x2: A2, x3: A3, x4: A4, x5: A5, x6: A6, x7: A7, x8: A8, x9: A9, x10: A10, x11: A11, x12: A12, x13: A13, x14: A14, x15: A15, x16: A16, x17: A17, x18: A18, x19: A19, x20: A20, x21: A21, x22: A22) = Tuple22(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20, x21, x22)
|
||||
|
||||
@deprecated("use java.lang.Integer instead", "2.6.0")
|
||||
type Integer = java.lang.Integer
|
||||
@deprecated("use java.lang.Character instead", "2.6.0")
|
||||
type Character = java.lang.Character
|
||||
|
||||
@deprecated("use Iterable instead", "2.8.0")
|
||||
type Collection[+A] = Iterable[A]
|
||||
@deprecated("use Iterable instead", "2.8.0")
|
||||
val Collection = Iterable
|
||||
|
||||
@deprecated("use Seq instead", "2.8.0")
|
||||
type Sequence[+A] = scala.collection.Seq[A]
|
||||
@deprecated("use Seq instead", "2.8.0")
|
||||
val Sequence = scala.collection.Seq
|
||||
|
||||
@deprecated("use IndexedSeq instead", "2.8.0")
|
||||
type RandomAccessSeq[+A] = scala.collection.IndexedSeq[A]
|
||||
@deprecated("use IndexedSeq instead", "2.8.0")
|
||||
val RandomAccessSeq = scala.collection.IndexedSeq
|
||||
|
||||
@deprecated("use scala.annotation.Annotation instead", "2.9.0")
|
||||
type Annotation = scala.annotation.Annotation
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
/* __ *\
|
||||
** ________ ___ / / ___ Scala API **
|
||||
** / __/ __// _ | / / / _ | (c) 2002-2011, LAMP/EPFL **
|
||||
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
|
||||
** /____/\___/_/ |_/____/_/ | | **
|
||||
** |/ **
|
||||
\* */
|
||||
|
||||
package scala.runtime
|
||||
|
||||
/** See scala.AnyValCompanion.
|
||||
*/
|
||||
@deprecated("Use scala.AnyValCompanion instead", "2.8.0")
|
||||
private[scala] trait AnyValCompanion extends scala.AnyValCompanion { }
|
|
@ -45,14 +45,4 @@ final class RichChar(val self: Char) extends IntegralProxy[Char] {
|
|||
// public static boolean isDefined(char ch)
|
||||
// public static boolean isJavaIdentifierStart(char ch)
|
||||
// public static boolean isJavaIdentifierPart(char ch)
|
||||
|
||||
@deprecated("Use ch.toLower instead", "2.8.0")
|
||||
def toLowerCase: Char = toLower
|
||||
@deprecated("Use ch.toUpper instead", "2.8.0")
|
||||
def toUpperCase: Char = toUpper
|
||||
|
||||
@deprecated("Use ch.isLower instead", "2.8.0")
|
||||
def isLowerCase: Boolean = isLower
|
||||
@deprecated("Use ch.isUpper instead", "2.8.0")
|
||||
def isUpperCase: Boolean = isUpper
|
||||
}
|
||||
|
|
|
@ -32,20 +32,6 @@ import scala.util.parsing.combinator.lexical._
|
|||
*/
|
||||
object JSON extends Parser {
|
||||
|
||||
/**
|
||||
* Parse the given `JSON` string and return a list of elements. If the
|
||||
* string is a `JSON` object it will be a list of pairs. If it's a `JSON`
|
||||
* array it will be be a list of individual elements.
|
||||
*
|
||||
* @param input the given `JSON` string.
|
||||
* @return an optional list of of elements.
|
||||
*/
|
||||
@deprecated("Use parseFull or parseRaw as needed.", "2.8.0")
|
||||
def parse(input: String): Option[List[Any]] = parseRaw(input).map(unRaw).flatMap({
|
||||
case l : List[_] => Some(l)
|
||||
case _ => None
|
||||
})
|
||||
|
||||
/**
|
||||
* This method converts ''raw'' results back into the original, deprecated
|
||||
* form.
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
/* __ *\
|
||||
** ________ ___ / / ___ Scala API **
|
||||
** / __/ __// _ | / / / _ | (c) 2006-2011, LAMP/EPFL **
|
||||
** __\ \/ /__/ __ |/ /__/ __ | **
|
||||
** /____/\___/_/ |_/____/_/ | | **
|
||||
** |/ **
|
||||
\* */
|
||||
|
||||
package scala.util.parsing
|
||||
|
||||
import scala.util.parsing.combinator.token
|
||||
|
||||
// If deprecating the whole package worked, that's what would best
|
||||
// be done, but it doesn't (yet) so it isn't.
|
||||
package object syntax {
|
||||
@deprecated("Moved to scala.util.parsing.combinator.token", "2.8.0")
|
||||
type Tokens = token.Tokens
|
||||
@deprecated("Moved to scala.util.parsing.combinator.token", "2.8.0")
|
||||
type StdTokens = token.StdTokens
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
/* __ *\
|
||||
** ________ ___ / / ___ Scala API **
|
||||
** / __/ __// _ | / / / _ | (c) 2003-2011, LAMP/EPFL **
|
||||
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
|
||||
** /____/\___/_/ |_/____/_/ | | **
|
||||
** |/ **
|
||||
\* */
|
||||
|
||||
package scala.xml
|
||||
|
||||
/** Use this class to match on (unprefixed) attribute values
|
||||
* {{{
|
||||
* val hasName = new HasKeyValue("name")
|
||||
* node match {
|
||||
* case Node("foo", hasName(x), _*) => x // foo had attribute with key "name" and with value x
|
||||
* }
|
||||
* }}}
|
||||
*
|
||||
* @author Burak Emir
|
||||
*/
|
||||
@deprecated("Use UnprefixedAttribute's extractor", "2.8.0")
|
||||
class HasKeyValue(key: String) {
|
||||
def unapplySeq(x: MetaData): Option[Seq[Node]] = x.get(key)
|
||||
}
|
|
@ -49,14 +49,6 @@ object XML extends XMLLoader[Elem]
|
|||
def withSAXParser(p: SAXParser): XMLLoader[Elem] =
|
||||
new XMLLoader[Elem] { override val parser: SAXParser = p }
|
||||
|
||||
@deprecated("Use save() instead", "2.8.0")
|
||||
final def saveFull(filename: String, node: Node, xmlDecl: Boolean, doctype: dtd.DocType): Unit =
|
||||
save(filename, node, encoding, xmlDecl, doctype)
|
||||
|
||||
@deprecated("Use save() instead", "2.8.0")
|
||||
final def saveFull(filename: String, node: Node, enc: String, xmlDecl: Boolean, doctype: dtd.DocType): Unit =
|
||||
save(filename, node, enc, xmlDecl, doctype)
|
||||
|
||||
/** Saves a node to a file with given filename using given encoding
|
||||
* optionally with xmldecl and doctype declaration.
|
||||
*
|
||||
|
|
|
@ -117,9 +117,6 @@ abstract class Component extends UIElement {
|
|||
def verify(c: javax.swing.JComponent) = v(UIElement.cachedWrapper[Component](c))
|
||||
})
|
||||
}*/
|
||||
|
||||
@deprecated("Use mouse instead", "2.8.0") lazy val Mouse = mouse
|
||||
|
||||
/**
|
||||
* Contains publishers for various mouse events. They are separated for
|
||||
* efficiency reasons.
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
/* __ *\
|
||||
** ________ ___ / / ___ Scala API **
|
||||
** / __/ __// _ | / / / _ | (c) 2007-2011, LAMP/EPFL **
|
||||
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
|
||||
** /____/\___/_/ |_/____/_/ | | **
|
||||
** |/ **
|
||||
\* */
|
||||
|
||||
|
||||
|
||||
package scala.swing
|
||||
|
||||
import event.Event
|
||||
import javax.swing._
|
||||
|
||||
/**
|
||||
* Convenience class with utility methods for GUI applications.
|
||||
*/
|
||||
@deprecated("Use SwingApplication instead", "2.8.0") class GUIApplication {
|
||||
|
||||
/**
|
||||
* Called before the GUI is created. Override to customize.
|
||||
*/
|
||||
def init() {}
|
||||
|
||||
/**
|
||||
* Initializes the framework and runs the given program.
|
||||
*/
|
||||
def run(prog: => Unit) = Swing.onEDT { init(); prog }
|
||||
}
|
|
@ -195,24 +195,13 @@ class ListView[A] extends Component {
|
|||
object indices extends Indices(peer.getSelectedIndices) {
|
||||
def -=(n: Int): this.type = { peer.removeSelectionInterval(n,n); this }
|
||||
def +=(n: Int): this.type = { peer.addSelectionInterval(n,n); this }
|
||||
@deprecated("Use ListView.selection.leadIndex", "2.8.0")
|
||||
def leadIndex: Int = peer.getSelectionModel.getLeadSelectionIndex
|
||||
@deprecated("Use ListView.selection.anchorIndex", "2.8.0")
|
||||
def anchorIndex: Int = peer.getSelectionModel.getAnchorSelectionIndex
|
||||
}
|
||||
|
||||
@deprecated("Use ListView.selectIndices", "2.8.0")
|
||||
def selectIndices(ind: Int*) = peer.setSelectedIndices(ind.toArray)
|
||||
|
||||
/**
|
||||
* The currently selected items.
|
||||
*/
|
||||
object items extends scala.collection.SeqProxy[A] {
|
||||
def self = peer.getSelectedValues.map(_.asInstanceOf[A])
|
||||
@deprecated("Use ListView.selection.leadIndex", "2.8.0")
|
||||
def leadIndex: Int = peer.getSelectionModel.getLeadSelectionIndex
|
||||
@deprecated("Use ListView.selection.anchorIndex", "2.8.0")
|
||||
def anchorIndex: Int = peer.getSelectionModel.getAnchorSelectionIndex
|
||||
}
|
||||
|
||||
def intervalMode: IntervalMode.Value = IntervalMode(peer.getSelectionModel.getSelectionMode)
|
||||
|
|
|
@ -1,46 +0,0 @@
|
|||
/* __ *\
|
||||
** ________ ___ / / ___ Scala API **
|
||||
** / __/ __// _ | / / / _ | (c) 2007-2011, LAMP/EPFL **
|
||||
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
|
||||
** /____/\___/_/ |_/____/_/ | | **
|
||||
** |/ **
|
||||
\* */
|
||||
|
||||
package scala.swing
|
||||
|
||||
import javax.swing._
|
||||
|
||||
/**
|
||||
* Extend this class for most simple UI applications. Clients need to
|
||||
* implement the `top` method. Framework initialization is done by this class.
|
||||
*
|
||||
* In order to conform to Swing's threading policy, never implement top or any
|
||||
* additional member that created Swing components as a value unless component
|
||||
* creation happens on the EDT (see `Swing.onEDT` and `Swing.onEDTWait`).
|
||||
* Lazy values are okay for the same reason if they are initialized on the EDT
|
||||
* always.
|
||||
*/
|
||||
@deprecated("Use SimpleSwingApplication instead", "2.8.0") abstract class SimpleGUIApplication extends GUIApplication {
|
||||
|
||||
/**
|
||||
* A GUI application's version of the main method. Called by the default
|
||||
* main method implementation provided by this class.
|
||||
* Implement to return the top-level frame of this application.
|
||||
*/
|
||||
def top: Frame
|
||||
|
||||
/**
|
||||
* Calls top, packs the frame, and displays it.
|
||||
*/
|
||||
def main(args: Array[String]) = run {
|
||||
val t = top
|
||||
t.pack()
|
||||
t.visible = true
|
||||
}
|
||||
|
||||
def resourceFromClassloader(path: String): java.net.URL =
|
||||
this.getClass.getResource(path)
|
||||
|
||||
def resourceFromUserDirectory(path: String): java.io.File =
|
||||
new java.io.File(util.Properties.userDir, path)
|
||||
}
|
|
@ -1,8 +1,27 @@
|
|||
package scala.swing
|
||||
|
||||
/**
|
||||
* Extend this class for most simple UI applications. Clients need to
|
||||
* implement the `top` method. Framework initialization is done by this class.
|
||||
*
|
||||
* In order to conform to Swing's threading policy, never implement top or any
|
||||
* additional member that created Swing components as a value unless component
|
||||
* creation happens on the EDT (see `Swing.onEDT` and `Swing.onEDTWait`).
|
||||
* Lazy values are okay for the same reason if they are initialized on the EDT
|
||||
* always.
|
||||
*/
|
||||
abstract class SimpleSwingApplication extends SwingApplication {
|
||||
|
||||
/**
|
||||
* A GUI application's version of the main method. Called by the default
|
||||
* main method implementation provided by this class.
|
||||
* Implement to return the top-level frame of this application.
|
||||
*/
|
||||
def top: Frame
|
||||
|
||||
/**
|
||||
* Calls `top`, packs the frame, and displays it.
|
||||
*/
|
||||
override def startup(args: Array[String]) {
|
||||
val t = top
|
||||
if (t.size == new Dimension(0,0)) t.pack()
|
||||
|
|
|
@ -1,9 +1,17 @@
|
|||
package scala.swing
|
||||
|
||||
/** Convenience class with utility methods for GUI applications. */
|
||||
abstract class SwingApplication extends Reactor {
|
||||
|
||||
/** Initializes the application and runs the given program. */
|
||||
def main(args: Array[String]) = Swing.onEDT { startup(args) }
|
||||
|
||||
/** Called before the GUI is created. Override to customize. */
|
||||
def startup(args: Array[String])
|
||||
|
||||
/** Finalizes the application by calling `shutdown` and exits.*/
|
||||
def quit() { shutdown(); sys.exit(0) }
|
||||
|
||||
/** Called before the application is exited. Override to customize. */
|
||||
def shutdown() {}
|
||||
}
|
||||
|
|
|
@ -96,9 +96,6 @@ trait UIElement extends Proxy with LazyPublisher {
|
|||
def location = peer.getLocation
|
||||
def bounds = peer.getBounds
|
||||
def size = peer.getSize
|
||||
@deprecated("Explicit size assignment for UIElements is not supported anymore. " +
|
||||
"Use a layout manager or subclass Window.", "2.8.0")
|
||||
def size_=(dim: Dimension) = peer.setSize(dim)
|
||||
|
||||
def locale = peer.getLocale
|
||||
def toolkit = peer.getToolkit
|
||||
|
|
|
@ -61,7 +61,7 @@ abstract class Window extends UIElement with RootPanel with Publisher { outer =>
|
|||
def setLocationRelativeTo(c: UIElement) { peer.setLocationRelativeTo(c.peer) }
|
||||
def centerOnScreen() { peer.setLocationRelativeTo(null) }
|
||||
def location_=(p: Point) { peer.setLocation(p) }
|
||||
override def size_=(size: Dimension) { peer.setSize(size) }
|
||||
def size_=(size: Dimension) { peer.setSize(size) }
|
||||
def bounds_=(rect: Rectangle) { peer.setBounds(rect) }
|
||||
|
||||
def owner: Window = UIElement.cachedWrapper[Window](peer.getOwner)
|
||||
|
|
|
@ -14,12 +14,3 @@ package event
|
|||
trait ComponentEvent extends UIEvent {
|
||||
val source: Component
|
||||
}
|
||||
|
||||
@deprecated("Use UIElementMoved instead.", "2.8.0")
|
||||
case class ComponentMoved(source: Component) extends ComponentEvent
|
||||
@deprecated("Use UIElementResized instead.", "2.8.0")
|
||||
case class ComponentResized(source: Component) extends ComponentEvent
|
||||
@deprecated("Use UIElementShown instead.", "2.8.0")
|
||||
case class ComponentShown(source: Component) extends ComponentEvent
|
||||
@deprecated("Use UIElementHidden instead.", "2.8.0")
|
||||
case class ComponentHidden(source: Component) extends ComponentEvent
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
package scala.swing
|
||||
package test
|
||||
|
||||
import scala.swing.Swing._
|
||||
import scala.swing.{MainFrame, Panel, SimpleGUIApplication}
|
||||
import scala.swing.{MainFrame, Panel}
|
||||
import scala.swing.event._
|
||||
import java.awt.{Color, Dimension, Graphics, Graphics2D, Point, geom}
|
||||
import java.awt.{Color, Graphics2D, Point, geom}
|
||||
|
||||
/**
|
||||
* Dragging the mouse draws a simple graph
|
||||
|
|
|
@ -110,7 +110,7 @@ object Test4 {
|
|||
import java.lang.reflect.AnnotatedElement
|
||||
def printSourceAnnotation(a: Annotation) {
|
||||
val ann = a.asInstanceOf[SourceAnnotation]
|
||||
println("@test.SourceAnnotation(mails=" + ann.mails.deepMkString("{", ",", "}") +
|
||||
println("@test.SourceAnnotation(mails=" + ann.mails.deep.mkString("{", ",", "}") +
|
||||
", value=" + ann.value + ")")
|
||||
}
|
||||
def printSourceAnnotations(target: AnnotatedElement) {
|
||||
|
|
|
@ -1,14 +1,11 @@
|
|||
object Test {
|
||||
import scala.xml.{Node,HasKeyValue}
|
||||
|
||||
def domatch(x:Node): Node = {
|
||||
val hasBar = new HasKeyValue("bar")
|
||||
import scala.xml.{Node,UnprefixedAttribute}
|
||||
|
||||
def domatch(x:Node) =
|
||||
x match {
|
||||
case Node("foo", hasBar(z), _*) => z
|
||||
case Node("foo", UnprefixedAttribute("bar", z, _), _*) => z
|
||||
case _ => null
|
||||
}
|
||||
}
|
||||
|
||||
def main(args: Array[String]): Unit = {
|
||||
println(domatch(<foo bar="baz"><hi/></foo>))
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue