added headers, svn keywords, updated pilib examples
git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@18038 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
This commit is contained in:
parent
c4e803dd52
commit
cdf63878e3
|
@ -1,38 +1,37 @@
|
|||
package examples.pilib
|
||||
|
||||
import scala.concurrent.pilib._
|
||||
//import pilib._;
|
||||
|
||||
/** Church encoding of naturals in the Pi-calculus */
|
||||
object piNat extends Application {
|
||||
|
||||
/** Locations of Pi-calculus natural */
|
||||
class NatChan extends Chan[Triple[Chan[unit], Chan[NatChan], Chan[NatChan]]]
|
||||
class NatChan extends Chan[Triple[Chan[Unit], Chan[NatChan], Chan[NatChan]]]
|
||||
|
||||
/** Zero */
|
||||
def Z(l: NatChan): unit = choice (
|
||||
def Z(l: NatChan): Unit = choice (
|
||||
l * { case Triple(z, sd, d) => z.write(()) }
|
||||
)
|
||||
|
||||
/** Successor of Double */
|
||||
def SD(n: NatChan, l: NatChan): unit = choice (
|
||||
def SD(n: NatChan, l: NatChan): Unit = choice (
|
||||
l * { case Triple(z, sd, d) => sd.write(n) }
|
||||
)
|
||||
|
||||
/** Double */
|
||||
def D(n: NatChan, l: NatChan): unit = choice (
|
||||
def D(n: NatChan, l: NatChan): Unit = choice (
|
||||
l * { case Triple(z, sd, d) => d.write(n) }
|
||||
)
|
||||
|
||||
/** Make "l" a location representing the natural "n" */
|
||||
def make(n: int, l: NatChan): unit =
|
||||
def make(n: Int, l: NatChan): Unit =
|
||||
if (n == 0) Z(l)
|
||||
else if (n % 2 == 0) { val l1 = new NatChan; spawn < D(l1, l) >; make(n/2, l1) }
|
||||
else { val l1 = new NatChan; spawn < SD(l1, l) >; make(n/2, l1) }
|
||||
|
||||
/** Consume the natural "m" and put it successor at location "n" */
|
||||
def Succ(m: NatChan, n: NatChan): unit = {
|
||||
val z = new Chan[unit]
|
||||
def Succ(m: NatChan, n: NatChan) {
|
||||
val z = new Chan[Unit]
|
||||
val sd = new Chan[NatChan]
|
||||
val d = new Chan[NatChan]
|
||||
spawn < m.write(Triple(z, sd, d)) >;
|
||||
|
@ -44,8 +43,8 @@ object piNat extends Application {
|
|||
}
|
||||
|
||||
/** Consume the natural "l" and put two copies at locations "m" and "n" */
|
||||
def Copy(l: NatChan, m: NatChan, n: NatChan): unit = {
|
||||
val z = new Chan[unit]
|
||||
def Copy(l: NatChan, m: NatChan, n: NatChan) {
|
||||
val z = new Chan[Unit]
|
||||
val sd = new Chan[NatChan]
|
||||
val d = new Chan[NatChan]
|
||||
spawn < l.write(Triple(z, sd, d)) >;
|
||||
|
@ -61,8 +60,8 @@ object piNat extends Application {
|
|||
}
|
||||
|
||||
/** Consume the natural at location "n" and return its value */
|
||||
def value(n: NatChan): int = {
|
||||
val z = new Chan[unit]
|
||||
def value(n: NatChan): Int = {
|
||||
val z = new Chan[Unit]
|
||||
val sd = new Chan[NatChan]
|
||||
val d = new Chan[NatChan]
|
||||
spawn < n.write(Triple(z, sd, d)) >;
|
||||
|
@ -84,7 +83,7 @@ object piNat extends Application {
|
|||
make(i, l) |
|
||||
Copy(l, l1, l2) |
|
||||
Succ(l2, l3) |
|
||||
System.out.println("" + i + " = " + value(l1)) |
|
||||
System.out.println("succ " + i + " = " + value(l3)) >
|
||||
println("" + i + " = " + value(l1)) |
|
||||
println("succ " + i + " = " + value(l3)) >
|
||||
|
||||
}
|
||||
|
|
|
@ -7,14 +7,14 @@ object scheduler {
|
|||
/**
|
||||
* Random number generator.
|
||||
*/
|
||||
val random = new java.util.Random()
|
||||
val random = new util.Random()
|
||||
|
||||
//***************** Scheduler ******************//
|
||||
|
||||
/**
|
||||
* A cell of the scheduler whose attached agent is allowed to start.
|
||||
*/
|
||||
def A(a: Chan[unit], b: Chan[unit])(d: Chan[unit], c: Chan[unit]): unit = {
|
||||
def A(a: Chan[Unit], b: Chan[Unit])(d: Chan[Unit], c: Chan[Unit]) {
|
||||
///- ... complete here ...
|
||||
choice ( a * { x => C(a, b)(d, c) })
|
||||
///+
|
||||
|
@ -23,7 +23,7 @@ object scheduler {
|
|||
/**
|
||||
* A cell of the scheduler in another intermediate state.
|
||||
*/
|
||||
def C(a: Chan[unit], b: Chan[unit])(d: Chan[unit], c: Chan[unit]): unit = {
|
||||
def C(a: Chan[Unit], b: Chan[Unit])(d: Chan[Unit], c: Chan[Unit]) {
|
||||
///- ... complete here ...
|
||||
choice (c * { x => B(a, b)(d, c) })
|
||||
///+
|
||||
|
@ -32,7 +32,7 @@ object scheduler {
|
|||
/**
|
||||
* A cell of the scheduler whose attached agent is allowed to finish.
|
||||
*/
|
||||
def B(a: Chan[unit], b: Chan[unit])(d: Chan[unit], c: Chan[unit]): unit = {
|
||||
def B(a: Chan[Unit], b: Chan[Unit])(d: Chan[Unit], c: Chan[Unit]) {
|
||||
///- ... complete here ...
|
||||
// choice (b * { x => D(a, b)(d, c) }) // incorrect naive solution
|
||||
choice (
|
||||
|
@ -45,7 +45,7 @@ object scheduler {
|
|||
/**
|
||||
* A cell of the scheduler whose attached agent is not yet allowed to start.
|
||||
*/
|
||||
def D(a: Chan[unit], b: Chan[unit])(d: Chan[unit], c: Chan[unit]): unit = {
|
||||
def D(a: Chan[Unit], b: Chan[Unit])(d: Chan[Unit], c: Chan[Unit]) {
|
||||
///- ... complete here ...
|
||||
choice (d(()) * A(a, b)(d, c))
|
||||
///+
|
||||
|
@ -53,16 +53,16 @@ object scheduler {
|
|||
|
||||
//***************** Agents ******************//
|
||||
|
||||
def agent(i: Int)(a: Chan[unit], b: Chan[unit]): unit = {
|
||||
def agent(i: Int)(a: Chan[Unit], b: Chan[Unit]) {
|
||||
// 50% chance that we sleep forever
|
||||
if (i == 0 && random.nextInt(10) < 5) {
|
||||
a.attach(x => System.out.println("Start and sleeps ----> " + i))
|
||||
a.attach(x => println("Start and sleeps ----> " + i))
|
||||
Thread.sleep(random.nextInt(1000))
|
||||
a.write(())
|
||||
}
|
||||
else {
|
||||
a.attach(x => System.out.println("Start ----> " + i))
|
||||
b.attach(x => System.out.println("Stop -> " + i))
|
||||
a.attach(x => println("Start ----> " + i))
|
||||
b.attach(x => println("Stop -> " + i))
|
||||
Thread.sleep(random.nextInt(1000))
|
||||
a.write(())
|
||||
Thread.sleep(random.nextInt(1000))
|
||||
|
@ -77,7 +77,7 @@ object scheduler {
|
|||
* Creates a scheduler for five agents (programs).
|
||||
*/
|
||||
|
||||
def main(args: Array[String]): unit = {
|
||||
def main(args: Array[String]) {
|
||||
val agentNb = 5
|
||||
val agents = List.range(0, agentNb) map agent
|
||||
scheduleAgents(agents)
|
||||
|
@ -89,22 +89,22 @@ object scheduler {
|
|||
* A cell is modelled as a function that takes as parameters
|
||||
* input and output channels and which returns nothing.
|
||||
*/
|
||||
type Cell = (Chan[unit], Chan[unit]) => unit
|
||||
type Cell = (Chan[Unit], Chan[Unit]) => Unit
|
||||
|
||||
/**
|
||||
* Creates a cell composed of two cells linked together.
|
||||
*/
|
||||
def join(cell1: Cell, cell2: Cell): Cell =
|
||||
(l: Chan[unit], r: Chan[unit]) => {
|
||||
val link = new Chan[unit];
|
||||
(l: Chan[Unit], r: Chan[Unit]) => {
|
||||
val link = new Chan[Unit];
|
||||
spawn < cell1(l, link) | cell2(link, r) >
|
||||
};
|
||||
|
||||
/**
|
||||
* Links the output of a cell to its input.
|
||||
*/
|
||||
def close(cell: Cell): unit = {
|
||||
val a = new Chan[unit]
|
||||
def close(cell: Cell) {
|
||||
val a = new Chan[Unit]
|
||||
cell(a, a)
|
||||
}
|
||||
|
||||
|
@ -117,25 +117,25 @@ object scheduler {
|
|||
/**
|
||||
* Creates a cell consisting of a chain of cells.
|
||||
*/
|
||||
def makeRing(cells: List[Cell]): unit =
|
||||
def makeRing(cells: List[Cell]): Unit =
|
||||
close(chain(cells))
|
||||
|
||||
/**
|
||||
* An agent is modelled as a function that takes as parameters channels to
|
||||
* signal that it has started or finished.
|
||||
*/
|
||||
type Agent = (Chan[unit], Chan[unit]) => unit
|
||||
type Agent = (Chan[Unit], Chan[Unit]) => Unit
|
||||
|
||||
/**
|
||||
* Takes a list of agents and schedules them.
|
||||
*/
|
||||
def scheduleAgents(agents: List[Agent]): unit = {
|
||||
def scheduleAgents(agents: List[Agent]) {
|
||||
var firstAgent = true;
|
||||
val cells = agents map (ag => {
|
||||
val a = new Chan[unit];
|
||||
val b = new Chan[unit];
|
||||
val a = new Chan[Unit];
|
||||
val b = new Chan[Unit];
|
||||
spawn < ag(a, b) >;
|
||||
(d: Chan[unit], c: Chan[unit]) => if (firstAgent) {
|
||||
(d: Chan[Unit], c: Chan[Unit]) => if (firstAgent) {
|
||||
firstAgent = false;
|
||||
A(a, b)(d, c)
|
||||
}
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
package examples.pilib
|
||||
|
||||
import scala.concurrent.pilib._
|
||||
|
||||
/** Solution of exercise session 6 (first question). */
|
||||
object semaphore {
|
||||
|
||||
import scala.concurrent.pilib._
|
||||
|
||||
class Signal extends Chan[unit] {
|
||||
class Signal extends Chan[Unit] {
|
||||
def send = write(())
|
||||
def receive = read
|
||||
}
|
||||
|
||||
/** Interface. */
|
||||
trait Semaphore {
|
||||
def get: unit
|
||||
def release: unit
|
||||
def get: Unit
|
||||
def release: Unit
|
||||
}
|
||||
|
||||
/** First implementation. */
|
||||
|
@ -22,10 +22,10 @@ object semaphore {
|
|||
private val g = new Signal
|
||||
private val r = new Signal
|
||||
|
||||
def get: unit = g.send
|
||||
def release: unit = r.send
|
||||
def get: Unit = g.send
|
||||
def release: Unit = r.send
|
||||
|
||||
private def Sched: unit = choice (
|
||||
private def Sched: Unit = choice (
|
||||
g * (x => { r.receive; Sched }),
|
||||
r * (x => Sched)
|
||||
)
|
||||
|
@ -38,8 +38,8 @@ object semaphore {
|
|||
private val a = new Signal
|
||||
private val na = new Signal
|
||||
|
||||
def get: unit = { a.receive; spawn< na.send > }
|
||||
def release: unit = choice (
|
||||
def get { a.receive; spawn< na.send > }
|
||||
def release: Unit = choice (
|
||||
a * (x => spawn< a.send >),
|
||||
na * (x => spawn< a.send >)
|
||||
)
|
||||
|
@ -47,24 +47,24 @@ object semaphore {
|
|||
}
|
||||
|
||||
/** Test program. */
|
||||
def main(args: Array[String]): unit = {
|
||||
val random = new java.util.Random()
|
||||
def main(args: Array[String]) {
|
||||
val random = new util.Random()
|
||||
val sem = new Sem2
|
||||
def mutex(p: => unit): unit = { sem.get; p; sem.release }
|
||||
def mutex(p: => Unit) { sem.get; p; sem.release }
|
||||
|
||||
spawn< {
|
||||
Thread.sleep(1 + random.nextInt(100));
|
||||
mutex( {
|
||||
System.out.println("a1");
|
||||
println("a1");
|
||||
Thread.sleep(1 + random.nextInt(100));
|
||||
System.out.println("a2")
|
||||
println("a2")
|
||||
} )
|
||||
} | {
|
||||
Thread.sleep(1 + random.nextInt(100));
|
||||
mutex( {
|
||||
System.out.println("b1");
|
||||
println("b1");
|
||||
Thread.sleep(1 + random.nextInt(100));
|
||||
System.out.println("b2")
|
||||
println("b2")
|
||||
} )
|
||||
} >;
|
||||
}
|
||||
|
|
|
@ -8,18 +8,18 @@ object twoPlaceBuffer extends Application {
|
|||
/**
|
||||
* Specification.
|
||||
*/
|
||||
def Spec[a](in: Chan[a], out: Chan[a]): Unit = {
|
||||
def Spec[A](in: Chan[A], out: Chan[A]) {
|
||||
|
||||
def B0: unit = choice (
|
||||
def B0: Unit = choice (
|
||||
in * (x => B1(x))
|
||||
)
|
||||
|
||||
def B1(x: a): unit = choice (
|
||||
def B1(x: A): Unit = choice (
|
||||
out(x) * (B0),
|
||||
in * (y => B2(x, y))
|
||||
)
|
||||
|
||||
def B2(x: a, y: a): unit = choice (
|
||||
def B2(x: A, y: A): Unit = choice (
|
||||
out(x) * (B1(y))
|
||||
)
|
||||
|
||||
|
@ -29,38 +29,38 @@ object twoPlaceBuffer extends Application {
|
|||
/**
|
||||
* Implementation using two one-place buffers.
|
||||
*/
|
||||
def Impl[a](in: Chan[a], out: Chan[a]): unit = {
|
||||
def Impl[A](in: Chan[A], out: Chan[A]) {
|
||||
///- ... complete here ...
|
||||
// one-place buffer
|
||||
def OnePlaceBuffer[a](in: Chan[a], out: Chan[a]): Unit = {
|
||||
def B0: unit = choice ( in * (x => B1(x)) )
|
||||
def B1(x: a): unit = choice ( out(x) * (B0))
|
||||
def OnePlaceBuffer[A](in: Chan[A], out: Chan[A]) {
|
||||
def B0: Unit = choice ( in * (x => B1(x)) )
|
||||
def B1(x: A): Unit = choice ( out(x) * (B0))
|
||||
B0
|
||||
}
|
||||
val hidden = new Chan[a]
|
||||
val hidden = new Chan[A]
|
||||
spawn < OnePlaceBuffer(in, hidden) | OnePlaceBuffer(hidden, out) >
|
||||
///+
|
||||
}
|
||||
|
||||
val random = new java.util.Random()
|
||||
val random = new util.Random()
|
||||
|
||||
def Producer(n: Int, in: Chan[String]): Unit = {
|
||||
def Producer(n: Int, in: Chan[String]) {
|
||||
Thread.sleep(random.nextInt(1000))
|
||||
val msg = "" + n
|
||||
choice (in(msg) * {})
|
||||
Producer(n + 1, in)
|
||||
}
|
||||
|
||||
def Consumer(out: Chan[String]): unit = {
|
||||
Thread.sleep(random.nextInt(1000));
|
||||
choice (out * { msg => () });
|
||||
def Consumer(out: Chan[String]) {
|
||||
Thread.sleep(random.nextInt(1000))
|
||||
choice (out * { msg => () })
|
||||
Consumer(out)
|
||||
}
|
||||
|
||||
val in = new Chan[String]
|
||||
in.attach(s => System.out.println("put " + s))
|
||||
in.attach(s => println("put " + s))
|
||||
val out = new Chan[String]
|
||||
out.attach(s => System.out.println("get " + s))
|
||||
out.attach(s => println("get " + s))
|
||||
//spawn < Producer(0, in) | Consumer(out) | Spec(in, out) >
|
||||
spawn < Producer(0, in) | Consumer(out) | Impl(in, out) >
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
** |/ **
|
||||
\* */
|
||||
|
||||
// $Id: Iterable.scala 15188 2008-05-24 15:01:02Z stepancheg $
|
||||
// $Id$
|
||||
|
||||
package scala.collection.generic
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
** |/ **
|
||||
\* */
|
||||
|
||||
// $Id: ListBuffer.scala 14378 2008-03-13 11:39:05Z dragos $
|
||||
// $Id$
|
||||
|
||||
package scala.collection.generic
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
** /____/\___/_/ |_/____/_/ | | **
|
||||
** |/ **
|
||||
\* */
|
||||
// $Id: Traversable.scala 15188 2008-05-24 15:01:02Z stepancheg $
|
||||
// $Id$
|
||||
package scala.collection.generic
|
||||
|
||||
trait BitSetFactory[Coll <: BitSet with BitSetTemplate[Coll]] {
|
||||
|
|
|
@ -1,3 +1,14 @@
|
|||
/* __ *\
|
||||
** ________ ___ / / ___ Scala API **
|
||||
** / __/ __// _ | / / / _ | (c) 2003-2009, LAMP/EPFL **
|
||||
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
|
||||
** /____/\___/_/ |_/____/_/ | | **
|
||||
** |/ **
|
||||
\* */
|
||||
|
||||
// $Id$
|
||||
|
||||
|
||||
package scala.collection.generic
|
||||
|
||||
import BitSetTemplate._
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
** |/ **
|
||||
\* */
|
||||
|
||||
// $Id: Buffer.scala 15799 2008-08-15 18:23:54Z odersky $
|
||||
// $Id$
|
||||
|
||||
|
||||
package scala.collection.generic
|
||||
|
|
|
@ -6,14 +6,14 @@
|
|||
** |/ **
|
||||
\* */
|
||||
|
||||
// $Id: ListBuffer.scala 14378 2008-03-13 11:39:05Z dragos $
|
||||
// $Id$
|
||||
|
||||
package scala.collection.generic
|
||||
|
||||
/** The base trait of all builders.
|
||||
* A builder lets one construct a collection incrementally, by adding elements
|
||||
* to the builder with += and then converting to the required collection type with
|
||||
* `result`.
|
||||
* A builder lets one construct a collection incrementally, by adding
|
||||
* elements to the builder with += and then converting to the required
|
||||
* collection type with `result`.
|
||||
*/
|
||||
trait Builder[-Elem, +To] extends Growable[Elem] {
|
||||
|
||||
|
@ -26,7 +26,8 @@ trait Builder[-Elem, +To] extends Growable[Elem] {
|
|||
*/
|
||||
def clear()
|
||||
|
||||
/** Returns collection resulting from this builder. The buffer's contents are undefined afterwards.
|
||||
/** Returns collection resulting from this builder. The buffer's contents
|
||||
* are undefined afterwards.
|
||||
*/
|
||||
def result(): To
|
||||
|
||||
|
@ -35,8 +36,8 @@ trait Builder[-Elem, +To] extends Growable[Elem] {
|
|||
*/
|
||||
def sizeHint(size: Int) {}
|
||||
|
||||
/** Create a new builder which is the same as the current builder except that
|
||||
* a given function is applied to the current builder's result.
|
||||
/** Create a new builder which is the same as the current builder except
|
||||
* that a given function is applied to the current builder's result.
|
||||
* @param f the function to apply to the builder's result
|
||||
*/
|
||||
def mapResult[NewTo](f: To => NewTo): Builder[Elem, NewTo] =
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
** |/ **
|
||||
\* */
|
||||
|
||||
// $Id: ListBuffer.scala 14378 2008-03-13 11:39:05Z dragos $
|
||||
// $Id$
|
||||
|
||||
package scala.collection.generic
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
** |/ **
|
||||
\* */
|
||||
|
||||
// $Id: CloneableCollection.scala 16893 2009-01-13 13:09:22Z cunei $
|
||||
// $Id$
|
||||
|
||||
|
||||
package scala.collection.generic
|
||||
|
|
|
@ -5,7 +5,10 @@
|
|||
** /____/\___/_/ |_/____/_/ | | **
|
||||
** |/ **
|
||||
\* */
|
||||
// $Id: Traversable.scala 15188 2008-05-24 15:01:02Z stepancheg $
|
||||
|
||||
// $Id$
|
||||
|
||||
|
||||
package scala.collection.generic
|
||||
|
||||
abstract class Companion[+CC[X] <: Traversable[X]] {
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
/* __ *\
|
||||
** ________ ___ / / ___ Scala API **
|
||||
** / __/ __// _ | / / / _ | (c) 2003-2009, LAMP/EPFL **
|
||||
** __\ \/ /__/ __ |/ /__/ __ | **
|
||||
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
|
||||
** /____/\___/_/ |_/____/_/ | | **
|
||||
** |/ **
|
||||
\* */
|
||||
|
||||
// $Id: DoubleLinkedList.scala 16893 2009-01-13 13:09:22Z cunei $
|
||||
// $Id$
|
||||
|
||||
|
||||
package scala.collection.generic
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
** |/ **
|
||||
\* */
|
||||
|
||||
// $Id: Iterable.scala 15188 2008-05-24 15:01:02Z stepancheg $
|
||||
// $Id$
|
||||
|
||||
package scala.collection.generic
|
||||
|
||||
|
|
|
@ -1,6 +1,17 @@
|
|||
/* __ *\
|
||||
** ________ ___ / / ___ Scala API **
|
||||
** / __/ __// _ | / / / _ | (c) 2003-2009, LAMP/EPFL **
|
||||
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
|
||||
** /____/\___/_/ |_/____/_/ | | **
|
||||
** |/ **
|
||||
\* */
|
||||
|
||||
// $Id$
|
||||
|
||||
package scala.collection.generic
|
||||
|
||||
/** A template for companion objects of immutable.Map and subclasses thereof.
|
||||
/** A template for companion objects of <code>immutable.Map</code> and
|
||||
* subclasses thereof.
|
||||
*/
|
||||
abstract class ImmutableMapFactory[CC[A, +B] <: immutable.Map[A, B] with ImmutableMapTemplate[A, B, CC[A, B]]]
|
||||
extends MapFactory[CC] {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
** |/ **
|
||||
\* */
|
||||
|
||||
// $Id: Map.scala 16884 2009-01-09 16:52:09Z cunei $
|
||||
// $Id$
|
||||
|
||||
|
||||
package scala.collection.generic
|
||||
|
|
|
@ -1,3 +1,14 @@
|
|||
/* __ *\
|
||||
** ________ ___ / / ___ Scala API **
|
||||
** / __/ __// _ | / / / _ | (c) 2003-2009, LAMP/EPFL **
|
||||
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
|
||||
** /____/\___/_/ |_/____/_/ | | **
|
||||
** |/ **
|
||||
\* */
|
||||
|
||||
// $Id$
|
||||
|
||||
|
||||
package scala.collection.generic
|
||||
|
||||
/** A template for companion objects of immutable.Map and subclasses thereof.
|
||||
|
|
|
@ -1,3 +1,14 @@
|
|||
/* __ *\
|
||||
** ________ ___ / / ___ Scala API **
|
||||
** / __/ __// _ | / / / _ | (c) 2003-2009, LAMP/EPFL **
|
||||
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
|
||||
** /____/\___/_/ |_/____/_/ | | **
|
||||
** |/ **
|
||||
\* */
|
||||
|
||||
// $Id$
|
||||
|
||||
|
||||
package scala.collection.generic
|
||||
|
||||
/** A template for companion objects of mutable.Map and subclasses thereof.
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
** |/ **
|
||||
\* */
|
||||
|
||||
// $Id: IterableProxy.scala 15458 2008-06-28 20:23:22Z stepancheg $
|
||||
// $Id$
|
||||
|
||||
|
||||
package scala.collection.generic
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
** |/ **
|
||||
\* */
|
||||
|
||||
// $Id: IterableProxy.scala 15458 2008-06-28 20:23:22Z stepancheg $
|
||||
// $Id$
|
||||
|
||||
|
||||
package scala.collection.generic
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
** |/ **
|
||||
\* */
|
||||
|
||||
// $Id: Iterable.scala 15188 2008-05-24 15:01:02Z stepancheg $
|
||||
// $Id$
|
||||
|
||||
package scala.collection.generic
|
||||
|
||||
|
|
|
@ -5,9 +5,12 @@
|
|||
** /____/\___/_/ |_/____/_/ | | **
|
||||
** |/ **
|
||||
\* */
|
||||
|
||||
// $Id$
|
||||
|
||||
|
||||
package scala.collection.generic
|
||||
|
||||
import Math.MAX_INT
|
||||
import TraversableView.NoBuilder
|
||||
|
||||
/** A base class for views of Iterables.
|
||||
|
|
|
@ -5,9 +5,12 @@
|
|||
** /____/\___/_/ |_/____/_/ | | **
|
||||
** |/ **
|
||||
\* */
|
||||
|
||||
// $Id$
|
||||
|
||||
|
||||
package scala.collection.generic
|
||||
|
||||
import Math.MAX_INT
|
||||
import TraversableView.NoBuilder
|
||||
|
||||
/** A base class for views of Iterables.
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
** |/ **
|
||||
\* */
|
||||
|
||||
// $Id: ListBuffer.scala 14378 2008-03-13 11:39:05Z dragos $
|
||||
// $Id$
|
||||
|
||||
package scala.collection.generic
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
** |/ **
|
||||
\* */
|
||||
|
||||
// $Id: Sequence.scala 16092 2008-09-12 10:37:06Z nielsen $
|
||||
// $Id$
|
||||
|
||||
|
||||
package scala.collection.generic
|
||||
|
@ -19,8 +19,8 @@ import util.control.Breaks._
|
|||
/** Class <code>Linear[A]</code> represents linear sequences of elements.
|
||||
* For such sequences `isEmpty`, `head` and `tail` are guaranteed to be
|
||||
* efficient constant time (or near so) operations.
|
||||
* It does not add any methods to Sequence but overrides several
|
||||
* methods with optimized implementations.
|
||||
* It does not add any methods to <code>Sequence</code> but overrides
|
||||
* several methods with optimized implementations.
|
||||
*
|
||||
* @author Martin Odersky
|
||||
* @author Matthias Zenger
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
** |/ **
|
||||
\* */
|
||||
|
||||
// $Id: SingleLinkedList.scala 16893 2009-01-13 13:09:22Z cunei $
|
||||
// $Id$
|
||||
|
||||
|
||||
package scala.collection.generic
|
||||
|
@ -79,7 +79,7 @@ trait LinkedListTemplate[A, This >: Null <: Sequence[A] with LinkedListTemplate[
|
|||
}
|
||||
}
|
||||
|
||||
override def foreach[B](f: A => B): Unit = {
|
||||
override def foreach[B](f: A => B) {
|
||||
var these = this
|
||||
while (these ne null) {
|
||||
f(these.elem);
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
** |/ **
|
||||
\* */
|
||||
|
||||
// $Id: ListBuffer.scala 14378 2008-03-13 11:39:05Z dragos $
|
||||
// $Id$
|
||||
|
||||
package scala.collection.generic
|
||||
|
||||
|
|
|
@ -1,6 +1,18 @@
|
|||
/* __ *\
|
||||
** ________ ___ / / ___ Scala API **
|
||||
** / __/ __// _ | / / / _ | (c) 2003-2009, LAMP/EPFL **
|
||||
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
|
||||
** /____/\___/_/ |_/____/_/ | | **
|
||||
** |/ **
|
||||
\* */
|
||||
|
||||
// $Id$
|
||||
|
||||
|
||||
package scala.collection.generic
|
||||
|
||||
/** A template for companion objects of mutable.Map and subclasses thereof.
|
||||
/** A template for companion objects of <code>mutable.Map</code> and
|
||||
* subclasses thereof.
|
||||
*/
|
||||
abstract class MapFactory[CC[A, B] <: Map[A, B] with MapTemplate[A, B, CC[A, B]]] {
|
||||
|
||||
|
|
|
@ -6,24 +6,24 @@
|
|||
** |/ **
|
||||
\* */
|
||||
|
||||
// $Id: Map.scala 16884 2009-01-09 16:52:09Z cunei $
|
||||
// $Id$
|
||||
|
||||
|
||||
package scala.collection.generic
|
||||
|
||||
/** A generic template for maps from keys of type A to values of type B.
|
||||
* To implement a concrete map, you need to provide implementations of the following methods:
|
||||
* (where `This` is the type of the map in question):
|
||||
* To implement a concrete map, you need to provide implementations of the
|
||||
* following methods (where `This` is the type of the map in question):<pre>
|
||||
*
|
||||
* def get(key: A): Option[B]
|
||||
* def iterator: Iterator[(A, B)]
|
||||
* def + [B1 >: B](kv: (A, B1)): This
|
||||
* def -(key: A): This
|
||||
* def -(key: A): This</pre>
|
||||
*
|
||||
* If you wish that methods like, take, drop, filter return the same kind of map, you should also
|
||||
* override:
|
||||
* If you wish that methods like, take, drop, filter return the same kind of
|
||||
* map, you should also override:<pre>
|
||||
*
|
||||
* def empty: This
|
||||
* def empty: This</pre>
|
||||
*
|
||||
* It is also good idea to override methods foreach and size for efficiency.
|
||||
*/
|
||||
|
|
|
@ -1,3 +1,14 @@
|
|||
/* __ *\
|
||||
** ________ ___ / / ___ Scala API **
|
||||
** / __/ __// _ | / / / _ | (c) 2003-2009, LAMP/EPFL **
|
||||
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
|
||||
** /____/\___/_/ |_/____/_/ | | **
|
||||
** |/ **
|
||||
\* */
|
||||
|
||||
// $Id$
|
||||
|
||||
|
||||
package scala.collection.generic
|
||||
|
||||
/** A template for companion objects of mutable.Map and subclasses thereof.
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
** |/ **
|
||||
\* */
|
||||
|
||||
// $Id: Map.scala 16884 2009-01-09 16:52:09Z cunei $
|
||||
// $Id$
|
||||
|
||||
|
||||
package scala.collection.generic
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
** |/ **
|
||||
\* */
|
||||
|
||||
// $Id: Map.scala 16884 2009-01-09 16:52:09Z cunei $
|
||||
// $Id$
|
||||
|
||||
|
||||
package scala.collection.generic
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
** |/ **
|
||||
\* */
|
||||
|
||||
// $Id: Map.scala 16884 2009-01-09 16:52:09Z cunei $
|
||||
// $Id$
|
||||
|
||||
|
||||
package scala.collection.generic
|
||||
|
|
|
@ -5,6 +5,10 @@
|
|||
** /____/\___/_/ |_/____/_/ | | **
|
||||
** |/ **
|
||||
\* */
|
||||
|
||||
// $Id$
|
||||
|
||||
|
||||
package scala.collection.generic
|
||||
|
||||
/** A subtrait of collection.Vector which represents sequences
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
** |/ **
|
||||
\* */
|
||||
|
||||
// $Id: Sequence.scala 16092 2008-09-12 10:37:06Z nielsen $
|
||||
// $Id$
|
||||
|
||||
|
||||
package scala.collection.generic
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
** |/ **
|
||||
\* */
|
||||
|
||||
// $Id: Sequence.scala 16092 2008-09-12 10:37:06Z nielsen $
|
||||
// $Id$
|
||||
|
||||
|
||||
package scala.collection.generic
|
||||
|
|
|
@ -1,3 +1,14 @@
|
|||
/* __ *\
|
||||
** ________ ___ / / ___ Scala API **
|
||||
** / __/ __// _ | / / / _ | (c) 2003-2009, LAMP/EPFL **
|
||||
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
|
||||
** /____/\___/_/ |_/____/_/ | | **
|
||||
** |/ **
|
||||
\* */
|
||||
|
||||
// $Id$
|
||||
|
||||
|
||||
package scala.collection.generic
|
||||
|
||||
/** A template for companion objects of Sequence and subclasses thereof.
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
** |/ **
|
||||
\* */
|
||||
|
||||
// $Id: SeqProxy.scala 15458 2008-06-28 20:23:22Z stepancheg $
|
||||
// $Id$
|
||||
|
||||
|
||||
package scala.collection.generic
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
** |/ **
|
||||
\* */
|
||||
|
||||
// $Id: IterableProxy.scala 15458 2008-06-28 20:23:22Z stepancheg $
|
||||
// $Id$
|
||||
|
||||
|
||||
package scala.collection.generic
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
** |/ **
|
||||
\* */
|
||||
|
||||
// $Id: Sequence.scala 16092 2008-09-12 10:37:06Z nielsen $
|
||||
// $Id$
|
||||
|
||||
|
||||
package scala.collection.generic
|
||||
|
@ -181,7 +181,8 @@ trait SequenceTemplate[+A, +This <: IterableTemplate[A, This] with Sequence[A]]
|
|||
}
|
||||
|
||||
/** Returns index of the first element satisying a predicate, or -1. */
|
||||
@deprecated("Use `indexWhere' instead") def findIndexOf(p: A => Boolean): Int = indexWhere(p)
|
||||
@deprecated("Use `indexWhere' instead")
|
||||
def findIndexOf(p: A => Boolean): Int = indexWhere(p)
|
||||
|
||||
/** Returns the index of the first occurence of the specified
|
||||
* object in this iterable object.
|
||||
|
@ -265,7 +266,8 @@ trait SequenceTemplate[+A, +This <: IterableTemplate[A, This] with Sequence[A]]
|
|||
*/
|
||||
def reverseIterator: Iterator[A] = reverse.iterator
|
||||
|
||||
@deprecated("use `reverseIterator' instead") def reversedElements = reverseIterator
|
||||
@deprecated("use `reverseIterator' instead")
|
||||
def reversedElements = reverseIterator
|
||||
|
||||
/**
|
||||
* Checks whether the argument sequence is contained at the
|
||||
|
@ -517,6 +519,7 @@ trait SequenceTemplate[+A, +This <: IterableTemplate[A, This] with Sequence[A]]
|
|||
* <code>map</code>, and <code>flatMap</code> methods that build projections
|
||||
* of the collection.
|
||||
*/
|
||||
@deprecated("use `view' instead") override def projection = view
|
||||
@deprecated("use `view' instead")
|
||||
override def projection = view
|
||||
}
|
||||
|
||||
|
|
|
@ -6,12 +6,11 @@
|
|||
** |/ **
|
||||
\* */
|
||||
|
||||
// $Id: Sequence.scala 16092 2008-09-12 10:37:06Z nielsen $
|
||||
// $Id$
|
||||
|
||||
|
||||
package scala.collection.generic
|
||||
|
||||
import Sequence.fill
|
||||
import TraversableView.NoBuilder
|
||||
|
||||
/** A non-strict projection of an iterable.
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
** |/ **
|
||||
\* */
|
||||
|
||||
// $Id: Sequence.scala 16092 2008-09-12 10:37:06Z nielsen $
|
||||
// $Id$
|
||||
|
||||
|
||||
package scala.collection.generic
|
||||
|
|
|
@ -6,14 +6,14 @@
|
|||
** |/ **
|
||||
\* */
|
||||
|
||||
// $Id: ListBuffer.scala 14378 2008-03-13 11:39:05Z dragos $
|
||||
// $Id$
|
||||
|
||||
package scala.collection.generic
|
||||
|
||||
// import collection.immutable.{List, Nil, ::}
|
||||
|
||||
/** The canonical builder for collections that are addable, i.e. that support an efficient + method
|
||||
* which adds an element to the collection.
|
||||
/** 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.
|
||||
*/
|
||||
|
|
|
@ -5,7 +5,10 @@
|
|||
** /____/\___/_/ |_/____/_/ | | **
|
||||
** |/ **
|
||||
\* */
|
||||
// $Id: Traversable.scala 15188 2008-05-24 15:01:02Z stepancheg $
|
||||
|
||||
// $Id$
|
||||
|
||||
|
||||
package scala.collection.generic
|
||||
|
||||
trait SetClass[A, +CC[X] <: Set[X]] extends TraversableClass[A, CC] {
|
||||
|
|
|
@ -1,6 +1,18 @@
|
|||
/* __ *\
|
||||
** ________ ___ / / ___ Scala API **
|
||||
** / __/ __// _ | / / / _ | (c) 2003-2009, LAMP/EPFL **
|
||||
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
|
||||
** /____/\___/_/ |_/____/_/ | | **
|
||||
** |/ **
|
||||
\* */
|
||||
|
||||
// $Id$
|
||||
|
||||
|
||||
package scala.collection.generic
|
||||
|
||||
/** A template for companion objects of Map and subclasses thereof.
|
||||
/** A template for companion objects of <code>Map</code> and subclasses
|
||||
* thereof.
|
||||
*/
|
||||
abstract class SetFactory[CC[X] <: Set[X] with SetTemplate[X, CC[X]]]
|
||||
extends Companion[CC] {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
** |/ **
|
||||
\* */
|
||||
|
||||
// $Id: Iterable.scala 15188 2008-05-24 15:01:02Z stepancheg $
|
||||
// $Id$
|
||||
|
||||
package scala.collection.generic
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
** |/ **
|
||||
\* */
|
||||
|
||||
// $Id: Iterable.scala 15188 2008-05-24 15:01:02Z stepancheg $
|
||||
// $Id$
|
||||
|
||||
package scala.collection.generic
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
** |/ **
|
||||
\* */
|
||||
|
||||
// $Id: Sorted.scala 17537 2009-04-20 18:37:37Z odersky $
|
||||
// $Id$
|
||||
|
||||
package scala.collection.generic
|
||||
|
||||
|
|
|
@ -1,3 +1,14 @@
|
|||
/* __ *\
|
||||
** ________ ___ / / ___ Scala API **
|
||||
** / __/ __// _ | / / / _ | (c) 2003-2009, LAMP/EPFL **
|
||||
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
|
||||
** /____/\___/_/ |_/____/_/ | | **
|
||||
** |/ **
|
||||
\* */
|
||||
|
||||
// $Id$
|
||||
|
||||
|
||||
package scala.collection.generic
|
||||
|
||||
/** A template for companion objects of mutable.Map and subclasses thereof.
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
/* __ *\
|
||||
** ________ ___ / / ___ Scala API **
|
||||
** / __/ __// _ | / / / _ | (c) 2006-2009, LAMP/EPFL **
|
||||
** __\ \/ /__/ __ |/ /__/ __ | **
|
||||
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
|
||||
** /____/\___/_/ |_/____/_/ | | **
|
||||
** |/ **
|
||||
\* */
|
||||
|
||||
// $Id: SortedMap.scala 16893 2009-01-13 13:09:22Z cunei $
|
||||
// $Id$
|
||||
|
||||
|
||||
package scala.collection.generic
|
||||
|
||||
/** A template for maps whose keys are sorted.
|
||||
|
|
|
@ -1,3 +1,14 @@
|
|||
/* __ *\
|
||||
** ________ ___ / / ___ Scala API **
|
||||
** / __/ __// _ | / / / _ | (c) 2006-2009, LAMP/EPFL **
|
||||
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
|
||||
** /____/\___/_/ |_/____/_/ | | **
|
||||
** |/ **
|
||||
\* */
|
||||
|
||||
// $Id$
|
||||
|
||||
|
||||
package scala.collection.generic
|
||||
|
||||
/** A template for companion objects of Set and subclasses thereof.
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
** |/ **
|
||||
\* */
|
||||
|
||||
// $Id: SortedSet.scala 16893 2009-01-13 13:09:22Z cunei $
|
||||
// $Id$
|
||||
// !!! todo: integrate in new collections library
|
||||
|
||||
package scala.collection.generic
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
** |/ **
|
||||
\* */
|
||||
|
||||
// $Id: Iterable.scala 15188 2008-05-24 15:01:02Z stepancheg $
|
||||
// $Id$
|
||||
|
||||
package scala.collection.generic
|
||||
|
||||
|
|
|
@ -5,7 +5,10 @@
|
|||
** /____/\___/_/ |_/____/_/ | | **
|
||||
** |/ **
|
||||
\* */
|
||||
// $Id: Traversable.scala 15188 2008-05-24 15:01:02Z stepancheg $
|
||||
|
||||
// $Id$
|
||||
|
||||
|
||||
package scala.collection.generic
|
||||
|
||||
trait TraversableClass[+A, +CC[X] <: Traversable[X]] {
|
||||
|
|
|
@ -1,3 +1,14 @@
|
|||
/* __ *\
|
||||
** ________ ___ / / ___ Scala API **
|
||||
** / __/ __// _ | / / / _ | (c) 2006-2009, LAMP/EPFL **
|
||||
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
|
||||
** /____/\___/_/ |_/____/_/ | | **
|
||||
** |/ **
|
||||
\* */
|
||||
|
||||
// $Id$
|
||||
|
||||
|
||||
package scala.collection.generic
|
||||
|
||||
/** A template for companion objects of Traversable and subclasses thereof.
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
** |/ **
|
||||
\* */
|
||||
|
||||
// $Id: IterableProxy.scala 15458 2008-06-28 20:23:22Z stepancheg $
|
||||
// $Id$
|
||||
|
||||
|
||||
package scala.collection.generic
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
** |/ **
|
||||
\* */
|
||||
|
||||
// $Id: IterableProxy.scala 15458 2008-06-28 20:23:22Z stepancheg $
|
||||
// $Id$
|
||||
|
||||
|
||||
package scala.collection.generic
|
||||
|
|
|
@ -6,17 +6,20 @@
|
|||
** |/ **
|
||||
\* */
|
||||
|
||||
// $Id: Traversable.scala 15188 2008-05-24 15:01:02Z stepancheg $
|
||||
// $Id$
|
||||
|
||||
|
||||
package scala.collection.generic
|
||||
|
||||
// import immutable.{List, Stream, Nil} //!!!
|
||||
import mutable.{Buffer, ArrayBuffer, ListBuffer}
|
||||
|
||||
/** A template trait for traversable collections.
|
||||
* This is a base trait of all kinds of Scala collections. It implements the
|
||||
* behavior common to all collections, in terms of a method `foreach` with signature:
|
||||
* This is a base trait of all kinds of Scala collections. It implements
|
||||
* the behavior common to all collections, in terms of a method
|
||||
* <code>foreach</code> with signature:<pre>
|
||||
*
|
||||
* def foreach[U](f: Elem => U): Unit
|
||||
* def foreach[U](f: Elem => U): Unit</pre>
|
||||
*
|
||||
* Collection classes mixing in this trait provide a concrete
|
||||
* <code>foreach</code> method which traverses all the
|
||||
|
|
|
@ -5,13 +5,17 @@
|
|||
** /____/\___/_/ |_/____/_/ | | **
|
||||
** |/ **
|
||||
\* */
|
||||
|
||||
// $Id$
|
||||
|
||||
|
||||
package scala.collection.generic
|
||||
|
||||
import Math.MAX_INT
|
||||
import TraversableView.NoBuilder
|
||||
|
||||
/** A base class for views of Traversable.
|
||||
* Every subclass has to implenment the foreach method
|
||||
*
|
||||
* @author Martin Odersky
|
||||
* @version 2.8
|
||||
*/
|
||||
|
|
|
@ -5,13 +5,18 @@
|
|||
** /____/\___/_/ |_/____/_/ | | **
|
||||
** |/ **
|
||||
\* */
|
||||
|
||||
// $Id$
|
||||
|
||||
|
||||
package scala.collection.generic
|
||||
|
||||
import Math.MAX_INT
|
||||
import TraversableView.NoBuilder
|
||||
|
||||
/** A base class for views of Traversable.
|
||||
/** A base class for views of <code>Traversable</code>.
|
||||
* Every subclass has to implenment the foreach method
|
||||
*
|
||||
* @author Martin Odersky
|
||||
* @version 2.8
|
||||
*/
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
** |/ **
|
||||
\* */
|
||||
|
||||
// $Id: Vector.scala 15437 2008-06-25 16:22:45Z stepancheg $
|
||||
// $Id$
|
||||
|
||||
package scala.collection.generic
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
** |/ **
|
||||
\* */
|
||||
|
||||
// $Id: Sequence.scala 16092 2008-09-12 10:37:06Z nielsen $
|
||||
// $Id$
|
||||
|
||||
|
||||
package scala.collection.generic
|
||||
|
@ -14,6 +14,7 @@ package scala.collection.generic
|
|||
import TraversableView.NoBuilder
|
||||
|
||||
/** A non-strict projection of an iterable.
|
||||
*
|
||||
* @author Sean McDirmid
|
||||
* @author Martin Odersky
|
||||
* @version 2.8
|
||||
|
|
|
@ -14,6 +14,7 @@ package scala.collection.generic
|
|||
import TraversableView.NoBuilder
|
||||
|
||||
/** A non-strict projection of an iterable.
|
||||
*
|
||||
* @author Sean McDirmid
|
||||
* @author Martin Odersky
|
||||
* @version 2.8
|
||||
|
|
|
@ -1,15 +1,26 @@
|
|||
/* __ *\
|
||||
** ________ ___ / / ___ Scala API **
|
||||
** / __/ __// _ | / / / _ | (c) 2003-2009, LAMP/EPFL **
|
||||
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
|
||||
** /____/\___/_/ |_/____/_/ | | **
|
||||
** |/ **
|
||||
\* */
|
||||
|
||||
// $Id$
|
||||
|
||||
|
||||
package scala.util.control
|
||||
|
||||
/** An object that can be used for the break control abstraction.
|
||||
* Example usage:
|
||||
* Example usage:<pre>
|
||||
*
|
||||
* import Breaks.{break, breakable}
|
||||
* <b>import</b> Breaks.{break, breakable}
|
||||
*
|
||||
* breakable {
|
||||
* for (...) {
|
||||
* if (...) break
|
||||
* }
|
||||
* <b>for</b> (...) {
|
||||
* <b>if</b> (...) break
|
||||
* }
|
||||
* }</pre>
|
||||
*
|
||||
*/
|
||||
class Breaks {
|
||||
|
|
Loading…
Reference in New Issue