diff options
Diffstat (limited to 'src/library')
191 files changed, 1609 insertions, 784 deletions
diff --git a/src/library/scala/Function0.scala b/src/library/scala/Function0.scala index 74905d8af7..867c7bc536 100644 --- a/src/library/scala/Function0.scala +++ b/src/library/scala/Function0.scala @@ -8,12 +8,13 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 (with fancy comment) +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 (with fancy comment) package scala + /** <p> * Function with 0 parameters. * </p> @@ -35,7 +36,7 @@ package scala * println(anonfun0()) * }</pre> */ -trait Function0[+R] extends AnyRef { self => +trait Function0[@specialized +R] extends AnyRef { self => def apply(): R override def toString() = "<function0>" diff --git a/src/library/scala/Function1.scala b/src/library/scala/Function1.scala index afc19417a2..a5780f561a 100644 --- a/src/library/scala/Function1.scala +++ b/src/library/scala/Function1.scala @@ -8,12 +8,13 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 (with fancy comment) (with extra methods) +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 (with fancy comment) (with extra methods) package scala + /** <p> * Function with 1 parameter. * </p> @@ -35,7 +36,7 @@ package scala * println(anonfun1(0)) * }</pre> */ -trait Function1[@specialized(Int, Long, Double) -T1, @specialized(Unit, Int, Long, Double) +R] extends AnyRef { self => +trait Function1[@specialized(Int, Long, Double) -T1, @specialized(Unit, Boolean, Int, Long, Double) +R] extends AnyRef { self => def apply(v1:T1): R override def toString() = "<function1>" diff --git a/src/library/scala/Function10.scala b/src/library/scala/Function10.scala index 8eb6fad84e..967d58fa35 100644 --- a/src/library/scala/Function10.scala +++ b/src/library/scala/Function10.scala @@ -8,12 +8,13 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 (with extra methods) +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 (with extra methods) package scala + /** <p> * Function with 10 parameters. * </p> diff --git a/src/library/scala/Function11.scala b/src/library/scala/Function11.scala index 7e94c6d2ca..5d6065ea1c 100644 --- a/src/library/scala/Function11.scala +++ b/src/library/scala/Function11.scala @@ -8,12 +8,13 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 (with extra methods) +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 (with extra methods) package scala + /** <p> * Function with 11 parameters. * </p> diff --git a/src/library/scala/Function12.scala b/src/library/scala/Function12.scala index e14b95fc81..a262e2d8f7 100644 --- a/src/library/scala/Function12.scala +++ b/src/library/scala/Function12.scala @@ -8,12 +8,13 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 (with extra methods) +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 (with extra methods) package scala + /** <p> * Function with 12 parameters. * </p> diff --git a/src/library/scala/Function13.scala b/src/library/scala/Function13.scala index 2deeed8aa7..6b1d0788fb 100644 --- a/src/library/scala/Function13.scala +++ b/src/library/scala/Function13.scala @@ -8,12 +8,13 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 (with extra methods) +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 (with extra methods) package scala + /** <p> * Function with 13 parameters. * </p> diff --git a/src/library/scala/Function14.scala b/src/library/scala/Function14.scala index 596bbb25b8..75b0d25f5e 100644 --- a/src/library/scala/Function14.scala +++ b/src/library/scala/Function14.scala @@ -8,12 +8,13 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 (with extra methods) +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 (with extra methods) package scala + /** <p> * Function with 14 parameters. * </p> diff --git a/src/library/scala/Function15.scala b/src/library/scala/Function15.scala index 9942ab2015..c66015d2aa 100644 --- a/src/library/scala/Function15.scala +++ b/src/library/scala/Function15.scala @@ -8,12 +8,13 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 (with extra methods) +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 (with extra methods) package scala + /** <p> * Function with 15 parameters. * </p> diff --git a/src/library/scala/Function16.scala b/src/library/scala/Function16.scala index 5419b40f8d..5b6968c106 100644 --- a/src/library/scala/Function16.scala +++ b/src/library/scala/Function16.scala @@ -8,12 +8,13 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 (with extra methods) +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 (with extra methods) package scala + /** <p> * Function with 16 parameters. * </p> diff --git a/src/library/scala/Function17.scala b/src/library/scala/Function17.scala index 17caf47a02..74321b950b 100644 --- a/src/library/scala/Function17.scala +++ b/src/library/scala/Function17.scala @@ -8,12 +8,13 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 (with extra methods) +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 (with extra methods) package scala + /** <p> * Function with 17 parameters. * </p> diff --git a/src/library/scala/Function18.scala b/src/library/scala/Function18.scala index 338083ef17..4cb1540161 100644 --- a/src/library/scala/Function18.scala +++ b/src/library/scala/Function18.scala @@ -8,12 +8,13 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 (with extra methods) +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 (with extra methods) package scala + /** <p> * Function with 18 parameters. * </p> diff --git a/src/library/scala/Function19.scala b/src/library/scala/Function19.scala index 92eb2afa29..337b9c4837 100644 --- a/src/library/scala/Function19.scala +++ b/src/library/scala/Function19.scala @@ -8,12 +8,13 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 (with extra methods) +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 (with extra methods) package scala + /** <p> * Function with 19 parameters. * </p> diff --git a/src/library/scala/Function2.scala b/src/library/scala/Function2.scala index 46023a9b3b..44c4e358b8 100644 --- a/src/library/scala/Function2.scala +++ b/src/library/scala/Function2.scala @@ -8,12 +8,13 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 (with fancy comment) (with extra methods) +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 (with fancy comment) (with extra methods) package scala + /** <p> * Function with 2 parameters. * </p> @@ -35,9 +36,7 @@ package scala * println(anonfun2(0, 1)) * }</pre> */ -trait Function2[@specialized(Int, Long, Double) -T1, - @specialized(Int, Long, Double) -T2, - @specialized(Unit, Int, Long, Double) +R] extends AnyRef { self => +trait Function2[@specialized(Int, Long, Double) -T1, @specialized(Int, Long, Double) -T2, @specialized(Unit, Boolean, Int, Long, Double) +R] extends AnyRef { self => def apply(v1:T1,v2:T2): R override def toString() = "<function2>" diff --git a/src/library/scala/Function20.scala b/src/library/scala/Function20.scala index 45636a1b7d..d381d2d82e 100644 --- a/src/library/scala/Function20.scala +++ b/src/library/scala/Function20.scala @@ -8,12 +8,13 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 (with extra methods) +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 (with extra methods) package scala + /** <p> * Function with 20 parameters. * </p> diff --git a/src/library/scala/Function21.scala b/src/library/scala/Function21.scala index 4463866a55..b78fd96dd3 100644 --- a/src/library/scala/Function21.scala +++ b/src/library/scala/Function21.scala @@ -8,12 +8,13 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 (with extra methods) +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 (with extra methods) package scala + /** <p> * Function with 21 parameters. * </p> diff --git a/src/library/scala/Function22.scala b/src/library/scala/Function22.scala index c148144ef4..2322a24e9d 100644 --- a/src/library/scala/Function22.scala +++ b/src/library/scala/Function22.scala @@ -8,12 +8,13 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 (with extra methods) +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 (with extra methods) package scala + /** <p> * Function with 22 parameters. * </p> diff --git a/src/library/scala/Function3.scala b/src/library/scala/Function3.scala index 52c777fdc9..82858c356f 100644 --- a/src/library/scala/Function3.scala +++ b/src/library/scala/Function3.scala @@ -8,12 +8,13 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 (with extra methods) +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 (with extra methods) package scala + /** <p> * Function with 3 parameters. * </p> diff --git a/src/library/scala/Function4.scala b/src/library/scala/Function4.scala index 79e92dc4e3..c97c00eb0c 100644 --- a/src/library/scala/Function4.scala +++ b/src/library/scala/Function4.scala @@ -8,12 +8,13 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 (with extra methods) +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 (with extra methods) package scala + /** <p> * Function with 4 parameters. * </p> diff --git a/src/library/scala/Function5.scala b/src/library/scala/Function5.scala index af849300f4..fb798741ea 100644 --- a/src/library/scala/Function5.scala +++ b/src/library/scala/Function5.scala @@ -8,12 +8,13 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 (with extra methods) +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 (with extra methods) package scala + /** <p> * Function with 5 parameters. * </p> diff --git a/src/library/scala/Function6.scala b/src/library/scala/Function6.scala index 487c650fc9..02a2bd4fb7 100644 --- a/src/library/scala/Function6.scala +++ b/src/library/scala/Function6.scala @@ -8,12 +8,13 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 (with extra methods) +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 (with extra methods) package scala + /** <p> * Function with 6 parameters. * </p> diff --git a/src/library/scala/Function7.scala b/src/library/scala/Function7.scala index 76de5c185c..7973bcb87c 100644 --- a/src/library/scala/Function7.scala +++ b/src/library/scala/Function7.scala @@ -8,12 +8,13 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 (with extra methods) +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 (with extra methods) package scala + /** <p> * Function with 7 parameters. * </p> diff --git a/src/library/scala/Function8.scala b/src/library/scala/Function8.scala index c8ca675365..32929db9d6 100644 --- a/src/library/scala/Function8.scala +++ b/src/library/scala/Function8.scala @@ -8,12 +8,13 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 (with extra methods) +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 (with extra methods) package scala + /** <p> * Function with 8 parameters. * </p> diff --git a/src/library/scala/Function9.scala b/src/library/scala/Function9.scala index 338acbcae2..490e44c39b 100644 --- a/src/library/scala/Function9.scala +++ b/src/library/scala/Function9.scala @@ -8,12 +8,13 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 (with extra methods) +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 (with extra methods) package scala + /** <p> * Function with 9 parameters. * </p> diff --git a/src/library/scala/Product1.scala b/src/library/scala/Product1.scala index 0e93065e5a..af9a7eca20 100644 --- a/src/library/scala/Product1.scala +++ b/src/library/scala/Product1.scala @@ -8,11 +8,12 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 +// generated by genprod on Mon Apr 12 15:28:17 CEST 2010 package scala + object Product1 { def unapply[T1](x: Product1[T1]): Option[Product1[T1]] = Some(x) diff --git a/src/library/scala/Product10.scala b/src/library/scala/Product10.scala index a63a1007fb..d6745d62ad 100644 --- a/src/library/scala/Product10.scala +++ b/src/library/scala/Product10.scala @@ -8,11 +8,12 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 +// generated by genprod on Mon Apr 12 15:28:17 CEST 2010 package scala + object Product10 { def unapply[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10](x: Product10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]): Option[Product10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]] = Some(x) diff --git a/src/library/scala/Product11.scala b/src/library/scala/Product11.scala index a33df77b64..83cf5f0e55 100644 --- a/src/library/scala/Product11.scala +++ b/src/library/scala/Product11.scala @@ -8,11 +8,12 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 +// generated by genprod on Mon Apr 12 15:28:17 CEST 2010 package scala + object Product11 { def unapply[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11](x: Product11[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11]): Option[Product11[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11]] = Some(x) diff --git a/src/library/scala/Product12.scala b/src/library/scala/Product12.scala index 24b16876a3..845bba720d 100644 --- a/src/library/scala/Product12.scala +++ b/src/library/scala/Product12.scala @@ -8,11 +8,12 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 +// generated by genprod on Mon Apr 12 15:28:17 CEST 2010 package scala + object Product12 { def unapply[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12](x: Product12[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12]): Option[Product12[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12]] = Some(x) diff --git a/src/library/scala/Product13.scala b/src/library/scala/Product13.scala index 1013561af6..374b457789 100644 --- a/src/library/scala/Product13.scala +++ b/src/library/scala/Product13.scala @@ -8,11 +8,12 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 +// generated by genprod on Mon Apr 12 15:28:17 CEST 2010 package scala + object Product13 { def unapply[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13](x: Product13[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13]): Option[Product13[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13]] = Some(x) diff --git a/src/library/scala/Product14.scala b/src/library/scala/Product14.scala index ddeccf7c98..93bb53339d 100644 --- a/src/library/scala/Product14.scala +++ b/src/library/scala/Product14.scala @@ -8,11 +8,12 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 +// generated by genprod on Mon Apr 12 15:28:17 CEST 2010 package scala + object Product14 { def unapply[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14](x: Product14[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14]): Option[Product14[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14]] = Some(x) diff --git a/src/library/scala/Product15.scala b/src/library/scala/Product15.scala index 0f25bda254..71cefbafc5 100644 --- a/src/library/scala/Product15.scala +++ b/src/library/scala/Product15.scala @@ -8,11 +8,12 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 package scala + object Product15 { def unapply[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15](x: Product15[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15]): Option[Product15[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15]] = Some(x) diff --git a/src/library/scala/Product16.scala b/src/library/scala/Product16.scala index 1fcf2d192b..aa87c9f40b 100644 --- a/src/library/scala/Product16.scala +++ b/src/library/scala/Product16.scala @@ -8,11 +8,12 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 package scala + object Product16 { def unapply[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16](x: Product16[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16]): Option[Product16[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16]] = Some(x) diff --git a/src/library/scala/Product17.scala b/src/library/scala/Product17.scala index 8c5efa9cc5..7caa99a578 100644 --- a/src/library/scala/Product17.scala +++ b/src/library/scala/Product17.scala @@ -8,11 +8,12 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 package scala + object Product17 { def unapply[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17](x: Product17[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17]): Option[Product17[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17]] = Some(x) diff --git a/src/library/scala/Product18.scala b/src/library/scala/Product18.scala index 6ab150b1d1..ca0b168c83 100644 --- a/src/library/scala/Product18.scala +++ b/src/library/scala/Product18.scala @@ -8,11 +8,12 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 package scala + object Product18 { def unapply[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18](x: Product18[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18]): Option[Product18[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18]] = Some(x) diff --git a/src/library/scala/Product19.scala b/src/library/scala/Product19.scala index 86fc2e43fb..88256c44fd 100644 --- a/src/library/scala/Product19.scala +++ b/src/library/scala/Product19.scala @@ -8,11 +8,12 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 package scala + object Product19 { def unapply[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19](x: Product19[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19]): Option[Product19[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19]] = Some(x) diff --git a/src/library/scala/Product2.scala b/src/library/scala/Product2.scala index 436de41a01..6ce804fc89 100644 --- a/src/library/scala/Product2.scala +++ b/src/library/scala/Product2.scala @@ -8,11 +8,12 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 +// generated by genprod on Mon Apr 12 15:28:17 CEST 2010 package scala + object Product2 { def unapply[T1, T2](x: Product2[T1, T2]): Option[Product2[T1, T2]] = Some(x) @@ -22,8 +23,7 @@ object Product2 { * * @since 2.3 */ -trait Product2[@specialized(Int, Long, Double) +T1, - @specialized(Int, Long, Double) +T2] extends Product { +trait Product2[@specialized(Int, Long, Double) +T1, @specialized(Int, Long, Double) +T2] extends Product { /** * The arity of this product. * @return 2 diff --git a/src/library/scala/Product20.scala b/src/library/scala/Product20.scala index cc398f7bb4..b9aab6988d 100644 --- a/src/library/scala/Product20.scala +++ b/src/library/scala/Product20.scala @@ -8,11 +8,12 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 package scala + object Product20 { def unapply[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20](x: Product20[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20]): Option[Product20[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20]] = Some(x) diff --git a/src/library/scala/Product21.scala b/src/library/scala/Product21.scala index b215c466ae..9ab61d35ca 100644 --- a/src/library/scala/Product21.scala +++ b/src/library/scala/Product21.scala @@ -8,11 +8,12 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 package scala + object Product21 { def unapply[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21](x: Product21[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21]): Option[Product21[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21]] = Some(x) diff --git a/src/library/scala/Product22.scala b/src/library/scala/Product22.scala index f7e10a2652..86fbaeca7f 100644 --- a/src/library/scala/Product22.scala +++ b/src/library/scala/Product22.scala @@ -8,11 +8,12 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 package scala + object Product22 { def unapply[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22](x: Product22[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22]): Option[Product22[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22]] = Some(x) diff --git a/src/library/scala/Product3.scala b/src/library/scala/Product3.scala index 0fbd855b86..09044716a4 100644 --- a/src/library/scala/Product3.scala +++ b/src/library/scala/Product3.scala @@ -8,11 +8,12 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 +// generated by genprod on Mon Apr 12 15:28:17 CEST 2010 package scala + object Product3 { def unapply[T1, T2, T3](x: Product3[T1, T2, T3]): Option[Product3[T1, T2, T3]] = Some(x) diff --git a/src/library/scala/Product4.scala b/src/library/scala/Product4.scala index efeec3c601..c6a5c74bb5 100644 --- a/src/library/scala/Product4.scala +++ b/src/library/scala/Product4.scala @@ -8,11 +8,12 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 +// generated by genprod on Mon Apr 12 15:28:17 CEST 2010 package scala + object Product4 { def unapply[T1, T2, T3, T4](x: Product4[T1, T2, T3, T4]): Option[Product4[T1, T2, T3, T4]] = Some(x) diff --git a/src/library/scala/Product5.scala b/src/library/scala/Product5.scala index 64e59b6b1d..147fb2d305 100644 --- a/src/library/scala/Product5.scala +++ b/src/library/scala/Product5.scala @@ -8,11 +8,12 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 +// generated by genprod on Mon Apr 12 15:28:17 CEST 2010 package scala + object Product5 { def unapply[T1, T2, T3, T4, T5](x: Product5[T1, T2, T3, T4, T5]): Option[Product5[T1, T2, T3, T4, T5]] = Some(x) diff --git a/src/library/scala/Product6.scala b/src/library/scala/Product6.scala index a2a819ef51..f967992e5e 100644 --- a/src/library/scala/Product6.scala +++ b/src/library/scala/Product6.scala @@ -8,11 +8,12 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 +// generated by genprod on Mon Apr 12 15:28:17 CEST 2010 package scala + object Product6 { def unapply[T1, T2, T3, T4, T5, T6](x: Product6[T1, T2, T3, T4, T5, T6]): Option[Product6[T1, T2, T3, T4, T5, T6]] = Some(x) diff --git a/src/library/scala/Product7.scala b/src/library/scala/Product7.scala index b9fa32bf00..c7a9baef98 100644 --- a/src/library/scala/Product7.scala +++ b/src/library/scala/Product7.scala @@ -8,11 +8,12 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 +// generated by genprod on Mon Apr 12 15:28:17 CEST 2010 package scala + object Product7 { def unapply[T1, T2, T3, T4, T5, T6, T7](x: Product7[T1, T2, T3, T4, T5, T6, T7]): Option[Product7[T1, T2, T3, T4, T5, T6, T7]] = Some(x) diff --git a/src/library/scala/Product8.scala b/src/library/scala/Product8.scala index 0f5aa6100a..8663b0868b 100644 --- a/src/library/scala/Product8.scala +++ b/src/library/scala/Product8.scala @@ -8,11 +8,12 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 +// generated by genprod on Mon Apr 12 15:28:17 CEST 2010 package scala + object Product8 { def unapply[T1, T2, T3, T4, T5, T6, T7, T8](x: Product8[T1, T2, T3, T4, T5, T6, T7, T8]): Option[Product8[T1, T2, T3, T4, T5, T6, T7, T8]] = Some(x) diff --git a/src/library/scala/Product9.scala b/src/library/scala/Product9.scala index 6adce6023f..8d2de090ab 100644 --- a/src/library/scala/Product9.scala +++ b/src/library/scala/Product9.scala @@ -8,11 +8,12 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 +// generated by genprod on Mon Apr 12 15:28:17 CEST 2010 package scala + object Product9 { def unapply[T1, T2, T3, T4, T5, T6, T7, T8, T9](x: Product9[T1, T2, T3, T4, T5, T6, T7, T8, T9]): Option[Product9[T1, T2, T3, T4, T5, T6, T7, T8, T9]] = Some(x) diff --git a/src/library/scala/Tuple1.scala b/src/library/scala/Tuple1.scala index 5d25cc5abb..d8f8126f42 100644 --- a/src/library/scala/Tuple1.scala +++ b/src/library/scala/Tuple1.scala @@ -8,12 +8,13 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 package scala + /** Tuple1 is the canonical representation of a @see Product1 * */ diff --git a/src/library/scala/Tuple10.scala b/src/library/scala/Tuple10.scala index c9e38eec29..11889b3485 100644 --- a/src/library/scala/Tuple10.scala +++ b/src/library/scala/Tuple10.scala @@ -8,12 +8,13 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 package scala + /** Tuple10 is the canonical representation of a @see Product10 * */ diff --git a/src/library/scala/Tuple11.scala b/src/library/scala/Tuple11.scala index 546800f3af..b44141c1ee 100644 --- a/src/library/scala/Tuple11.scala +++ b/src/library/scala/Tuple11.scala @@ -8,12 +8,13 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 package scala + /** Tuple11 is the canonical representation of a @see Product11 * */ diff --git a/src/library/scala/Tuple12.scala b/src/library/scala/Tuple12.scala index 0f2d4e9af0..37a172e74f 100644 --- a/src/library/scala/Tuple12.scala +++ b/src/library/scala/Tuple12.scala @@ -8,12 +8,13 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 package scala + /** Tuple12 is the canonical representation of a @see Product12 * */ diff --git a/src/library/scala/Tuple13.scala b/src/library/scala/Tuple13.scala index d9d540d334..68d4a5aa8f 100644 --- a/src/library/scala/Tuple13.scala +++ b/src/library/scala/Tuple13.scala @@ -8,12 +8,13 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 package scala + /** Tuple13 is the canonical representation of a @see Product13 * */ diff --git a/src/library/scala/Tuple14.scala b/src/library/scala/Tuple14.scala index 18ea35a9f4..424beb040e 100644 --- a/src/library/scala/Tuple14.scala +++ b/src/library/scala/Tuple14.scala @@ -8,12 +8,13 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 package scala + /** Tuple14 is the canonical representation of a @see Product14 * */ diff --git a/src/library/scala/Tuple15.scala b/src/library/scala/Tuple15.scala index cb1742786c..944ff9d1b5 100644 --- a/src/library/scala/Tuple15.scala +++ b/src/library/scala/Tuple15.scala @@ -8,12 +8,13 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 package scala + /** Tuple15 is the canonical representation of a @see Product15 * */ diff --git a/src/library/scala/Tuple16.scala b/src/library/scala/Tuple16.scala index 0af7feeb45..276220fbf5 100644 --- a/src/library/scala/Tuple16.scala +++ b/src/library/scala/Tuple16.scala @@ -8,12 +8,13 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 package scala + /** Tuple16 is the canonical representation of a @see Product16 * */ diff --git a/src/library/scala/Tuple17.scala b/src/library/scala/Tuple17.scala index ef02d51fc6..d965ca8504 100644 --- a/src/library/scala/Tuple17.scala +++ b/src/library/scala/Tuple17.scala @@ -8,12 +8,13 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 package scala + /** Tuple17 is the canonical representation of a @see Product17 * */ diff --git a/src/library/scala/Tuple18.scala b/src/library/scala/Tuple18.scala index 6f2489e41d..77cc635034 100644 --- a/src/library/scala/Tuple18.scala +++ b/src/library/scala/Tuple18.scala @@ -8,12 +8,13 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 package scala + /** Tuple18 is the canonical representation of a @see Product18 * */ diff --git a/src/library/scala/Tuple19.scala b/src/library/scala/Tuple19.scala index ad69657e2c..540aaa3893 100644 --- a/src/library/scala/Tuple19.scala +++ b/src/library/scala/Tuple19.scala @@ -8,12 +8,13 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 package scala + /** Tuple19 is the canonical representation of a @see Product19 * */ diff --git a/src/library/scala/Tuple2.scala b/src/library/scala/Tuple2.scala index 7fea22410d..ee2fe84482 100644 --- a/src/library/scala/Tuple2.scala +++ b/src/library/scala/Tuple2.scala @@ -8,7 +8,7 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 (with extra methods) +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 (with extra methods) package scala @@ -16,11 +16,12 @@ import scala.collection.{TraversableLike, IterableLike} import scala.collection.generic.CanBuildFrom + + /** Tuple2 is the canonical representation of a @see Product2 * */ -case class Tuple2[@specialized(Int, Long, Double) +T1, - @specialized(Int, Long, Double) +T2](_1:T1,_2:T2) +case class Tuple2[@specialized(Int, Long, Double) +T1, @specialized(Int, Long, Double) +T2](_1:T1,_2:T2) extends Product2[T1, T2] { override def toString() = "(" + _1 + "," + _2 + ")" @@ -122,4 +123,5 @@ case class Tuple2[@specialized(Int, Long, Double) +T1, f(el1, elems2.next) } } + } diff --git a/src/library/scala/Tuple20.scala b/src/library/scala/Tuple20.scala index 5f4d4b26e8..58e7018518 100644 --- a/src/library/scala/Tuple20.scala +++ b/src/library/scala/Tuple20.scala @@ -8,12 +8,13 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 package scala + /** Tuple20 is the canonical representation of a @see Product20 * */ diff --git a/src/library/scala/Tuple21.scala b/src/library/scala/Tuple21.scala index 780cbd15ad..e302bfbd80 100644 --- a/src/library/scala/Tuple21.scala +++ b/src/library/scala/Tuple21.scala @@ -8,12 +8,13 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 package scala + /** Tuple21 is the canonical representation of a @see Product21 * */ diff --git a/src/library/scala/Tuple22.scala b/src/library/scala/Tuple22.scala index f45cab85fa..2fd4fc7166 100644 --- a/src/library/scala/Tuple22.scala +++ b/src/library/scala/Tuple22.scala @@ -8,12 +8,13 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 package scala + /** Tuple22 is the canonical representation of a @see Product22 * */ diff --git a/src/library/scala/Tuple3.scala b/src/library/scala/Tuple3.scala index a1fca95e4d..e6464cf52c 100644 --- a/src/library/scala/Tuple3.scala +++ b/src/library/scala/Tuple3.scala @@ -8,13 +8,16 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 (with extra methods) package scala import scala.collection.{TraversableLike, IterableLike} import scala.collection.generic.CanBuildFrom + + + /** Tuple3 is the canonical representation of a @see Product3 * */ @@ -136,4 +139,5 @@ case class Tuple3[+T1, +T2, +T3](_1:T1,_2:T2,_3:T3) f(el1, elems2.next, elems3.next) } } + } diff --git a/src/library/scala/Tuple4.scala b/src/library/scala/Tuple4.scala index fbf5d341a4..55cfae2c03 100644 --- a/src/library/scala/Tuple4.scala +++ b/src/library/scala/Tuple4.scala @@ -8,12 +8,13 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 package scala + /** Tuple4 is the canonical representation of a @see Product4 * */ diff --git a/src/library/scala/Tuple5.scala b/src/library/scala/Tuple5.scala index 033f26263d..ec52ee039e 100644 --- a/src/library/scala/Tuple5.scala +++ b/src/library/scala/Tuple5.scala @@ -8,12 +8,13 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 package scala + /** Tuple5 is the canonical representation of a @see Product5 * */ diff --git a/src/library/scala/Tuple6.scala b/src/library/scala/Tuple6.scala index d360adad2a..5f41c1de2a 100644 --- a/src/library/scala/Tuple6.scala +++ b/src/library/scala/Tuple6.scala @@ -8,12 +8,13 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 package scala + /** Tuple6 is the canonical representation of a @see Product6 * */ diff --git a/src/library/scala/Tuple7.scala b/src/library/scala/Tuple7.scala index 5a080c2e0e..0e2315c573 100644 --- a/src/library/scala/Tuple7.scala +++ b/src/library/scala/Tuple7.scala @@ -8,12 +8,13 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 package scala + /** Tuple7 is the canonical representation of a @see Product7 * */ diff --git a/src/library/scala/Tuple8.scala b/src/library/scala/Tuple8.scala index 551c5e5d34..58b2e13af8 100644 --- a/src/library/scala/Tuple8.scala +++ b/src/library/scala/Tuple8.scala @@ -8,12 +8,13 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 package scala + /** Tuple8 is the canonical representation of a @see Product8 * */ diff --git a/src/library/scala/Tuple9.scala b/src/library/scala/Tuple9.scala index 8098daaf40..360228cb68 100644 --- a/src/library/scala/Tuple9.scala +++ b/src/library/scala/Tuple9.scala @@ -8,12 +8,13 @@ // $Id$ -// generated by genprod on Sun Jan 17 19:38:09 PST 2010 +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 package scala + /** Tuple9 is the canonical representation of a @see Product9 * */ diff --git a/src/library/scala/collection/BitSetLike.scala b/src/library/scala/collection/BitSetLike.scala index 7c5e2fb269..3028cca6eb 100644 --- a/src/library/scala/collection/BitSetLike.scala +++ b/src/library/scala/collection/BitSetLike.scala @@ -41,7 +41,7 @@ trait BitSetLike[+This <: BitSetLike[This] with Set[Int]] extends SetLike[Int, T protected def nwords: Int /** The words at index `idx', or 0L if outside the range of the set - * @note Requires `idx >= 0` + * '''Note:''' requires `idx >= 0` */ protected def word(idx: Int): Long diff --git a/src/library/scala/collection/IndexedSeq.scala b/src/library/scala/collection/IndexedSeq.scala index 72878a8ad6..78165cb242 100644 --- a/src/library/scala/collection/IndexedSeq.scala +++ b/src/library/scala/collection/IndexedSeq.scala @@ -24,6 +24,7 @@ trait IndexedSeq[+A] extends Seq[A] } /** $factoryInfo + * The current default implementation of a $Coll is a `Vector`. * @define coll indexed sequence * @define Coll IndexedSeq */ diff --git a/src/library/scala/collection/IndexedSeqLike.scala b/src/library/scala/collection/IndexedSeqLike.scala index 453b4384f7..7bfad167c6 100644 --- a/src/library/scala/collection/IndexedSeqLike.scala +++ b/src/library/scala/collection/IndexedSeqLike.scala @@ -66,13 +66,13 @@ trait IndexedSeqLike[+A, +Repr] extends SeqLike[A, Repr] { self => if (i < end) self(i) else Iterator.empty.next /** $super - * @note `drop` is overridden to enable fast searching in the middle of indexed sequences. + * '''Note:''' `drop` is overridden to enable fast searching in the middle of indexed sequences. */ override def drop(n: Int): Iterator[A] = if (n > 0) new Elements(start + n, end) else this /** $super - * @note `take` is overridden to be symmetric to `drop`. + * '''Note:''' `take` is overridden to be symmetric to `drop`. */ override def take(n: Int): Iterator[A] = if (n <= 0) Iterator.empty.buffered diff --git a/src/library/scala/collection/Iterable.scala b/src/library/scala/collection/Iterable.scala index 65d4dfcbe2..2baacec9f9 100644 --- a/src/library/scala/collection/Iterable.scala +++ b/src/library/scala/collection/Iterable.scala @@ -36,6 +36,7 @@ trait Iterable[+A] extends Traversable[A] } /** $factoryInfo + * The current default implementation of a $Coll is a `Vector`. * @define coll iterable collection * @define Coll Iterable */ diff --git a/src/library/scala/collection/IterableView.scala b/src/library/scala/collection/IterableView.scala index 436c000909..a6078bcdc8 100644 --- a/src/library/scala/collection/IterableView.scala +++ b/src/library/scala/collection/IterableView.scala @@ -14,14 +14,14 @@ package scala.collection import generic._ import TraversableView.NoBuilder -/** A base class for views of Iterables. - * - * @author Martin Odersky - * @version 2.8 - * @since 2.8 +/** A base trait for non-strict views of `Iterable`s. + * $iterableViewInfo */ trait IterableView[+A, +Coll] extends IterableViewLike[A, Coll, IterableView[A, Coll]] +/** An object containing the necessary implicit definitions to make + * `IterableView`s work. Its definitions are generally not accessed directly by clients. + */ object IterableView { type Coll = TraversableView[_, C] forSome {type C <: Traversable[_]} implicit def canBuildFrom[A]: CanBuildFrom[Coll, A, IterableView[A, Iterable[_]]] = diff --git a/src/library/scala/collection/IterableViewLike.scala b/src/library/scala/collection/IterableViewLike.scala index b8f0b65faf..49fcee842c 100644 --- a/src/library/scala/collection/IterableViewLike.scala +++ b/src/library/scala/collection/IterableViewLike.scala @@ -16,11 +16,11 @@ import collection.immutable.Stream import TraversableView.NoBuilder /** A template trait for non-strict views of iterable collections. - * $iterableviewInfo + * $iterableViewInfo * - * @define iterableviewInfo - * $viewinfo - * All views for iterable collections are defined by creating a new `iterator` method. + * @define iterableViewInfo + * $viewInfo + * All views for iterable collections are defined by re-interpreting the `iterator` method. * * @author Martin Odersky * @version 2.8 diff --git a/src/library/scala/collection/Iterator.scala b/src/library/scala/collection/Iterator.scala index 2ee4e8056e..24c447b24b 100644 --- a/src/library/scala/collection/Iterator.scala +++ b/src/library/scala/collection/Iterator.scala @@ -32,10 +32,10 @@ object Iterator { } /** Creates an iterator which produces a single element. + * '''Note:''' Equivalent, but more efficient than Iterator(elem) * @param elem the element * @return An iterator which produces `elem` on the first call to `next`, * and which has no further elements. - * @note Equivalent, but more efficient than Iterator(elem) */ def single[A](elem: A) = new Iterator[A] { private var hasnext = true @@ -429,7 +429,7 @@ trait Iterator[+A] extends TraversableOnce[A] { * satisfy the predicate `p`. The order of the elements * is preserved. * - * @note `withFilter` is the same as `filter` on iterators. It exists so that + * '''Note:''' `withFilter` is the same as `filter` on iterators. It exists so that * for-expressions with filters work over iterators. * * @param p the predicate used to test values. @@ -1033,10 +1033,10 @@ trait Iterator[+A] extends TraversableOnce[A] { * 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. - * @note the array must be large enough to hold `sz` elements. */ @deprecated("use copyToArray instead") def readInto[B >: A](xs: Array[B], start: Int, sz: Int) { diff --git a/src/library/scala/collection/LinearSeq.scala b/src/library/scala/collection/LinearSeq.scala index ef7d4c9390..ba0eb6a22d 100644 --- a/src/library/scala/collection/LinearSeq.scala +++ b/src/library/scala/collection/LinearSeq.scala @@ -24,6 +24,7 @@ trait LinearSeq[+A] extends Seq[A] } /** $factoryInfo + * The current default implementation of a $Coll is a `Vector`. * @define coll linear sequence * @define Coll LinearSeq */ diff --git a/src/library/scala/collection/Map.scala b/src/library/scala/collection/Map.scala index 9d44a950de..0722d55f03 100644 --- a/src/library/scala/collection/Map.scala +++ b/src/library/scala/collection/Map.scala @@ -13,43 +13,33 @@ package scala.collection import generic._ -/** <p> - * A map from keys of type <code>A</code> to values of type <code>B</code>. - * To implement a concrete map, you need to provide implementations of the - * following methods (where <code>This</code> is the type of the map in question): - * </p><pre> - * <b>def</b> get(key: A): Option[B] - * <b>def</b> iterator: Iterator[(A, B)] - * <b>def</b> + [B1 >: B](kv: (A, B1)): This - * <b>def</b> -(key: A): This</pre> - * <p> - * If you wish that methods like `take`, `drop`, `filter` return the same kind - * of map, you should also override: - * </p><pre> - * <b>def</b> empty: This</pre> - * <p> - * It might also be a good idea to override methods <code>foreach</code> - * and <code>size</code> for efficiency. - * </p> +/** + * A map from keys of type `A` to values of type `B`. * - * @note If you do not have specific implementations for `add` and `-` in mind, - * you might consider inheriting from <code>DefaultMap</code> instead. + * $mapnote * - * @note If your additions and mutations return the same kind of map as the map - * you are defining, you should inherit from <code>MapLike</code> as well. + * '''Note:''' If you do not have specific implementations for `add` and `-` in mind, + * you might consider inheriting from `DefaultMap` instead. * - * @since 1 + * '''Note:''' If your additions and mutations return the same kind of map as the map + * you are defining, you should inherit from `MapLike` as well. + * + * @tparam A the type of the keys in this map. + * @tparam B the type of the values associated with keys. + * + * @since 1 */ trait Map[A, +B] extends Iterable[(A, B)] with MapLike[A, B, Map[A, B]] { def empty: Map[A, B] = Map.empty } -/* Factory object for `Map` class - * - * @since 2.5 +/** $factoryInfo + * @define Coll Map + * @define coll map */ object Map extends MapFactory[Map] { def empty[A, B]: immutable.Map[A, B] = immutable.Map.empty + /** $mapCanBuildFromInfo */ implicit def canBuildFrom[A, B]: CanBuildFrom[Coll, (A, B), Map[A, B]] = new MapCanBuildFrom[A, B] } diff --git a/src/library/scala/collection/MapLike.scala b/src/library/scala/collection/MapLike.scala index 057224a705..9bca2f09a0 100644 --- a/src/library/scala/collection/MapLike.scala +++ b/src/library/scala/collection/MapLike.scala @@ -15,20 +15,14 @@ import mutable.{Builder, StringBuilder, MapBuilder} import annotation.migration import PartialFunction._ -/** A template trait for maps of type `Map[A, B]` which associate keys of type `A` - * with values of type `B`. +/** A template trait for maps, which associate keys with values. * - * @tparam A the type of the keys. - * @tparam B the type of associated values. - * @tparam This the type of the map itself. - * - * $mapnote + * $mapNote + * $mapTags + * @since 2.8 * - * @author Martin Odersky - * @version 2.8 - * @since 2.8 - * $mapnote - * @define $mapnote @note + * @define mapNote + * '''Implementation note:''' * This trait provides most of the operations of a `Map` independently of its representation. * It is typically inherited by concrete implementations of maps. * @@ -47,6 +41,15 @@ import PartialFunction._ * }}} * It is also good idea to override methods `foreach` and * `size` for efficiency. + * + * @define mapTags + * @tparam A the type of the keys. + * @tparam B the type of associated values. + * @tparam This the type of the map itself. + * + * @author Martin Odersky + * @version 2.8 + * * @define coll map * @define Coll Map * @define willNotTerminateInf @@ -287,14 +290,15 @@ self => ((repr: Map[A, B1]) /: xs) (_ + _) /** Returns a new map with all key/value pairs for which the predicate - * <code>p</code> returns <code>true</code>. + * `p` returns `true`. * - * @param p A predicate over key-value pairs - * @note This method works by successively removing elements fro which the + * '''Note:''' This method works by successively removing elements fro which the * predicate is false from this set. * If removal is slow, or you expect that most elements of the set - * will be removed, you might consider using <code>filter</code> + * will be removed, you might consider using `filter` * with a negated predicate instead. + * @param p A predicate over key-value pairs + * @return A new map containing elements not satisfying the predicate. */ override def filterNot(p: ((A, B)) => Boolean): This = { var res: This = repr diff --git a/src/library/scala/collection/Seq.scala b/src/library/scala/collection/Seq.scala index baf2c0031e..f6b89b67b8 100644 --- a/src/library/scala/collection/Seq.scala +++ b/src/library/scala/collection/Seq.scala @@ -25,6 +25,7 @@ trait Seq[+A] extends PartialFunction[Int, A] } /** $factoryInfo + * The current default implementation of a $Coll is a `Vector`. * @define coll sequence * @define Coll Seq */ diff --git a/src/library/scala/collection/SeqView.scala b/src/library/scala/collection/SeqView.scala index 9a0025bd81..68819e899d 100644 --- a/src/library/scala/collection/SeqView.scala +++ b/src/library/scala/collection/SeqView.scala @@ -14,16 +14,13 @@ package scala.collection import generic._ import TraversableView.NoBuilder -/** A non-strict projection of an iterable. - * @author Sean McDirmid - * @author Martin Odersky - * @version 2.8 +/** A base trait for non-strict views of sequences. + * $seqViewInfo */ trait SeqView[+A, +Coll] extends SeqViewLike[A, Coll, SeqView[A, Coll]] -/** $factoryInfo - * @define coll sequence view - * @define Coll SeqView +/** An object containing the necessary implicit definitions to make + * `SeqView`s work. Its definitions are generally not accessed directly by clients. */ object SeqView { type Coll = TraversableView[_, C] forSome {type C <: Traversable[_]} diff --git a/src/library/scala/collection/SeqViewLike.scala b/src/library/scala/collection/SeqViewLike.scala index 7014833a46..6f1f29f536 100644 --- a/src/library/scala/collection/SeqViewLike.scala +++ b/src/library/scala/collection/SeqViewLike.scala @@ -15,10 +15,19 @@ import generic._ import Seq.fill import TraversableView.NoBuilder -/** A template trait for a non-strict view of a sequence. - * @author Sean McDirmid - * @author Martin Odersky - * @version 2.8 +/** A template trait for non-strict views of sequences. + * $seqViewInfo + * + * @define seqViewInfo + * $viewInfo + * All views for sequences are defined by re-interpreting the `length` and `apply` methods. + * + * @author Martin Odersky + * @version 2.8 + * @since 2.8 + * @tparam A the element type of the view + * @tparam Coll the type of the underlying collection containing the elements. + * @tparam This the type of the view itself */ trait SeqViewLike[+A, +Coll, diff --git a/src/library/scala/collection/Set.scala b/src/library/scala/collection/Set.scala index 3a6313a187..034d9f1705 100644 --- a/src/library/scala/collection/Set.scala +++ b/src/library/scala/collection/Set.scala @@ -12,14 +12,16 @@ package scala.collection import generic._ -/** <p> - * A set is a collection that includes at most one of any object. - * </p> +/** A base trait for all sets, mutable as well as immutable. * - * @author Matthias Zenger - * @author Martin Odersky - * @version 2.8 - * @since 1 + * $setNote + * $setNote2 + * $setTags + * @since 1.0 + * @author Matthias Zenger + * @define setNote2 + * '''Implementation note:''' If your additions and mutations return the same kind of set as the set + * you are defining, you should inherit from `SetLike` as well. */ trait Set[A] extends (A => Boolean) with Iterable[A] @@ -28,11 +30,11 @@ trait Set[A] extends (A => Boolean) override def companion: GenericCompanion[Set] = Set } -/** Factory object for <code>Set</code> class. - * - * @author Martin Odersky - * @version 2.8 - * @since 2.8 +/** $factoryInfo + * The current default implementation of a $Coll is one of `EmptySet`, `Set1`, `Set2`, `Set3`, `Set4` in + * class `immutable.Set` for sets of sizes up to 4, and a `immutable.HashSet` for sets of larger sizes. + * @define coll set + * @define Coll Set */ object Set extends SetFactory[Set] { override def empty[A]: Set[A] = immutable.Set.empty[A] diff --git a/src/library/scala/collection/SetLike.scala b/src/library/scala/collection/SetLike.scala index 44dac8e8fe..5a16b975df 100644 --- a/src/library/scala/collection/SetLike.scala +++ b/src/library/scala/collection/SetLike.scala @@ -14,20 +14,21 @@ import generic._ import mutable.{Builder, AddingBuilder} import PartialFunction._ -/** A template trait for sets of type `Set[A]`. +/** A template trait for sets. * - * This trait provides most of the operations of a `Set` independently of its representation. - * It is typically inherited by concrete implementations of sets. + * $setNote + * $setTags + * @since 2.8 * - * $setnote + * @define setNote * - * @tparam A the type of the elements of the set - * @tparam This the type of the set itself. + * A set is a collection that contains no duplicate elements. * - * @author Martin Odersky - * @version 2.8 - * @define setnote - * To implement a concrete set, you need to provide implementations of the + * '''Implementation note:''' + * This trait provides most of the operations of a `Set` independently of its representation. + * It is typically inherited by concrete implementations of sets. + * + * To implement a concrete set, you need to provide implementations of the * following methods: * {{{ * def contains(key: A): Boolean @@ -42,10 +43,18 @@ import PartialFunction._ * }}} * It is also good idea to override methods `foreach` and * `size` for efficiency. - * @define coll set - * @define Coll Set - * @define willNotTerminateInf - * @define mayNotTerminateInf + * + * @define setTags + * @tparam A the type of the elements of the set + * @tparam This the type of the set itself. + * + * @author Martin Odersky + * @version 2.8 + * + * @define coll set + * @define Coll Set + * @define willNotTerminateInf + * @define mayNotTerminateInf */ trait SetLike[A, +This <: SetLike[A, This] with Set[A]] extends IterableLike[A, This] @@ -113,10 +122,10 @@ self => /** Computes the intersection between this set and another set. * + * '''Note:''' Same as `intersect`. * @param that the set to intersect with. * @return a new set consisting of all elements that are both in this * set and in the given set `that`. - * @note Same as `intersect`. */ def &(that: Set[A]): This = intersect(that) @@ -138,10 +147,10 @@ self => /** Computes the union between this set and another set. * + * '''Note:''' Same as `union`. * @param that the set to form the union with. * @return a new set consisting of all elements that are in this * set or in the given set `that`. - * @note Same as `union`. */ def | (that: Set[A]): This = union(that) @@ -155,10 +164,10 @@ self => /** The difference of this set and another set. * + * '''Note:''' Same as `diff`. * @param that the set of elements to exclude. * @return a set containing those elements of this * set that are not also contained in the given set `that`. - * @note Same as `diff`. */ def &~(that: Set[A]): This = diff(that) @@ -181,13 +190,13 @@ self => /** Compares this set with another object for equality. * - * @param that the other object - * @return `true` if `that` is a set which contains the same elements - * as this set. - * @note This operation contains an unchecked cast: if `that` + * '''Note:''' This operation contains an unchecked cast: if `that` * is a set, it will assume with an unchecked cast * that it has the same element type as this set. * Any subsequent ClassCastException is treated as a `false` result. + * @param that the other object + * @return `true` if `that` is a set which contains the same elements + * as this set. */ override def equals(that: Any): Boolean = that match { case that: Set[_] => diff --git a/src/library/scala/collection/Traversable.scala b/src/library/scala/collection/Traversable.scala index 4a1cd01af1..b3383ba802 100644 --- a/src/library/scala/collection/Traversable.scala +++ b/src/library/scala/collection/Traversable.scala @@ -83,6 +83,7 @@ trait Traversable[+A] extends TraversableLike[A, Traversable[A]] } /** $factoryInfo + * The current default implementation of a $Coll is a `Vector`. */ object Traversable extends TraversableFactory[Traversable] { self => diff --git a/src/library/scala/collection/TraversableView.scala b/src/library/scala/collection/TraversableView.scala index ccc33a495d..6d7fa70968 100644 --- a/src/library/scala/collection/TraversableView.scala +++ b/src/library/scala/collection/TraversableView.scala @@ -15,10 +15,14 @@ import generic._ import mutable.Builder import TraversableView.NoBuilder -/** $traversableviewinfo +/** A base trait for non-strict views of traversable collections. + * $traversableViewInfo */ trait TraversableView[+A, +Coll] extends TraversableViewLike[A, Coll, TraversableView[A, Coll]] +/** An object containing the necessary implicit definitions to make + * `TraversableView`s work. Its definitions are generally not accessed directly by clients. + */ object TraversableView { class NoBuilder[A] extends Builder[A, Nothing] { def +=(elem: A): this.type = this diff --git a/src/library/scala/collection/generic/GenericCompanion.scala b/src/library/scala/collection/generic/GenericCompanion.scala index 4332a1c936..2a87f8d913 100644 --- a/src/library/scala/collection/generic/GenericCompanion.scala +++ b/src/library/scala/collection/generic/GenericCompanion.scala @@ -28,13 +28,18 @@ abstract class GenericCompanion[+CC[X] <: Traversable[X]] { /** The underlying collection type with unknown element type */ type Coll = CC[_] - /** The default builder for $Coll objects. */ + /** The default builder for `$Coll` objects. + * @tparam A the type of the ${coll}'s elements + */ def newBuilder[A]: Builder[A, CC[A]] - /** The empty collection of type $Coll[A] */ + /** An empty collection of type `$Coll[A]` + * @tparam A the type of the ${coll}'s elements + */ def empty[A]: CC[A] = newBuilder[A].result /** Creates a $coll with the specified elements. + * @tparam A the type of the ${coll}'s elements * @param elems the elements of the created $coll * @return a new $coll with elements `elems` */ diff --git a/src/library/scala/collection/generic/ImmutableMapFactory.scala b/src/library/scala/collection/generic/ImmutableMapFactory.scala index 2fd22e7f02..512014ba09 100644 --- a/src/library/scala/collection/generic/ImmutableMapFactory.scala +++ b/src/library/scala/collection/generic/ImmutableMapFactory.scala @@ -11,9 +11,9 @@ package scala.collection package generic -/** A template for companion objects of <code>immutable.Map</code> and - * subclasses thereof. - * - * @since 2.8 +/** A template for companion objects of `immutable.Map` and subclasses thereof. + * @author Martin Odersky + * @version 2.8 + * @since 2.8 */ abstract class ImmutableMapFactory[CC[A, +B] <: immutable.Map[A, B] with immutable.MapLike[A, B, CC[A, B]]] extends MapFactory[CC] diff --git a/src/library/scala/collection/generic/ImmutableSortedMapFactory.scala b/src/library/scala/collection/generic/ImmutableSortedMapFactory.scala index d5c372ba74..d30f57f0ce 100644 --- a/src/library/scala/collection/generic/ImmutableSortedMapFactory.scala +++ b/src/library/scala/collection/generic/ImmutableSortedMapFactory.scala @@ -12,8 +12,16 @@ package scala.collection package generic -/** A template for companion objects of immutable.Map and subclasses thereof. +/** A template for companion objects of `SortedMap` and subclasses thereof. * * @since 2.8 + * @define Coll SortedMap + * @define coll sorted map + * @define factoryInfo + * This object provides a set of operations needed to create sorted maps of type `$Coll`. + * @author Martin Odersky + * @version 2.8 + * @define sortedMapCanBuildFromInfo + * The standard `CanBuildFrom` instance for sorted maps */ abstract class ImmutableSortedMapFactory[CC[A, B] <: immutable.SortedMap[A, B] with SortedMapLike[A, B, CC[A, B]]] extends SortedMapFactory[CC] diff --git a/src/library/scala/collection/generic/ImmutableSortedSetFactory.scala b/src/library/scala/collection/generic/ImmutableSortedSetFactory.scala index df5c2c7959..684e7c41f1 100644 --- a/src/library/scala/collection/generic/ImmutableSortedSetFactory.scala +++ b/src/library/scala/collection/generic/ImmutableSortedSetFactory.scala @@ -12,8 +12,16 @@ package scala.collection package generic -/** A template for companion objects of mutable.Map and subclasses thereof. +/** A template for companion objects of `SortedSet` and subclasses thereof. * * @since 2.8 + * @define Coll immutable.SortedSet + * @define coll immutable sorted + * @define factoryInfo + * This object provides a set of operations needed to create sorted sets of type `$Coll`. + * @author Martin Odersky + * @version 2.8 + * @define sortedSetCanBuildFromInfo + * The standard `CanBuildFrom` instance for sorted sets */ abstract class ImmutableSortedSetFactory[CC[A] <: immutable.SortedSet[A] with SortedSetLike[A, CC[A]]] extends SortedSetFactory[CC]
\ No newline at end of file diff --git a/src/library/scala/collection/generic/MapFactory.scala b/src/library/scala/collection/generic/MapFactory.scala index fc04f28f26..163c289e23 100644 --- a/src/library/scala/collection/generic/MapFactory.scala +++ b/src/library/scala/collection/generic/MapFactory.scala @@ -22,6 +22,7 @@ import mutable.{Builder, MapBuilder} * This object provides a set of operations needed to create `$Coll` values. * @author Martin Odersky * @version 2.8 + * @since 2.8 * @define canBuildFromInfo * The standard `CanBuildFrom` instance for `$Coll` objects. * @see CanBuildFrom @@ -33,14 +34,28 @@ import mutable.{Builder, MapBuilder} */ abstract class MapFactory[CC[A, B] <: Map[A, B] with MapLike[A, B, CC[A, B]]] { + /** The type constructor of the collection that can be built by this factory */ type Coll = CC[_, _] + /** An empty $Coll */ def empty[A, B]: CC[A, B] + /** A collection of type $Coll that contains given key/value bindings. + * @param elems the key/value pairs that make up the $coll + * @tparam A the type of the keys + * @tparam B the type of the associated values + * @return a new $coll consisting key/value pairs given by `elems`. + */ def apply[A, B](elems: (A, B)*): CC[A, B] = (newBuilder[A, B] ++= elems).result + /** The default builder for $Coll objects. + * @tparam A the type of the keys + * @tparam B the type of the associated values + */ def newBuilder[A, B]: Builder[(A, B), CC[A, B]] = new MapBuilder[A, B, CC[A, B]](empty[A, B]) + /** The standard `CanBuildFrom` class for maps. + */ class MapCanBuildFrom[A, B] extends CanBuildFrom[Coll, (A, B), CC[A, B]] { def apply(from: Coll) = newBuilder[A, B] def apply() = newBuilder diff --git a/src/library/scala/collection/generic/MutableMapFactory.scala b/src/library/scala/collection/generic/MutableMapFactory.scala index 0f1608ee71..2fdb827d05 100644 --- a/src/library/scala/collection/generic/MutableMapFactory.scala +++ b/src/library/scala/collection/generic/MutableMapFactory.scala @@ -14,9 +14,10 @@ package generic import mutable.MapBuilder -/** A template for companion objects of `mutable.Map` and subclasses thereof. - * - * @since 2.8 +/** A template for companion objects of `immutable.Map` and subclasses thereof. + * @author Martin Odersky + * @version 2.8 + * @since 2.8 */ abstract class MutableMapFactory[CC[A, B] <: mutable.Map[A, B] with mutable.MapLike[A, B, CC[A, B]]] extends MapFactory[CC] diff --git a/src/library/scala/collection/generic/SetFactory.scala b/src/library/scala/collection/generic/SetFactory.scala index 6a237d453c..1c4ec3e7e3 100644 --- a/src/library/scala/collection/generic/SetFactory.scala +++ b/src/library/scala/collection/generic/SetFactory.scala @@ -14,8 +14,7 @@ package generic import mutable.{Builder, AddingBuilder} -/** A template for companion objects of <code>Set</code> and subclasses - * thereof. +/** A template for companion objects of `Set` and subclasses thereof. * * @define coll set * @define Coll Set @@ -23,6 +22,7 @@ import mutable.{Builder, AddingBuilder} * This object provides a set of operations needed to create `$Coll` values. * @author Martin Odersky * @version 2.8 + * @since 2.8 * @define canBuildFromInfo * The standard `CanBuildFrom` instance for `$Coll` objects. * @see CanBuildFrom @@ -36,6 +36,8 @@ abstract class SetFactory[CC[X] <: Set[X] with SetLike[X, CC[X]]] def newBuilder[A]: Builder[A, CC[A]] = new AddingBuilder[A, CC[A]](empty[A]) + /** $setCanBuildFromInfo + */ def setCanBuildFrom[A] = new CanBuildFrom[CC[_], A, CC[A]] { def apply(from: CC[_]) = newBuilder[A] def apply() = newBuilder[A] diff --git a/src/library/scala/collection/immutable/BitSet.scala b/src/library/scala/collection/immutable/BitSet.scala index 857b537904..9b801f26cb 100644 --- a/src/library/scala/collection/immutable/BitSet.scala +++ b/src/library/scala/collection/immutable/BitSet.scala @@ -17,6 +17,8 @@ import BitSetLike.{LogWL, updateArray} /** A class for immutable bitsets. * $bitsetinfo + * @define Coll immutable.BitSet + * @define coll immutable bitset */ @serializable @SerialVersionUID(1611436763290191562L) abstract class BitSet extends Set[Int] @@ -53,12 +55,16 @@ abstract class BitSet extends Set[Int] } } -/** A factory object for bitsets */ +/** $factoryInfo + * @define Coll immutable.BitSet + * @define coll immutable bitset + */ object BitSet extends BitSetFactory[BitSet] { /** The empty bitset */ val empty: BitSet = new BitSet1(0L) + /** $bitsetCanBuildFrom */ implicit def canBuildFrom: CanBuildFrom[BitSet, Int, BitSet] = bitsetCanBuildFrom /** A bitset containing all the bits in an array */ diff --git a/src/library/scala/collection/immutable/DefaultMap.scala b/src/library/scala/collection/immutable/DefaultMap.scala index a19b35aff0..667d86d352 100755 --- a/src/library/scala/collection/immutable/DefaultMap.scala +++ b/src/library/scala/collection/immutable/DefaultMap.scala @@ -14,22 +14,24 @@ package immutable import generic._ -/** <p> - * A default map which implements the <code>updated</code> and <code>-</code> - * methods of maps.<br/> - * Instances that inherit from <code>DefaultMap[A, B]</code> still have to - * define: - * </p> - * <pre> - * <b>def</b> get(key: A): Option[B] - * <b>def</b> iterator: Iterator[(A, B)]</pre> - * <p> - * It refers back to the original map. - * </p> - * <p> - * It might also be advisable to override <code>foreach</code> or - * <code>size</code> if efficient implementations can be found. - * </p> +/** A default map which implements the `+` and `-` + * methods of maps. It does so using the default builder for + * maps defined in the `Map` object. + * Instances that inherit from `DefaultMap[A, B]` still have to + * define: + * + * {{{ + * def get(key: A): Option[B] + * def iterator: Iterator[(A, B)] + * }}} + * + * It refers back to the original map. + * + * It might also be advisable to override `foreach` or + * `size` if efficient implementations can be found. + * + * @tparam A the type of the keys contained in this map. + * @tparam B the type of the values associated with the keys. * * @since 2.8 */ @@ -52,3 +54,13 @@ trait DefaultMap[A, +B] extends Map[A, B] { self => b.result } } + + + + + + + + + + diff --git a/src/library/scala/collection/immutable/HashMap.scala b/src/library/scala/collection/immutable/HashMap.scala index e0f801546c..b82e50ec06 100644 --- a/src/library/scala/collection/immutable/HashMap.scala +++ b/src/library/scala/collection/immutable/HashMap.scala @@ -15,17 +15,22 @@ package immutable import generic._ import annotation.unchecked.uncheckedVariance -/** <p> - * This class implements immutable maps using a hash trie. - * </p> +/** This class implements immutable maps using a hash trie. * - * @note the builder of a hash map returns specialized representations EmptyMap,Map1,..., Map4 - * for maps of size <= 4. + * '''Note:''' the builder of a hash map returns specialized representations EmptyMap,Map1,..., Map4 + * for maps of size <= 4. + * + * @tparam A the type of the keys contained in this hash map. + * @tparam B the type of the values associated with the keys. * * @author Martin Odersky * @author Tiark Rompf * @version 2.8 * @since 2.3 + * @define Coll immutable.HashMap + * @define coll immutable hash map + * @define mayNotTerminateInf + * @define willNotTerminateInf */ @serializable @SerialVersionUID(2L) class HashMap[A, +B] extends Map[A,B] with MapLike[A, B, HashMap[A, B]] { @@ -70,20 +75,22 @@ class HashMap[A, +B] extends Map[A,B] with MapLike[A, B, HashMap[A, B]] { protected def updated0[B1 >: B](key: A, hash: Int, level: Int, value: B1, kv: (A, B1)): HashMap[A, B1] = new HashMap.HashMap1(key, hash, value, kv) + protected def removed0(key: A, hash: Int, level: Int): HashMap[A, B] = this - protected def removed0(key: A, hash: Int, level: Int): HashMap[A, B] = this + protected def writeReplace(): AnyRef = new HashMap.SerializationProxy(this) } -/** A factory object for immutable HashMaps. +/** $factoryInfo + * @define Coll immutable.HashMap + * @define coll immutable hash map * - * @author Martin Odersky * @author Tiark Rompf - * @version 2.8 * @since 2.3 */ object HashMap extends ImmutableMapFactory[HashMap] { + /** $mapCanBuildFromInfo */ implicit def canBuildFrom[A, B]: CanBuildFrom[Coll, (A, B), HashMap[A, B]] = new MapCanBuildFrom[A, B] def empty[A, B]: HashMap[A, B] = EmptyHashMap.asInstanceOf[HashMap[A, B]] @@ -108,14 +115,7 @@ object HashMap extends ImmutableMapFactory[HashMap] { m.updated0(this.key, this.hash, level, this.value, this.kv).updated0(key, hash, level, value, kv) } else { // 32-bit hash collision (rare, but not impossible) - // wrap this in a HashTrieMap if called with level == 0 (otherwise serialization won't work) - if (level == 0) { - val elems = new Array[HashMap[A,B1]](1) - elems(0) = new HashMapCollision1(hash, ListMap.empty.updated(this.key,this.value).updated(key,value)) - new HashTrieMap[A,B1](1 << ((hash >>> level) & 0x1f), elems, 2) - } else { - new HashMapCollision1(hash, ListMap.empty.updated(this.key,this.value).updated(key,value)) - } + new HashMapCollision1(hash, ListMap.empty.updated(this.key,this.value).updated(key,value)) } } @@ -125,18 +125,6 @@ object HashMap extends ImmutableMapFactory[HashMap] { override def iterator: Iterator[(A,B)] = Iterator(ensurePair) override def foreach[U](f: ((A, B)) => U): Unit = f(ensurePair) private[HashMap] def ensurePair: (A,B) = if (kv ne null) kv else { kv = (key, value); kv } - - private def writeObject(out: java.io.ObjectOutputStream) { - out.writeObject(key) - out.writeObject(value) - } - - private def readObject(in: java.io.ObjectInputStream) { - key = in.readObject().asInstanceOf[A] - value = in.readObject().asInstanceOf[B] - hash = computeHash(key) - } - } private class HashMapCollision1[A,+B](private[HashMap] var hash: Int, var kvs: ListMap[A,B @uncheckedVariance]) extends HashMap[A,B] { @@ -166,22 +154,6 @@ object HashMap extends ImmutableMapFactory[HashMap] { override def iterator: Iterator[(A,B)] = kvs.iterator override def foreach[U](f: ((A, B)) => U): Unit = kvs.foreach(f) - - private def writeObject(out: java.io.ObjectOutputStream) { - // this cannot work - reading things in might produce different - // hash codes and remove the collision. however this is never called - // because no references to this class are ever handed out to client code - // and HashTrieMap serialization takes care of the situation - error("cannot serialize an immutable.HashMap where all items have the same 32-bit hash code") - //out.writeObject(kvs) - } - - private def readObject(in: java.io.ObjectInputStream) { - error("cannot deserialize an immutable.HashMap where all items have the same 32-bit hash code") - //kvs = in.readObject().asInstanceOf[ListMap[A,B]] - //hash = computeHash(kvs.) - } - } @@ -246,19 +218,27 @@ object HashMap extends ImmutableMapFactory[HashMap] { val index = (hash >>> level) & 0x1f val mask = (1 << index) val offset = Integer.bitCount(bitmap & (mask-1)) - if (((bitmap >>> index) & 1) == 1) { - val elemsNew = new Array[HashMap[A,B]](elems.length) - Array.copy(elems, 0, elemsNew, 0, elems.length) + if ((bitmap & mask) != 0) { val sub = elems(offset) // TODO: might be worth checking if sub is HashTrieMap (-> monomorphic call site) val subNew = sub.removed0(key, hash, level + 5) - elemsNew(offset) = subNew - // TODO: handle shrinking - val sizeNew = size + (subNew.size - sub.size) - if (sizeNew > 0) - new HashTrieMap(bitmap, elemsNew, size + (subNew.size - sub.size)) - else - HashMap.empty[A,B] + if (subNew.isEmpty) { + val bitmapNew = bitmap ^ mask + if (bitmapNew != 0) { + val elemsNew = new Array[HashMap[A,B]](elems.length - 1) + Array.copy(elems, 0, elemsNew, 0, offset) + Array.copy(elems, offset + 1, elemsNew, offset, elems.length - offset - 1) + val sizeNew = size - sub.size + new HashTrieMap(bitmapNew, elemsNew, sizeNew) + } else + HashMap.empty[A,B] + } else { + val elemsNew = new Array[HashMap[A,B]](elems.length) + Array.copy(elems, 0, elemsNew, 0, elems.length) + elemsNew(offset) = subNew + val sizeNew = size + (subNew.size - sub.size) + new HashTrieMap(bitmap, elemsNew, sizeNew) + } } else { this } @@ -367,31 +347,29 @@ time { mNew.iterator.foreach( p => ()) } } } + } + @serializable @SerialVersionUID(2L) private class SerializationProxy[A,B](@transient private var orig: HashMap[A, B]) { private def writeObject(out: java.io.ObjectOutputStream) { - // no out.defaultWriteObject() - out.writeInt(size) - foreach { p => - out.writeObject(p._1) - out.writeObject(p._2) + val s = orig.size + out.writeInt(s) + for ((k,v) <- orig) { + out.writeObject(k) + out.writeObject(v) } } private def readObject(in: java.io.ObjectInputStream) { - val size = in.readInt - var index = 0 - var m = HashMap.empty[A,B] - while (index < size) { - // TODO: optimize (use unsafe mutable update) - m = m + ((in.readObject.asInstanceOf[A], in.readObject.asInstanceOf[B])) - index += 1 + orig = empty + val s = in.readInt() + for (i <- 0 until s) { + val key = in.readObject().asInstanceOf[A] + val value = in.readObject().asInstanceOf[B] + orig = orig.updated(key, value) } - var tm = m.asInstanceOf[HashTrieMap[A,B]] - bitmap = tm.bitmap - elems = tm.elems - size0 = tm.size0 } + private def readResolve(): AnyRef = orig } } diff --git a/src/library/scala/collection/immutable/HashSet.scala b/src/library/scala/collection/immutable/HashSet.scala index e79b456a2f..68da0cef50 100644 --- a/src/library/scala/collection/immutable/HashSet.scala +++ b/src/library/scala/collection/immutable/HashSet.scala @@ -15,16 +15,19 @@ package immutable import generic._ import annotation.unchecked.uncheckedVariance -/** - * This class implements immutable sets using a hash trie. +/** This class implements immutable sets using a hash trie. * - * @note the builder of a hash set returns specialized representations `EmptySet`,`Set1`,..., `Set4` - * for sets of `size <= 4`. + * '''Note:''' the builder of a hash set returns specialized representations `EmptySet`,`Set1`,..., `Set4` + * for sets of `size <= 4`. + * + * @tparam A the type of the elements contained in this hash set. * * @author Martin Odersky * @author Tiark Rompf * @version 2.8 * @since 2.3 + * @define Coll immutable.HashSet + * @define coll immutable hash set */ @serializable @SerialVersionUID(2L) class HashSet[A] extends Set[A] @@ -69,28 +72,24 @@ class HashSet[A] extends Set[A] protected def updated0(key: A, hash: Int, level: Int): HashSet[A] = new HashSet.HashSet1(key, hash) - - protected def removed0(key: A, hash: Int, level: Int): HashSet[A] = this + protected def writeReplace(): AnyRef = new HashSet.SerializationProxy(this) } -/* -object HashSet extends SetFactory[HashSet] { - implicit def canBuildFrom[A]: CanBuildFrom[Coll, A, HashSet[A]] = setCanBuildFrom[A] - override def empty[A]: HashSet[A] = new HashSet -} -*/ - - -/** A factory object for immutable HashSets. +/** $factoryInfo + * @define Coll immutable.HashSet + * @define coll immutable hash set * - * @author Martin Odersky * @author Tiark Rompf - * @version 2.8 * @since 2.3 + * @define Coll immutable.HashSet + * @define coll immutable hash set + * @define mayNotTerminateInf + * @define willNotTerminateInf */ object HashSet extends SetFactory[HashSet] { + /** $setCanBuildFromInfo */ implicit def canBuildFrom[A]: CanBuildFrom[Coll, A, HashSet[A]] = setCanBuildFrom[A] override def empty[A]: HashSet[A] = EmptyHashSet.asInstanceOf[HashSet[A]] @@ -114,14 +113,7 @@ object HashSet extends SetFactory[HashSet] { m.updated0(this.key, this.hash, level).updated0(key, hash, level) } else { // 32-bit hash collision (rare, but not impossible) - // wrap this in a HashTrieSet if called with level == 0 (otherwise serialization won't work) - if (level == 0) { - val elems = new Array[HashSet[A]](1) - elems(0) = new HashSetCollision1(hash, ListSet.empty + this.key + key) - new HashTrieSet[A](1 << ((hash >>> level) & 0x1f), elems, 2) - } else { - new HashSetCollision1(hash, ListSet.empty + this.key + key) - } + new HashSetCollision1(hash, ListSet.empty + this.key + key) } } @@ -130,16 +122,6 @@ object HashSet extends SetFactory[HashSet] { override def iterator: Iterator[A] = Iterator(key) override def foreach[U](f: A => U): Unit = f(key) - - private def writeObject(out: java.io.ObjectOutputStream) { - out.writeObject(key) - } - - private def readObject(in: java.io.ObjectInputStream) { - key = in.readObject().asInstanceOf[A] - hash = computeHash(key) - } - } private class HashSetCollision1[A](private[HashSet] var hash: Int, var ks: ListSet[A]) extends HashSet[A] { @@ -232,24 +214,33 @@ object HashSet extends SetFactory[HashSet] { val index = (hash >>> level) & 0x1f val mask = (1 << index) val offset = Integer.bitCount(bitmap & (mask-1)) - if (((bitmap >>> index) & 1) == 1) { - val elemsNew = new Array[HashSet[A]](elems.length) - Array.copy(elems, 0, elemsNew, 0, elems.length) + if ((bitmap & mask) != 0) { val sub = elems(offset) - // TODO: might be worth checking if sub is HashTrieSet (-> monomorphic call site) + // TODO: might be worth checking if sub is HashTrieMap (-> monomorphic call site) val subNew = sub.removed0(key, hash, level + 5) - elemsNew(offset) = subNew - // TODO: handle shrinking - val sizeNew = size + (subNew.size - sub.size) - if (sizeNew > 0) - new HashTrieSet(bitmap, elemsNew, size + (subNew.size - sub.size)) - else - HashSet.empty[A] + if (subNew.isEmpty) { + val bitmapNew = bitmap ^ mask + if (bitmapNew != 0) { + val elemsNew = new Array[HashSet[A]](elems.length - 1) + Array.copy(elems, 0, elemsNew, 0, offset) + Array.copy(elems, offset + 1, elemsNew, offset, elems.length - offset - 1) + val sizeNew = size - sub.size + new HashTrieSet(bitmapNew, elemsNew, sizeNew) + } else + HashSet.empty[A] + } else { + val elemsNew = new Array[HashSet[A]](elems.length) + Array.copy(elems, 0, elemsNew, 0, elems.length) + elemsNew(offset) = subNew + val sizeNew = size + (subNew.size - sub.size) + new HashTrieSet(bitmap, elemsNew, sizeNew) + } } else { this } } + override def iterator = new Iterator[A] { private[this] var depth = 0 private[this] var arrayStack = new Array[Array[HashSet[A]]](6) @@ -333,31 +324,27 @@ time { mNew.iterator.foreach( p => ()) } i += 1 } } + } - + @serializable @SerialVersionUID(2L) private class SerializationProxy[A,B](@transient private var orig: HashSet[A]) { private def writeObject(out: java.io.ObjectOutputStream) { - // no out.defaultWriteObject() - out.writeInt(size) - foreach { e => + val s = orig.size + out.writeInt(s) + for (e <- orig) { out.writeObject(e) } } private def readObject(in: java.io.ObjectInputStream) { - val size = in.readInt - var index = 0 - var m = HashSet.empty[A] - while (index < size) { - // TODO: optimize (use unsafe mutable update) - m = m + in.readObject.asInstanceOf[A] - index += 1 + orig = empty + val s = in.readInt() + for (i <- 0 until s) { + val e = in.readObject().asInstanceOf[A] + orig = orig + e } - var tm = m.asInstanceOf[HashTrieSet[A]] - bitmap = tm.bitmap - elems = tm.elems - size0 = tm.size0 } + private def readResolve(): AnyRef = orig } } diff --git a/src/library/scala/collection/immutable/IndexedSeq.scala b/src/library/scala/collection/immutable/IndexedSeq.scala index 268bd56a85..d3223fd106 100644 --- a/src/library/scala/collection/immutable/IndexedSeq.scala +++ b/src/library/scala/collection/immutable/IndexedSeq.scala @@ -14,7 +14,7 @@ package immutable import generic._ import mutable.{ArrayBuffer, Builder} -/** A subtrait of <code>collection.IndexedSeq</code> which represents indexed sequences +/** A subtrait of `collection.IndexedSeq` which represents indexed sequences * that are guaranteed immutable. * $indexedSeqInfo */ @@ -26,6 +26,7 @@ trait IndexedSeq[+A] extends Seq[A] } /** $factoryInfo + * The current default implementation of a $Coll is a `Vector`. * @define coll indexed sequence * @define Coll IndexedSeq */ diff --git a/src/library/scala/collection/immutable/IntMap.scala b/src/library/scala/collection/immutable/IntMap.scala index 75a25e0223..90dfa541e3 100644 --- a/src/library/scala/collection/immutable/IntMap.scala +++ b/src/library/scala/collection/immutable/IntMap.scala @@ -12,8 +12,8 @@ package scala.collection package immutable; -/** - * @author David MacIver +/** Utility class for integer maps. + * @author David MacIver */ private[immutable] object IntMapUtils { def zero(i : Int, mask : Int) = (i & mask) == 0; @@ -50,8 +50,8 @@ private[immutable] object IntMapUtils { import IntMapUtils._ -/** - * @since 2.7 +/** A companion object for integer maps. + * @since 2.7 */ object IntMap { def empty[T] : IntMap[T] = IntMap.Nil; @@ -146,15 +146,19 @@ private[immutable] class IntMapKeyIterator[V](it : IntMap[V]) extends IntMapIter import IntMap._ -/** - * Specialised immutable map structure for integer keys, based on - * <a href="http://citeseer.ist.psu.edu/okasaki98fast.html">Fast Mergeable Integer Maps</a> - * by Okasaki and Gill. Essentially a trie based on binary digits of the the integers. +/** Specialised immutable map structure for integer keys, based on + * <a href="http://citeseer.ist.psu.edu/okasaki98fast.html">Fast Mergeable Integer Maps</a> + * by Okasaki and Gill. Essentially a trie based on binary digits of the the integers. * - * Note: This class is as of 2.8 largely superseded by HashMap. + * Note: This class is as of 2.8 largely superseded by HashMap. * - * @since 2.7 + * @tparam T type of the values associated with integer keys. * + * @since 2.7 + * @define Coll immutable.IntMap + * @define coll immutable integer map + * @define mayNotTerminateInf + * @define willNotTerminateInf */ sealed abstract class IntMap[+T] extends Map[Int, T] with MapLike[Int, T, IntMap[T]] { override def empty: IntMap[T] = IntMap.Nil; diff --git a/src/library/scala/collection/immutable/Iterable.scala b/src/library/scala/collection/immutable/Iterable.scala index 795fc2fa92..e0ef5ffcc1 100644 --- a/src/library/scala/collection/immutable/Iterable.scala +++ b/src/library/scala/collection/immutable/Iterable.scala @@ -17,6 +17,9 @@ import mutable.Builder /** A base trait for iterable collections that are guaranteed immutable. * $iterableInfo + * + * @define Coll immutable.Iterable + * @define coll immutable iterable collection */ trait Iterable[+A] extends Traversable[A] with scala.collection.Iterable[A] @@ -25,14 +28,11 @@ trait Iterable[+A] extends Traversable[A] override def companion: GenericCompanion[Iterable] = Iterable } -/** A factory object for the trait <code>Iterable</code>. - * - * @author Martin Odersky - * @version 2.8 - * @since 2.8 +/** $factoryInfo + * @define Coll immutable.Iterable + * @define coll immutable iterable collection */ object Iterable extends TraversableFactory[Iterable] { implicit def canBuildFrom[A]: CanBuildFrom[Coll, A, Iterable[A]] = new GenericCanBuildFrom[A] def newBuilder[A]: Builder[A, Iterable[A]] = new mutable.ListBuffer } - diff --git a/src/library/scala/collection/immutable/LinearSeq.scala b/src/library/scala/collection/immutable/LinearSeq.scala index 9cb35dced5..180844ce79 100644 --- a/src/library/scala/collection/immutable/LinearSeq.scala +++ b/src/library/scala/collection/immutable/LinearSeq.scala @@ -15,7 +15,7 @@ package immutable import generic._ import mutable.Builder -/** A subtrait of <code>collection.LinearSeq</code> which represents sequences that +/** A subtrait of `collection.LinearSeq` which represents sequences that * are guaranteed immutable. * $linearSeqInfo */ @@ -27,8 +27,9 @@ trait LinearSeq[+A] extends Seq[A] } /** $factoryInfo - * @define coll linear sequence - * @define Coll LinearSeq + * The current default implementation of a $Coll is a `List`. + * @define coll immutable linear sequence + * @define Coll immutable.LinearSeq */ object LinearSeq extends SeqFactory[LinearSeq] { implicit def canBuildFrom[A]: CanBuildFrom[Coll, A, LinearSeq[A]] = new GenericCanBuildFrom[A] diff --git a/src/library/scala/collection/immutable/ListMap.scala b/src/library/scala/collection/immutable/ListMap.scala index 4342e54a9d..a88c3a52d5 100644 --- a/src/library/scala/collection/immutable/ListMap.scala +++ b/src/library/scala/collection/immutable/ListMap.scala @@ -14,25 +14,34 @@ package immutable import generic._ -/** The canonical factory of <a href="ListMap.html">ListMap</a>'s. - * +/** $factoryInfo * @since 1 + * @define Coll immutable.ListMap + * @define coll immutable list map */ object ListMap extends ImmutableMapFactory[ListMap] { + /** $mapCanBuildFromInfo */ implicit def canBuildFrom[A, B]: CanBuildFrom[Coll, (A, B), ListMap[A, B]] = new MapCanBuildFrom[A, B] def empty[A, B]: ListMap[A, B] = new ListMap } /** This class implements immutable maps using a list-based data - * structure. Instances of <code>ListMap</code> represent + * structure. Instances of `ListMap` represent * empty maps; they can be either created by calling the constructor - * directly, or by applying the function <code>ListMap.empty</code>. + * directly, or by applying the function `ListMap.empty`. + * + * @tparam A the type of the keys in this list map. + * @tparam B the type of the values associated with the keys. * * @author Matthias Zenger * @author Martin Odersky * @version 2.0, 01/01/2007 * @since 1 + * @define Coll immutable.ListMap + * @define coll immutable list map + * @define mayNotTerminateInf + * @define willNotTerminateInf */ @serializable @SerialVersionUID(301002838095710379L) class ListMap[A, +B] extends Map[A, B] with MapLike[A, B, ListMap[A, B]] { @@ -45,7 +54,7 @@ class ListMap[A, +B] extends Map[A, B] with MapLike[A, B, ListMap[A, B]] { */ override def size: Int = 0 - /** Checks if this map maps <code>key</code> to a value and return the + /** Checks if this map maps `key` to a value and return the * value if it exists. * * @param key the key of the mapping of interest diff --git a/src/library/scala/collection/immutable/ListSet.scala b/src/library/scala/collection/immutable/ListSet.scala index f7b76d2317..2a202df9ef 100644 --- a/src/library/scala/collection/immutable/ListSet.scala +++ b/src/library/scala/collection/immutable/ListSet.scala @@ -14,24 +14,32 @@ package immutable import generic._ -/** The canonical factory of <a href="ListSet.html">ListSet</a>'s - * +/** $factoryInfo + * @define Coll immutable.ListSet + * @define coll immutable list set * @since 1 */ object ListSet extends SetFactory[ListSet] { + /** setCanBuildFromInfo */ implicit def canBuildFrom[A]: CanBuildFrom[Coll, A, ListSet[A]] = setCanBuildFrom[A] override def empty[A] = new ListSet[A] } /** This class implements immutable sets using a list-based data - * structure. Instances of <code>ListSet</code> represent + * structure. Instances of `ListSet` represent * empty sets; they can be either created by calling the constructor - * directly, or by applying the function <code>ListSet.empty</code>. + * directly, or by applying the function `ListSet.empty`. + * + * @tparam A the type of the elements contained in this list set. * * @author Matthias Zenger * @version 1.0, 09/07/2003 * @since 1 + * @define Coll immutable.ListSet + * @define coll immutable list set + * @define mayNotTerminateInf + * @define willNotTerminateInf */ @serializable class ListSet[A] extends Set[A] diff --git a/src/library/scala/collection/immutable/LongMap.scala b/src/library/scala/collection/immutable/LongMap.scala index 24afb65b99..691a81d9f0 100644 --- a/src/library/scala/collection/immutable/LongMap.scala +++ b/src/library/scala/collection/immutable/LongMap.scala @@ -1,8 +1,8 @@ package scala.collection package immutable -/** - * @author David MacIver +/** Utility class for long maps. + * @author David MacIver */ private[immutable] object LongMapUtils{ def zero(i : Long, mask : Long) = (i & mask) == 0L; @@ -40,8 +40,8 @@ private[immutable] object LongMapUtils{ import LongMapUtils._ -/** - * @since 2.7 +/** A companion object for long maps. + * @since 2.7 */ object LongMap{ def empty[T] : LongMap[T] = LongMap.Nil; @@ -134,13 +134,19 @@ private[immutable] class LongMapKeyIterator[V](it : LongMap[V]) extends LongMapI import LongMap._; /** - * Specialised immutable map structure for long keys, based on - * <a href="http://citeseer.ist.psu.edu/okasaki98fast.html">Fast Mergeable Long Maps</a> - * by Okasaki and Gill. Essentially a trie based on binary digits of the the integers. + * Specialised immutable map structure for long keys, based on + * <a href="http://citeseer.ist.psu.edu/okasaki98fast.html">Fast Mergeable Long Maps</a> + * by Okasaki and Gill. Essentially a trie based on binary digits of the the integers. + * + * Note: This class is as of 2.8 largely superseded by HashMap. * - * Note: This class is as of 2.8 largely superseded by HashMap. + * @tparam T type of the values associated with the long keys. * - * @since 2.7 + * @since 2.7 + * @define Coll immutable.LongMap + * @define coll immutable long integer map + * @define mayNotTerminateInf + * @define willNotTerminateInf */ sealed abstract class LongMap[+T] extends Map[Long, T] with MapLike[Long, T, LongMap[T]] { override def empty: LongMap[T] = LongMap.Nil; diff --git a/src/library/scala/collection/immutable/Map.scala b/src/library/scala/collection/immutable/Map.scala index e3469099b8..74cf4a1715 100644 --- a/src/library/scala/collection/immutable/Map.scala +++ b/src/library/scala/collection/immutable/Map.scala @@ -48,12 +48,13 @@ trait Map[A, +B] extends Iterable[(A, B)] def withDefaultValue[B1 >: B](d: B1): Map[A, B1] = new Map.WithDefault[A, B1](this, x => d) } -/** - * A companion object for immutable maps. - * - * @since 1 +/** $factoryInfo + * @define Coll immutable.Map + * @define coll immutable map */ object Map extends ImmutableMapFactory[Map] { + + /** $mapCanBuildFromInfo */ implicit def canBuildFrom[A, B]: CanBuildFrom[Coll, (A, B), Map[A, B]] = new MapCanBuildFrom[A, B] def empty[A, B]: Map[A, B] = EmptyMap.asInstanceOf[Map[A, B]] diff --git a/src/library/scala/collection/immutable/MapLike.scala b/src/library/scala/collection/immutable/MapLike.scala index 6f816ffa52..367ffadd43 100644 --- a/src/library/scala/collection/immutable/MapLike.scala +++ b/src/library/scala/collection/immutable/MapLike.scala @@ -14,32 +14,38 @@ package immutable import generic._ -/** <p> - * A generic template for immutable maps from keys of type <code>A</code> - * to values of type <code>B</code>.<br/> - * To implement a concrete map, you need to provide implementations of the - * following methods (where <code>This</code> is the type of the map in - * question): - * </p> - * <pre> - * <b>def</b> get(key: A): Option[B] - * <b>def</b> iterator: Iterator[(A, B)] - * <b>def</b> + [B1 >: B](kv: (A, B)): Map[A, B1] - * <b>def</b> - (key: A): This</pre> - * <p> - * If you wish that methods <code>like</code>, <code>take</code>, <code>drop</code>, - * <code>filter</code> return the same kind of map, you should also override: - * </p> - * <pre> - * <b>def</b> empty: This</pre> - * <p> - * It is also good idea to override methods <code>foreach</code> and - * <code>size</code> for efficiency. - * </p> +/** + * A generic template for immutable 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 actual map implementation): + * + * {{{ + * def get(key: A): Option[B] + * def iterator: Iterator[(A, B)] + * def + [B1 >: B](kv: (A, B)): Map[A, B1] + * def - (key: A): This + * }}} + * + * If you wish that transformer methods like `take`, `drop`, `filter` return the + * same kind of map, you should also override: + * + * {{{ + * def empty: This + * }}} + * + * It is also good idea to override methods `foreach` and + * `size` for efficiency. + * + * @param A the type of the keys contained in this collection. + * @param B the type of the values associated with the keys. + * @param This The type of the actual map implementation. * * @author Martin Odersky * @version 2.8 * @since 2.8 + * @define Coll immutable.Map + * @define coll immutable map */ trait MapLike[A, +B, +This <: MapLike[A, B, This] with Map[A, B]] extends scala.collection.MapLike[A, B, This] @@ -55,8 +61,8 @@ trait MapLike[A, +B, +This <: MapLike[A, B, This] with Map[A, B]] override def updated [B1 >: B](key: A, value: B1): immutable.Map[A, B1] = this + ((key, value)) /** Add a key/value pair to this map, returning a new map. - * @param kv the key/value pair - * @return A new map with the new binding added to this map + * @param kv the key/value pair. + * @return A new map with the new binding added to this map. */ def + [B1 >: B] (kv: (A, B1)): immutable.Map[A, B1] @@ -66,6 +72,7 @@ trait MapLike[A, +B, +This <: MapLike[A, B, This] with Map[A, B]] * @param elem1 the first element to add. * @param elem2 the second element to add. * @param elems the remaining elements to add. + * @return A new map with the new bindings added to this map. */ override def + [B1 >: B] (elem1: (A, B1), elem2: (A, B1), elems: (A, B1) *): immutable.Map[A, B1] = this + elem1 + elem2 ++ elems @@ -73,7 +80,8 @@ trait MapLike[A, +B, +This <: MapLike[A, B, This] with Map[A, B]] /** Adds a number of elements provided by a traversable object * and returns a new collection with the added elements. * - * @param elems the traversable object. + * @param xs the traversable object consisting of key-value pairs. + * @return a new immutable map with the bindings of this map and those from `xs`. */ override def ++[B1 >: B](xs: TraversableOnce[(A, B1)]): immutable.Map[A, B1] = ((repr: immutable.Map[A, B1]) /: xs) (_ + _) @@ -104,7 +112,7 @@ trait MapLike[A, +B, +This <: MapLike[A, B, This] with Map[A, B]] } /** This function transforms all the values of mappings contained - * in this map with function <code>f</code>. + * in this map with function `f`. * * @param f A function over keys and values * @return the updated map diff --git a/src/library/scala/collection/immutable/MapProxy.scala b/src/library/scala/collection/immutable/MapProxy.scala index 371af042e7..a511c6d145 100644 --- a/src/library/scala/collection/immutable/MapProxy.scala +++ b/src/library/scala/collection/immutable/MapProxy.scala @@ -12,14 +12,12 @@ package scala.collection package immutable -/** <p> - * This is a simple wrapper class for <a href="Map.html" - * target="contentFrame"><code>scala.collection.mutable.Map</code></a>. - * </p> - * <p> - * It is most useful for assembling customized map abstractions - * dynamically using object composition and forwarding. - * </p> +/** + * This is a simple wrapper class for <a href="Map.html" + * target="contentFrame">`scala.collection.immutable.Map`</a>. + * + * It is most useful for assembling customized map abstractions + * dynamically using object composition and forwarding. * * @author Matthias Zenger, Martin Odersky * @version 2.0, 31/12/2006 diff --git a/src/library/scala/collection/immutable/NumericRange.scala b/src/library/scala/collection/immutable/NumericRange.scala index 645c5fed24..67115f7184 100644 --- a/src/library/scala/collection/immutable/NumericRange.scala +++ b/src/library/scala/collection/immutable/NumericRange.scala @@ -14,24 +14,28 @@ package immutable import mutable.{ Builder, ListBuffer } import generic._ -/** <p> - * <code>NumericRange</code> is a more generic version of the - * <code>Range</code> class which works with arbitrary types. - * It must be supplied with an `Integral` implementation of the - * range type. +/** `NumericRange` is a more generic version of the + * `Range` class which works with arbitrary types. + * It must be supplied with an `Integral` implementation of the + * range type. * - * Factories for likely types include `Range.BigInt`, `Range.Long`, - * and `Range.BigDecimal`. `Range.Int` exists for completeness, but - * the `Int`-based `scala.Range` should be more performant. - * </p><pre> - * <b>val</b> r1 = new Range(0, 100, 1) - * <b>val</b> veryBig = Int.MaxValue.toLong + 1 - * <b>val</b> r2 = Range.Long(veryBig, veryBig + 100, 1) + * Factories for likely types include `Range.BigInt`, `Range.Long`, + * and `Range.BigDecimal`. `Range.Int` exists for completeness, but + * the `Int`-based `scala.Range` should be more performant. + * + * {{{ + * val r1 = new Range(0, 100, 1) + * val veryBig = Int.MaxValue.toLong + 1 + * val r2 = Range.Long(veryBig, veryBig + 100, 1) * assert(r1 sameElements r2.map(_ - veryBig)) - * </pre> + * }}} * * @author Paul Phillips * @version 2.8 + * @define Coll NumericRange + * @define coll numeric range + * @define mayNotTerminateInf + * @define willNotTerminateInf */ @serializable abstract class NumericRange[T] @@ -68,7 +72,7 @@ extends IndexedSeq[T] protected def underlying = collection.immutable.IndexedSeq.empty[T] /** Create a new range with the start and end values of this range and - * a new <code>step</code>. + * a new `step`. */ def by(newStep: T): NumericRange[T] = copy(start, end, newStep) @@ -200,6 +204,8 @@ extends IndexedSeq[T] } } +/** A companion object for numeric ranges. + */ object NumericRange { class Inclusive[T](start: T, end: T, step: T)(implicit num: Integral[T]) extends NumericRange(start, end, step, true) { diff --git a/src/library/scala/collection/immutable/PagedSeq.scala b/src/library/scala/collection/immutable/PagedSeq.scala index bd12502520..2a1b3c110c 100644 --- a/src/library/scala/collection/immutable/PagedSeq.scala +++ b/src/library/scala/collection/immutable/PagedSeq.scala @@ -15,7 +15,7 @@ package immutable import java.io._ import scala.util.matching.Regex -/** The PagedSeq object defines a lazy implementations of +/** The `PagedSeq` object defines a lazy implementations of * a random access sequence. * * @since 2.7 @@ -108,8 +108,14 @@ import PagedSeq._ /** An implementation of lazily computed sequences, where elements are stored * in ``pages'', i.e. arrays of fixed size. * - * @author Martin Odersky - * @since 2.7 + * @tparam T the type of the elements contained in this paged sequence, with a `ClassManifest` context bound. + * + * @author Martin Odersky + * @since 2.7 + * @define Coll PagedSeq + * @define coll paged sequence + * @define mayNotTerminateInf + * @define willNotTerminateInf */ class PagedSeq[T: ClassManifest] protected( more: (Array[T], Int, Int) => Int, diff --git a/src/library/scala/collection/immutable/Queue.scala b/src/library/scala/collection/immutable/Queue.scala index 02d344ceea..7a903cb201 100644 --- a/src/library/scala/collection/immutable/Queue.scala +++ b/src/library/scala/collection/immutable/Queue.scala @@ -15,12 +15,16 @@ package immutable import generic._ import mutable.{ Builder, ListBuffer } -/** <code>Queue</code> objects implement data structures that allow to +/** `Queue` objects implement data structures that allow to * insert and retrieve elements in a first-in-first-out (FIFO) manner. * * @author Erik Stenman * @version 1.0, 08/07/2003 * @since 1 + * @define Coll immutable.Queue + * @define coll immutable queue + * @define mayNotTerminateInf + * @define willNotTerminateInf */ @serializable @SerialVersionUID(-7622936493364270175L) @@ -31,11 +35,11 @@ class Queue[+A] protected(protected val in: List[A], protected val out: List[A]) override def companion: GenericCompanion[Queue] = Queue - /** Returns the <code>n</code>-th element of this queue. + /** Returns the `n`-th element of this queue. * The first element is at position 0. * * @param n index of the element to return - * @return the element at position <code>n</code> in this queue. + * @return the element at position `n` in this queue. * @throws Predef.NoSuchElementException if the queue is too short. */ def apply(n: Int): A = { @@ -127,7 +131,12 @@ class Queue[+A] protected(protected val in: List[A], protected val out: List[A]) override def toString() = mkString("Queue(", ", ", ")") } +/** $factoryInfo + * @define Coll immutable.Queue + * @define coll immutable queue + */ object Queue extends SeqFactory[Queue] { + /** $genericCanBuildFromInfo */ implicit def canBuildFrom[A]: CanBuildFrom[Coll, A, Queue[A]] = new GenericCanBuildFrom[A] def newBuilder[A]: Builder[A, Queue[A]] = new ListBuffer[A] mapResult (x => new Queue[A](Nil, x.toList)) override def empty[A]: Queue[A] = new Queue[A](Nil, Nil) diff --git a/src/library/scala/collection/immutable/Range.scala b/src/library/scala/collection/immutable/Range.scala index 5424a7afcb..8f1f7d58a6 100644 --- a/src/library/scala/collection/immutable/Range.scala +++ b/src/library/scala/collection/immutable/Range.scala @@ -10,20 +10,31 @@ package scala.collection.immutable -/** <p> - * The <code>Range</code> class represents integer values in range - * <code>[start;end)</code> with non-zero step value <code>step</code>. - * It's a special case of an indexed sequence. - * For example: - * </p><pre> - * <b>val</b> r1 = 0 until 10 - * <b>val</b> r2 = r1.start until r1.end by r1.step + 1 +/** The `Range` class represents integer values in range + * ''[start;end)'' with non-zero step value `step`. + * It's a special case of an indexed sequence. + * For example: + * + * {{{ + * val r1 = 0 until 10 + * val r2 = r1.start until r1.end by r1.step + 1 * println(r2.length) // = 5 - * </pre> + * }}} + * + * @param start the start of this range. + * @param end the exclusive end of the range. + * @param step the step for the range. * * @author Martin Odersky * @version 2.8 * @since 2.5 + * @define Coll Range + * @define coll range + * @define mayNotTerminateInf + * @define willNotTerminateInf + * @define doesNotUseBuilders + * '''Note:''' this method does not use builders to construct a new range, + * and its complexity is O(1). */ @serializable @SerialVersionUID(7618862778670199309L) class Range(val start: Int, val end: Int, val step: Int) extends IndexedSeq[Int] { @@ -33,7 +44,9 @@ class Range(val start: Int, val end: Int, val step: Int) extends IndexedSeq[Int] protected def copy(start: Int, end: Int, step: Int): Range = new Range(start, end, step) /** Create a new range with the `start` and `end` values of this range and - * a new <code>step</code>. + * a new `step`. + * + * @return a new range with a different step */ def by(step: Int): Range = copy(start, end, step) @@ -84,18 +97,46 @@ class Range(val start: Int, val end: Int, val step: Int) extends IndexedSeq[Int] start } + /** Creates a new range containing the first `n` elements of this range. + * + * $doesNotUseBuilders + * + * @param n the number of elements to take. + * @return a new range consisting of `n` first elements. + */ final override def take(n: Int): Range = if (n > 0 && length > 0) { Range(start, locationAfterN(n - 1), step).inclusive } else { Range(start, start, step) } + /** Creates a new range containing all the elements of this range except the first `n` elements. + * + * $doesNotUseBuilders + * + * @param n the number of elements to drop. + * @return a new range consisting of all the elements of this range except `n` first elements. + */ final override def drop(n: Int): Range = copy(locationAfterN(n), end, step) + /** Creates a new range containing all the elements of this range except the last one. + * + * $doesNotUseBuilders + * + * @return a new range consisting of all the elements of this range except the last one. + */ final override def init: Range = take(length - 1) + /** Creates a new range contained in the specified slice of this range. + * + * $doesNotUseBuilders + * + * @param from the start of the slice. + * @param until the end of the slice. + * @return a new range consisting of all the elements of this range contained in the specified slice. + */ final override def slice(from: Int, until: Int): Range = drop(from).take(until - from) @@ -117,12 +158,29 @@ class Range(val start: Int, val end: Int, val step: Int) extends IndexedSeq[Int] (Range(start, split, step), copy(split, end, step)) } + /** Creates a pair of new ranges, first consisting of elements before `n`, and the second + * of elements after `n`. + * + * $doesNotUseBuilders + */ final override def splitAt(n: Int) = (take(n), drop(n)) + /** Creates a new range consisting of the `length - n` last elements of the range. + * + * $doesNotUseBuilders + */ final override def takeRight(n: Int): Range = drop(length - n) + /** Creates a new range consisting of the initial `length - n` elements of the range. + * + * $doesNotUseBuilders + */ final override def dropRight(n: Int): Range = take(length - n) + /** Returns the reverse of this range. + * + * $doesNotUseBuilders + */ final override def reverse: Range = if (length > 0) new Range.Inclusive(last, start, -step) else this /** Make range inclusive. @@ -156,6 +214,8 @@ class Range(val start: Int, val end: Int, val step: Int) extends IndexedSeq[Int] } } +/** A companion object for the `Range` class. + */ object Range { private[immutable] val MAX_PRINT = 512 // some arbitrary value diff --git a/src/library/scala/collection/immutable/RedBlack.scala b/src/library/scala/collection/immutable/RedBlack.scala index ffa6194838..98a7d67d48 100644 --- a/src/library/scala/collection/immutable/RedBlack.scala +++ b/src/library/scala/collection/immutable/RedBlack.scala @@ -12,9 +12,9 @@ package scala.collection package immutable -/** A base class containing the implementations for TreeMaps and TreeSets +/** A base class containing the implementations for `TreeMaps` and `TreeSets`. * - * @since 2.3 + * @since 2.3 */ @serializable @SerialVersionUID(8691885935445612921L) abstract class RedBlack[A] { diff --git a/src/library/scala/collection/immutable/Seq.scala b/src/library/scala/collection/immutable/Seq.scala index de7804a95c..7e41ff7b94 100644 --- a/src/library/scala/collection/immutable/Seq.scala +++ b/src/library/scala/collection/immutable/Seq.scala @@ -19,6 +19,8 @@ import mutable.Builder * that are guaranteed immutable. * * $seqInfo + * @define Coll immutable.Seq + * @define coll immutable sequence */ trait Seq[+A] extends Iterable[A] with scala.collection.Seq[A] @@ -27,10 +29,12 @@ trait Seq[+A] extends Iterable[A] override def companion: GenericCompanion[Seq] = Seq } -/** - * @since 2.8 +/** $factoryInfo + * @define Coll immutable.Seq + * @define coll immutable sequence */ object Seq extends SeqFactory[Seq] { + /** genericCanBuildFromInfo */ implicit def canBuildFrom[A]: CanBuildFrom[Coll, A, Seq[A]] = new GenericCanBuildFrom[A] def newBuilder[A]: Builder[A, Seq[A]] = new mutable.ListBuffer } diff --git a/src/library/scala/collection/immutable/Set.scala b/src/library/scala/collection/immutable/Set.scala index 77f16c0d14..769ee37f6b 100644 --- a/src/library/scala/collection/immutable/Set.scala +++ b/src/library/scala/collection/immutable/Set.scala @@ -14,23 +14,16 @@ package immutable import generic._ -/** <p> - * A generic trait for immutable sets. Concrete set implementations have - * to provide functionality for the abstract methods in <code>Set</code>: - * </p> - * <pre> - * <b>def</b> contains(elem: A): Boolean - * <b>def</b> iterator: Iterator[A] - * <b>def</b> + (elem: A): Self - * <b>def</b> - (elem: A): Self</pre> - * <p> - * where <code>Self</code> is the type of the set. - * </p> +/** A generic trait for immutable sets. + * + * $setnote * * @author Matthias Zenger * @author Martin Odersky * @version 2.8 * @since 1 + * @define Coll immutable.Set + * @define coll immutable set */ trait Set[A] extends Iterable[A] with scala.collection.Set[A] @@ -39,10 +32,12 @@ trait Set[A] extends Iterable[A] override def companion: GenericCompanion[Set] = Set } -/** - * A companion object for immutable sets. +/** $factoryInfo + * @define Coll immutable.Set + * @define coll immutable set */ object Set extends SetFactory[Set] { + /** $setCanBuildFromInfo */ implicit def canBuildFrom[A]: CanBuildFrom[Coll, A, Set[A]] = setCanBuildFrom[A] override def empty[A]: Set[A] = EmptySet.asInstanceOf[Set[A]] diff --git a/src/library/scala/collection/immutable/SetProxy.scala b/src/library/scala/collection/immutable/SetProxy.scala index 73c95652b3..d45b2059ff 100644 --- a/src/library/scala/collection/immutable/SetProxy.scala +++ b/src/library/scala/collection/immutable/SetProxy.scala @@ -12,14 +12,13 @@ package scala.collection package immutable -/** <p> - * This is a simple wrapper class for <a href="Set.html" - * target="contentFrame"><code>scala.collection.immutable.Set</code></a>. - * </p> - * <p> - * It is most useful for assembling customized set abstractions - * dynamically using object composition and forwarding. - * </p> +/** This is a simple wrapper class for <a href="Set.html" + * target="contentFrame">`scala.collection.immutable.Set`</a>. + * + * It is most useful for assembling customized set abstractions + * dynamically using object composition and forwarding. + * + * @tparam A type of the elements contained in this set proxy. * * @since 2.8 */ diff --git a/src/library/scala/collection/immutable/SortedMap.scala b/src/library/scala/collection/immutable/SortedMap.scala index 919b529a49..243636e107 100644 --- a/src/library/scala/collection/immutable/SortedMap.scala +++ b/src/library/scala/collection/immutable/SortedMap.scala @@ -18,10 +18,15 @@ import annotation.unchecked.uncheckedVariance /** A map whose keys are sorted. * + * @tparam A the type of the keys contained in this sorted map. + * @tparam B the type of the values associated with the keys. + * * @author Sean McDirmid * @author Martin Odersky * @version 2.8 * @since 2.4 + * @define Coll immutable.SortedMap + * @define coll immutable sorted map */ trait SortedMap[A, +B] extends Map[A, B] with scala.collection.SortedMap[A, B] @@ -62,10 +67,12 @@ trait SortedMap[A, +B] extends Map[A, B] ((repr: SortedMap[A, B1]) /: xs) (_ + _) } -/** - * @since 2.4 +/** $factoryInfo + * @define Coll immutable.SortedMap + * @define coll immutable sorted map */ object SortedMap extends ImmutableSortedMapFactory[SortedMap] { + /** $sortedMapCanBuildFromInfo */ implicit def canBuildFrom[A, B](implicit ord: Ordering[A]): CanBuildFrom[Coll, (A, B), SortedMap[A, B]] = new SortedMapCanBuildFrom[A, B] def empty[A, B](implicit ord: Ordering[A]): SortedMap[A, B] = TreeMap.empty[A, B] } diff --git a/src/library/scala/collection/immutable/SortedSet.scala b/src/library/scala/collection/immutable/SortedSet.scala index 10ff466ff8..6c9433c30c 100644 --- a/src/library/scala/collection/immutable/SortedSet.scala +++ b/src/library/scala/collection/immutable/SortedSet.scala @@ -22,18 +22,20 @@ import mutable.Builder * @author Martin Odersky * @version 2.8 * @since 2.4 + * @define Coll immutable.SortedSet + * @define coll immutable sorted set */ trait SortedSet[A] extends Set[A] with scala.collection.SortedSet[A] with SortedSetLike[A, SortedSet[A]] { /** Needs to be overridden in subclasses. */ override def empty: SortedSet[A] = SortedSet.empty[A] } -/** - * A companion object for immutable sorted sets. - * - * @since 2.4 +/** $factoryInfo + * @define Coll immutable.SortedSet + * @define coll immutable sorted set */ object SortedSet extends ImmutableSortedSetFactory[SortedSet] { + /** $sortedSetCanBuildFromInfo */ implicit def canBuildFrom[A](implicit ord: Ordering[A]): CanBuildFrom[Coll, A, SortedSet[A]] = new SortedSetCanBuildFrom[A] def empty[A](implicit ord: Ordering[A]): SortedSet[A] = TreeSet.empty[A] } diff --git a/src/library/scala/collection/immutable/Stack.scala b/src/library/scala/collection/immutable/Stack.scala index 7d3c8c040b..0323db7211 100644 --- a/src/library/scala/collection/immutable/Stack.scala +++ b/src/library/scala/collection/immutable/Stack.scala @@ -15,7 +15,12 @@ package immutable import generic._ import mutable.{ ArrayBuffer, Builder } +/** $factoryInfo + * @define Coll immutable.Stack + * @define coll immutable stack + */ object Stack extends SeqFactory[Stack] { + /** $genericCanBuildFromInfo */ implicit def canBuildFrom[A]: CanBuildFrom[Coll, A, Stack[A]] = new GenericCanBuildFrom[A] def newBuilder[A]: Builder[A, Stack[A]] = new ArrayBuffer[A] mapResult (buf => new Stack(buf.toList)) @@ -26,13 +31,21 @@ object Stack extends SeqFactory[Stack] { /** This class implements immutable stacks using a list-based data * structure. * - * @note This class exists only for historical reason and as an - * analogue of mutable stacks + * '''Note:''' This class exists only for historical reason and as an + * analogue of mutable stacks. * Instead of an immutable stack you can just use a list. * + * @tparam A the type of the elements contained in this stack. + * * @author Matthias Zenger * @version 1.0, 10/07/2003 * @since 1 + * @define Coll immutable.Stack + * @define coll immutable stack + * @define orderDependent + * @define orderDependentFold + * @define mayNotTerminateInf + * @define willNotTerminateInf */ @serializable @SerialVersionUID(1976480595012942526L) class Stack[+A] protected (protected val elems: List[A]) extends LinearSeq[A] diff --git a/src/library/scala/collection/immutable/Stream.scala b/src/library/scala/collection/immutable/Stream.scala index 7f0b21050a..50fa07c2cf 100644 --- a/src/library/scala/collection/immutable/Stream.scala +++ b/src/library/scala/collection/immutable/Stream.scala @@ -16,27 +16,33 @@ import generic._ import mutable.{Builder, StringBuilder, LazyBuilder, ListBuffer} import scala.annotation.tailrec -/** - * <p>The class <code>Stream</code> implements lazy lists where elements - * are only evaluated when they are needed. Here is an example:</p> - * <pre> - * <b>object</b> Main <b>extends</b> Application { +/** The class `Stream` implements lazy lists where elements + * are only evaluated when they are needed. Here is an example: * - * <b>def</b> from(n: Int): Stream[Int] = - * Stream.cons(n, from(n + 1)) + * {{{ + * object Main extends Application { * - * <b>def</b> sieve(s: Stream[Int]): Stream[Int] = - * Stream.cons(s.head, sieve(s.tail filter { _ % s.head != 0 })) + * def from(n: Int): Stream[Int] = + * Stream.cons(n, from(n + 1)) * - * <b>def</b> primes = sieve(from(2)) + * def sieve(s: Stream[Int]): Stream[Int] = + * Stream.cons(s.head, sieve(s.tail filter { _ % s.head != 0 })) * - * primes take 10 print - * } - * </pre> + * def primes = sieve(from(2)) * - * @author Martin Odersky, Matthias Zenger - * @version 1.1 08/08/03 - * @since 2.8 + * primes take 10 print + * } + * }}} + * + * @tparam A the type of the elements contained in this stream. + * + * @author Martin Odersky, Matthias Zenger + * @version 1.1 08/08/03 + * @since 2.8 + * @define Coll Stream + * @define coll stream + * @define orderDependent + * @define orderDependentFold */ abstract class Stream[+A] extends LinearSeq[A] with GenericTraversableTemplate[A, Stream] @@ -68,6 +74,7 @@ self => /** The stream resulting from the concatenation of this stream with the argument stream. * @param rest The stream that gets appended to this stream + * @return The stream containing elements of this stream and the traversable object. */ def append[B >: A](rest: => Traversable[B]): Stream[B] = if (isEmpty) rest.toStream else new Stream.Cons(head, tail append rest) @@ -82,7 +89,7 @@ self => /** Prints elements of this stream one by one, separated by commas. */ def print() { print(", ") } - /** Prints elements of this stream one by one, separated by <code>sep</code>. + /** Prints elements of this stream one by one, separated by `sep`. * @param sep The separator string printed between consecutive elements. */ def print(sep: String) { @@ -138,7 +145,7 @@ self => ) /** Returns the stream resulting from applying the given function - * <code>f</code> to each element of this stream. + * `f` to each element of this stream. * * @param f function to apply to each element. * @return <code>f(a<sub>0</sub>), ..., f(a<sub>n</sub>)</code> if this @@ -150,10 +157,11 @@ self => else new Stream.Cons(f(head), asStream[B](tail map f)) ) - /** Applies the given function <code>f</code> to each element of + /** Applies the given function `f` to each element of * this stream, then concatenates the results. * - * @param f the function to apply on each element. + * @param f the function to apply on each element. + * @param bf $bfinfo * @return <code>f(a<sub>0</sub>) ::: ... ::: f(a<sub>n</sub>)</code> if * this stream is <code>[a<sub>0</sub>, ..., a<sub>n</sub>]</code>. */ diff --git a/src/library/scala/collection/immutable/StringLike.scala b/src/library/scala/collection/immutable/StringLike.scala index 8068267dd2..f12ddebd08 100644 --- a/src/library/scala/collection/immutable/StringLike.scala +++ b/src/library/scala/collection/immutable/StringLike.scala @@ -17,8 +17,8 @@ import mutable.Builder import scala.util.matching.Regex import scala.math.ScalaNumber -/** - * @since 2.8 +/** A companion object for the `StringLike` containing some constants. + * @since 2.8 */ object StringLike { @@ -31,8 +31,17 @@ object StringLike { import StringLike._ -/** - * @since 2.8 +/** A trait describing stringlike collections. + * + * @tparam Repr The type of the actual collection inheriting `StringLike`. + * + * @since 2.8 + * @define Coll String + * @define coll string + * @define orderDependent + * @define orderDependentFold + * @define mayNotTerminateInf + * @define willNotTerminateInf */ trait StringLike[+Repr] extends IndexedSeqOptimized[Char, Repr] with Ordered[String] { self => @@ -62,15 +71,15 @@ self => private def isLineBreak(c: Char) = c == LF || c == FF /** - * Strip trailing line end character from this string if it has one. + * Strip trailing line end character from this string if it has one. * - * A line end character is one of - * <ul style="list-style-type: none;"> - * <li>LF - line feed (0x0A hex)</li> - * <li>FF - form feed (0x0C hex)</li> - * </ul> - * If a line feed character LF is preceded by a carriage return CR - * (0x0D hex), the CR character is also stripped (Windows convention). + * A line end character is one of + * <ul style="list-style-type: none;"> + * <li>LF - line feed (0x0A hex)</li> + * <li>FF - form feed (0x0C hex)</li> + * </ul> + * If a line feed character LF is preceded by a carriage return CR + * (0x0D hex), the CR character is also stripped (Windows convention). */ def stripLineEnd: String = { val len = toString.length @@ -112,15 +121,15 @@ self => } /** Return all lines in this string in an iterator, excluding trailing line - * end characters, i.e. apply <code>.stripLineEnd</code> to all lines - * returned by <code>linesWithSeparators</code>. + * end characters, i.e. apply `.stripLineEnd` to all lines + * returned by `linesWithSeparators`. */ def lines: Iterator[String] = linesWithSeparators map (line => new WrappedString(line).stripLineEnd) /** Return all lines in this string in an iterator, excluding trailing line - * end characters, i.e. apply <code>.stripLineEnd</code> to all lines - * returned by <code>linesWithSeparators</code>. + * end characters, i.e. apply `.stripLineEnd` to all lines + * returned by `linesWithSeparators`. */ def linesIterator: Iterator[String] = linesWithSeparators map (line => new WrappedString(line).stripLineEnd) @@ -135,12 +144,12 @@ self => new String(chars) } - /** Returns this string with the given <code>prefix</code> stripped. */ + /** Returns this string with the given `prefix` stripped. */ def stripPrefix(prefix: String) = if (toString.startsWith(prefix)) toString.substring(prefix.length) else toString - /** Returns this string with the given <code>suffix</code> stripped. */ + /** Returns this string with the given `suffix` stripped. */ def stripSuffix(suffix: String) = if (toString.endsWith(suffix)) toString.substring(0, toString.length() - suffix.length) else toString @@ -150,7 +159,7 @@ self => * * <blockquote> * Strip a leading prefix consisting of blanks or control characters - * followed by <code>marginChar</code> from the line. + * followed by `marginChar` from the line. * </blockquote> */ def stripMargin(marginChar: Char): String = { @@ -170,7 +179,7 @@ self => * * <blockquote> * Strip a leading prefix consisting of blanks or control characters - * followed by <code>|</code> from the line. + * followed by `|` from the line. * </blockquote> */ def stripMargin: String = stripMargin('|') @@ -230,7 +239,7 @@ self => * * The interpretation of the formatting patterns is described in * <a href="" target="contentFrame" class="java/util/Formatter"> - * <code>java.util.Formatter</code></a>, with the addition that + * `java.util.Formatter`</a>, with the addition that * classes deriving from `ScalaNumber` (such as `scala.BigInt` and * `scala.BigDecimal`) are unwrapped to pass a type which `Formatter` * understands. @@ -249,7 +258,7 @@ self => * * The interpretation of the formatting patterns is described in * <a href="" target="contentFrame" class="java/util/Formatter"> - * <code>java.util.Formatter</code></a>, with the addition that + * `java.util.Formatter`</a>, with the addition that * classes deriving from `ScalaNumber` (such as `scala.BigInt` and * `scala.BigDecimal`) are unwrapped to pass a type which `Formatter` * understands. diff --git a/src/library/scala/collection/immutable/StringOps.scala b/src/library/scala/collection/immutable/StringOps.scala index 4949eb7056..2bdbf672cd 100644 --- a/src/library/scala/collection/immutable/StringOps.scala +++ b/src/library/scala/collection/immutable/StringOps.scala @@ -15,15 +15,19 @@ package immutable import mutable.StringBuilder /** - * This class serves as a wrapper providing `String`s with all the operations - * found in indexed sequences. Where needed, instances of `String` object - * are implicitly converted into this class. + * This class serves as a wrapper providing `String`s with all the operations + * found in indexed sequences. Where needed, instances of `String` object + * are implicitly converted into this class. * - * The difference between this class and `WrappedString` is that calling transformer - * methods such as `filter` and `map` will yield a `String` object, whereas a - * `WrappedString` will remain a `WrappedString`. + * The difference between this class and `WrappedString` is that calling transformer + * methods such as `filter` and `map` will yield a `String` object, whereas a + * `WrappedString` will remain a `WrappedString`. * - * @since 2.8 + * @param repr the actual representation of this string operations object. + * + * @since 2.8 + * @define Coll StringOps + * @define coll string */ final class StringOps(override val repr: String) extends StringLike[String] { diff --git a/src/library/scala/collection/immutable/Traversable.scala b/src/library/scala/collection/immutable/Traversable.scala index af7f6979c9..8fdb5c7568 100644 --- a/src/library/scala/collection/immutable/Traversable.scala +++ b/src/library/scala/collection/immutable/Traversable.scala @@ -26,11 +26,10 @@ trait Traversable[+A] extends scala.collection.Traversable[A] override def companion: GenericCompanion[Traversable] = Traversable } -/** A factory object for the trait <code>Traversable</code>. - * - * @author Martin Odersky - * @version 2.8 - * @since 2.8 +/** $factoryInfo + * The current default implementation of a $Coll is a `Vector`. + * @define coll immutable traversable collection + * @define Coll immutable.Traversable */ object Traversable extends TraversableFactory[Traversable] { implicit def canBuildFrom[A]: CanBuildFrom[Coll, A, Traversable[A]] = new GenericCanBuildFrom[A] diff --git a/src/library/scala/collection/immutable/TreeMap.scala b/src/library/scala/collection/immutable/TreeMap.scala index bd04b8d2e2..61cfe2e13b 100644 --- a/src/library/scala/collection/immutable/TreeMap.scala +++ b/src/library/scala/collection/immutable/TreeMap.scala @@ -15,22 +15,33 @@ package immutable import generic._ import mutable.Builder -/** The canonical factory of <a href="TreeMap.html">TreeMap</a>'s. - * - * @since 1 +/** $factoryInfo + * @define Coll immutable.TreeMap + * @define coll immutable tree map */ object TreeMap extends ImmutableSortedMapFactory[TreeMap] { def empty[A, B](implicit ord: Ordering[A]) = new TreeMap[A, B]()(ord) + /** $sortedMapCanBuildFromInfo */ implicit def canBuildFrom[A, B](implicit ord: Ordering[A]): CanBuildFrom[Coll, (A, B), TreeMap[A, B]] = new SortedMapCanBuildFrom[A, B] private def make[A, B](s: Int, t: RedBlack[A]#Tree[B])(implicit ord: Ordering[A]) = new TreeMap[A, B](s, t)(ord) } /** This class implements immutable maps using a tree. * + * @tparam A the type of the keys contained in this tree map. + * @tparam B the type of the values associated with the keys. + * @param ordering the implicit ordering used to compare objects of type `A`. + * * @author Erik Stenman * @author Matthias Zenger * @version 1.1, 03/05/2004 * @since 1 + * @define Coll immutable.TreeMap + * @define coll immutable tree map + * @define orderDependent + * @define orderDependentFold + * @define mayNotTerminateInf + * @define willNotTerminateInf */ @serializable class TreeMap[A, +B](override val size: Int, t: RedBlack[A]#Tree[B])(implicit val ordering: Ordering[A]) @@ -65,18 +76,20 @@ class TreeMap[A, +B](override val size: Int, t: RedBlack[A]#Tree[B])(implicit va * if key is <em>not</em> in the TreeMap, otherwise * the key is updated with the new entry. * - * @param key ... - * @param value ... - * @return ... + * @tparam B1 type of the value of the new binding which is a supertype of `B` + * @param key the key that should be updated + * @param value the value to be associated with `key` + * @return a new $coll with the updated binding */ override def updated [B1 >: B](key: A, value: B1): TreeMap[A, B1] = { val newsize = if (tree.lookup(key).isEmpty) size + 1 else size TreeMap.make(newsize, tree.update(key, value)) } - /** Add a key/value pair to this map. - * @param kv the key/value pair - * @return A new map with the new binding added to this map + /** Add a key/value pair to this map. + * @tparam B1 type of the value of the new binding, a supertype of `B` + * @param kv the key/value pair + * @return A new $coll with the new binding added to this map */ override def + [B1 >: B] (kv: (A, B1)): TreeMap[A, B1] = updated(kv._1, kv._2) @@ -84,15 +97,22 @@ class TreeMap[A, +B](override val size: Int, t: RedBlack[A]#Tree[B])(implicit va * either the collection itself (if it is mutable), or a new collection * with the added elements. * + * @tparam B1 type of the values of the new bindings, a supertype of `B` * @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 updated bindings */ override def + [B1 >: B] (elem1: (A, B1), elem2: (A, B1), elems: (A, B1) *): TreeMap[A, B1] = this + elem1 + elem2 ++ elems /** A new TreeMap with the entry added is returned, * assuming that key is <em>not</em> in the TreeMap. + * + * @tparam B1 type of the values of the new bindings, a supertype of `B` + * @param key the key to be inserted + * @param value the value to be associated with `key` + * @return a new $coll with the inserted binding, if it wasn't present in the map */ def insert [B1 >: B](key: A, value: B1): TreeMap[A, B1] = { assert(tree.lookup(key).isEmpty) @@ -103,11 +123,11 @@ class TreeMap[A, +B](override val size: Int, t: RedBlack[A]#Tree[B])(implicit va if (tree.lookup(key).isEmpty) this else TreeMap.make(size - 1, tree.delete(key)) - /** Check if this map maps <code>key</code> to a value and return the + /** Check if this map maps `key` to a value and return the * value if it exists. * * @param key the key of the mapping of interest - * @return the value of the mapping, if it exists + * @return the value of the mapping, if it exists */ override def get(key: A): Option[B] = tree.lookup(key) match { case n: NonEmpty[b] => Some(n.value) diff --git a/src/library/scala/collection/immutable/TreeSet.scala b/src/library/scala/collection/immutable/TreeSet.scala index 79e1a6b00b..7b1f71df5b 100644 --- a/src/library/scala/collection/immutable/TreeSet.scala +++ b/src/library/scala/collection/immutable/TreeSet.scala @@ -15,11 +15,11 @@ package immutable import generic._ import mutable.{Builder, AddingBuilder} -/** The canonical factory of <a href="TreeSet.html">TreeSet</a>'s. - * - * @since 1 +/** $factoryInfo + * @define Coll immutable.TreeSet + * @define coll immutable tree set */ -object TreeSet extends SortedSetFactory[TreeSet] { +object TreeSet extends ImmutableSortedSetFactory[TreeSet] { implicit def implicitBuilder[A](implicit ordering: Ordering[A]): Builder[A, TreeSet[A]] = newBuilder[A](ordering) override def newBuilder[A](implicit ordering: Ordering[A]): Builder[A, TreeSet[A]] = new AddingBuilder(empty[A](ordering)) @@ -31,9 +31,18 @@ object TreeSet extends SortedSetFactory[TreeSet] { /** This class implements immutable sets using a tree. * + * @tparam A the type of the elements contained in this tree set + * @param ordering the implicit ordering used to compare objects of type `A` + * * @author Martin Odersky * @version 2.0, 02/01/2007 * @since 1 + * @define Coll immutable.TreeSet + * @define coll immutable tree set + * @define orderDependent + * @define orderDependentFold + * @define mayNotTerminateInf + * @define willNotTerminateInf */ @serializable @SerialVersionUID(-234066569443569402L) class TreeSet[A](override val size: Int, t: RedBlack[A]#Tree[Unit]) @@ -54,29 +63,40 @@ class TreeSet[A](override val size: Int, t: RedBlack[A]#Tree[Unit]) */ override def empty = TreeSet.empty - /** A new TreeSet with the entry added is returned, + /** Creates a new `TreeSet` with the entry added. + * + * @param elem a new element to add. + * @return a new $coll containing `elem` and all the elements of this $coll. */ def + (elem: A): TreeSet[A] = { val newsize = if (tree.lookup(elem).isEmpty) size + 1 else size newSet(newsize, tree.update(elem, ())) } - /** A new TreeSet with the entry added is returned, + /** A new `TreeSet` with the entry added is returned, * assuming that elem is <em>not</em> in the TreeSet. + * + * @param elem a new element to add. + * @return a new $coll containing `elem` and all the elements of this $coll. */ def insert(elem: A): TreeSet[A] = { assert(tree.lookup(elem).isEmpty) newSet(size + 1, tree.update(elem, ())) } + /** Creates a new `TreeSet` with the entry removed. + * + * @param elem a new element to add. + * @return a new $coll containing all the elements of this $coll except `elem`. + */ def - (elem:A): TreeSet[A] = if (tree.lookup(elem).isEmpty) this else newSet(size - 1, tree delete elem) - /** Checks if this set contains element <code>elem</code>. + /** Checks if this set contains element `elem`. * * @param elem the element to check for membership. - * @return true, iff <code>elem</code> is contained in this set. + * @return true, iff `elem` is contained in this set. */ def contains(elem: A): Boolean = !tree.lookup(elem).isEmpty diff --git a/src/library/scala/collection/immutable/WrappedString.scala b/src/library/scala/collection/immutable/WrappedString.scala index cefbd96b5c..011774e10d 100644 --- a/src/library/scala/collection/immutable/WrappedString.scala +++ b/src/library/scala/collection/immutable/WrappedString.scala @@ -17,14 +17,18 @@ import mutable.{Builder, StringBuilder} import scala.util.matching.Regex /** - * This class serves as a wrapper augmenting `String`s with all the operations - * found in indexed sequences. + * This class serves as a wrapper augmenting `String`s with all the operations + * found in indexed sequences. * - * The difference between this class and `StringOps` is that calling transformer - * methods such as `filter` and `map` will yield an object of type `WrappedString` - * rather than a `String`. + * The difference between this class and `StringOps` is that calling transformer + * methods such as `filter` and `map` will yield an object of type `WrappedString` + * rather than a `String`. * - * @since 2.8 + * @param self a string contained within this wrapped string + * + * @since 2.8 + * @define Coll WrappedString + * @define coll wrapped string */ class WrappedString(override val self: String) extends IndexedSeq[Char] with StringLike[WrappedString] with Proxy { @@ -38,8 +42,9 @@ class WrappedString(override val self: String) extends IndexedSeq[Char] with Str new WrappedString(self.substring(from max 0, until min self.length)) } -/** - * @since 2.8 +/** A companion object for wrapped strings. + * + * @since 2.8 */ object WrappedString { def newBuilder: Builder[Char, WrappedString] = new StringBuilder() mapResult (new WrappedString(_)) diff --git a/src/library/scala/collection/mutable/ArrayBuffer.scala b/src/library/scala/collection/mutable/ArrayBuffer.scala index bee531221f..ae656d4e09 100644 --- a/src/library/scala/collection/mutable/ArrayBuffer.scala +++ b/src/library/scala/collection/mutable/ArrayBuffer.scala @@ -177,8 +177,8 @@ class ArrayBuffer[A](override protected val initialSize: Int) /** Factory object for the `ArrayBuffer` class. * * $factoryInfo - * @define coll list - * @define Coll List + * @define coll array buffer + * @define Coll ArrayBuffer */ object ArrayBuffer extends SeqFactory[ArrayBuffer] { /** $genericCanBuildFromInfo */ diff --git a/src/library/scala/collection/mutable/ArrayLike.scala b/src/library/scala/collection/mutable/ArrayLike.scala index b3bd0fbe25..15cafa6ee7 100644 --- a/src/library/scala/collection/mutable/ArrayLike.scala +++ b/src/library/scala/collection/mutable/ArrayLike.scala @@ -13,15 +13,15 @@ package scala.collection package mutable import generic._ -/** A subtrait of `collection.IndexedSeq` which represents sequences - * that can be mutated. - * - * @since 2.8 +/** A common supertrait of `ArrayOps` and `WrappedArray` that factors out most + * operations on arrays and wrapped arrays. * * @tparam A type of the elements contained in the array like object. * @tparam Repr the type of the actual collection containing the elements. * * @define Coll ArrayLike + * @version 2.8 + * @since 2.8 */ trait ArrayLike[A, +Repr] extends IndexedSeqOptimized[A, Repr] { self => diff --git a/src/library/scala/collection/mutable/IndexedSeq.scala b/src/library/scala/collection/mutable/IndexedSeq.scala index 14ee5afc9b..06a6230c6b 100644 --- a/src/library/scala/collection/mutable/IndexedSeq.scala +++ b/src/library/scala/collection/mutable/IndexedSeq.scala @@ -27,8 +27,9 @@ trait IndexedSeq[A] extends Seq[A] } /** $factoryInfo - * @define coll indexed sequence - * @define Coll IndexedSeq + * The current default implementation of a $Coll is an `ArrayBuffer`. + * @define coll mutable indexed sequence + * @define Coll mutable.IndexedSeq */ object IndexedSeq extends SeqFactory[IndexedSeq] { implicit def canBuildFrom[A]: CanBuildFrom[Coll, A, IndexedSeq[A]] = new GenericCanBuildFrom[A] diff --git a/src/library/scala/collection/mutable/IndexedSeqView.scala b/src/library/scala/collection/mutable/IndexedSeqView.scala index 9a0e7a4010..8d72ac2c49 100644 --- a/src/library/scala/collection/mutable/IndexedSeqView.scala +++ b/src/library/scala/collection/mutable/IndexedSeqView.scala @@ -16,14 +16,16 @@ import generic._ import TraversableView.NoBuilder -/** A non-strict view of a mutable IndexedSeq. - * This is a leaf class which mixes methods returning a plain IndexedSeq view - * and methods returning a mutable IndexedSeq view. - * There is no associated `Like' class. - * @author Sean McDirmid - * @author Martin Odersky - * @version 2.8 - * @since 2.8 +/** A non-strict view of a mutable `IndexedSeq`. + * $viewinfo + * Some of the operations of this class will yield again a mutable indexed sequence, + * others will just yield a plain indexed sequence of type `collection.IndexedSeq`. + * Because this is a leaf class there is no associated `Like' class. + * @author Martin Odersky + * @version 2.8 + * @since 2.8 + * @tparam A the element type of the view + * @tparam Coll the type of the underlying collection containing the elements. */ trait IndexedSeqView[A, +Coll] extends IndexedSeq[A] with IndexedSeqOptimized[A, IndexedSeqView[A, Coll]] @@ -91,13 +93,13 @@ self => override def reverse: IndexedSeqView[A, Coll] = newReversed.asInstanceOf[IndexedSeqView[A, Coll]] } -/** $factoryInfo - * @define coll indexed sequence view - * @define Coll IndexedSeqView - * Note that the canBuildFrom factories yield SeqViews, not IndexedSewqViews. - * This is intentional, because not all operations yield again a mutable.IndexedSeqView. - * For instance, map just gives a SeqView, which reflects the fact that - * map cannot do its work and maintain a pointer into the original indexed sequence. +/** An object containing the necessary implicit definitions to make + * `SeqView`s work. Its definitions are generally not accessed directly by clients. + * + * Note that the `canBuildFrom` factories yield `SeqView`s, not `IndexedSewqView`s. + * This is intentional, because not all operations yield again a `mutable.IndexedSeqView`. + * For instance, `map` just gives a `SeqView`, which reflects the fact that + * `map` cannot do its work and maintain a pointer into the original indexed sequence. */ object IndexedSeqView { type Coll = TraversableView[_, C] forSome {type C <: Traversable[_]} diff --git a/src/library/scala/collection/mutable/Iterable.scala b/src/library/scala/collection/mutable/Iterable.scala index 85c6df6fb0..71143f74e3 100644 --- a/src/library/scala/collection/mutable/Iterable.scala +++ b/src/library/scala/collection/mutable/Iterable.scala @@ -21,8 +21,9 @@ trait Iterable[A] extends Traversable[A] } /** $factoryInfo - * @define coll indexed sequence - * @define Coll IndexedSeq + * The current default implementation of a $Coll is an `ArrayBuffer`. + * @define coll mutable iterable collection + * @define Coll mutable.Iterable */ object Iterable extends TraversableFactory[Iterable] { implicit def canBuildFrom[A]: CanBuildFrom[Coll, A, Iterable[A]] = new GenericCanBuildFrom[A] diff --git a/src/library/scala/collection/mutable/LinearSeq.scala b/src/library/scala/collection/mutable/LinearSeq.scala index 185b8c97a3..7567504890 100644 --- a/src/library/scala/collection/mutable/LinearSeq.scala +++ b/src/library/scala/collection/mutable/LinearSeq.scala @@ -29,8 +29,9 @@ trait LinearSeq[A] extends Seq[A] } /** $factoryInfo - * @define coll linear sequence - * @define Coll LinearSeq + * The current default implementation of a $Coll is a `MutableList`. + * @define coll mutable linear sequence + * @define Coll mutable.LinearSeq */ object LinearSeq extends SeqFactory[LinearSeq] { implicit def canBuildFrom[A]: CanBuildFrom[Coll, A, LinearSeq[A]] = new GenericCanBuildFrom[A] diff --git a/src/library/scala/collection/mutable/ListBuffer.scala b/src/library/scala/collection/mutable/ListBuffer.scala index a2611a8c0f..7ebbf7b4da 100644 --- a/src/library/scala/collection/mutable/ListBuffer.scala +++ b/src/library/scala/collection/mutable/ListBuffer.scala @@ -246,7 +246,7 @@ final class ListBuffer[A] // Overrides of methods in Buffer /** Removes the element on a given index position. May take time linear in - * the buffer size + * the buffer size. * * @param n the index which refers to the element to delete. * @return n the element that was formerly at position `n`. diff --git a/src/library/scala/collection/mutable/ListMap.scala b/src/library/scala/collection/mutable/ListMap.scala index a4321d3818..09b0c6459b 100644 --- a/src/library/scala/collection/mutable/ListMap.scala +++ b/src/library/scala/collection/mutable/ListMap.scala @@ -59,8 +59,8 @@ class ListMap[A, B] extends Map[A, B] with MapLike[A, B, ListMap[A, B]] { } /** $factoryInfo - * @define Coll ListMap - * @define coll list map + * @define Coll mutable.ListMap + * @define coll mutable list map */ object ListMap extends MutableMapFactory[ListMap] { implicit def canBuildFrom[A, B]: CanBuildFrom[Coll, (A, B), ListMap[A, B]] = new MapCanBuildFrom[A, B] diff --git a/src/library/scala/collection/mutable/Map.scala b/src/library/scala/collection/mutable/Map.scala index 73688e3bee..6c42bad0e9 100644 --- a/src/library/scala/collection/mutable/Map.scala +++ b/src/library/scala/collection/mutable/Map.scala @@ -14,11 +14,11 @@ package mutable import generic._ -/** This trait represents mutable maps. - * All implementations od mutable maps inherit from it. - * - * @tparam A the type of the keys of the map. - * @tparam B the type of associated values. +/** A base trait for maps that can be mutated. + * $mapNote + * $mapTags + * @since 1.0 + * @author Matthias Zenger */ trait Map[A, B] extends Iterable[(A, B)] @@ -40,11 +40,15 @@ trait Map[A, B] */ } -/* The standard factory for mutable maps. - * Currently this uses `HashMap` as the implementation class. +/** $factoryInfo + * The current default implementation of a $Coll is a `HashMap`. + * @define coll mutable map + * @define Coll mutable.Map */ object Map extends MutableMapFactory[Map] { + /** $canBuildFromInfo */ implicit def canBuildFrom[A, B]: CanBuildFrom[Coll, (A, B), Map[A, B]] = new MapCanBuildFrom[A, B] + def empty[A, B]: Map[A, B] = new HashMap[A, B] } diff --git a/src/library/scala/collection/mutable/MapBuilder.scala b/src/library/scala/collection/mutable/MapBuilder.scala index 9ce3524d9e..75fb48abd6 100644 --- a/src/library/scala/collection/mutable/MapBuilder.scala +++ b/src/library/scala/collection/mutable/MapBuilder.scala @@ -14,6 +14,10 @@ package mutable /** The canonical builder for immutable maps, working with the map's `+` method * to add new elements. * Collections are built from their `empty` element using this + method. + * + * @tparam A Type of the keys for the map this builder creates. + * @tparam B Type of the values for the map this builder creates. + * @tparam Coll The type of the actual collection this builder builds. * @param empty The empty element of the collection. * * @since 2.8 diff --git a/src/library/scala/collection/mutable/MapLike.scala b/src/library/scala/collection/mutable/MapLike.scala index 19e67a6731..676a325c9b 100644 --- a/src/library/scala/collection/mutable/MapLike.scala +++ b/src/library/scala/collection/mutable/MapLike.scala @@ -15,41 +15,10 @@ package mutable import generic._ import annotation.migration -/** A template trait for mutable maps of type `mutable.Map[A, B]` which - * associate keys of type `A` with values of type `B`. - * - * @tparam A the type of the keys. - * @tparam B the type of associated values. - * @tparam This the type of the `Map` itself. - * - * $mapnote - * - * @author Martin Odersky - * @version 2.8 - * @since 2.8 - * @define mapnote - * To implement a concrete mutable map, you need to provide implementations - * of the following methods: - * {{{ - * def get(key: A): Option[B] - * def iterator: Iterator[(A, B)] - * def += (kv: (A, B)): this.type - * def -= (key: A): this.type - * }}} - * If you wish that methods like `take`, - * `drop`, `filter` return the same kind of map, you - * should also override: - * {{{ - * def empty: This - * }}} - * If you wish to avoid the unnecessary construction of an `Option` - * object, you could also override `apply`, `update`, - * and `delete`. - - * It is also good idea to override methods `foreach` and - * `size` for efficiency. - * @define coll mutable map - * @define Coll mutable.Map +/** A template trait for mutable maps. + * $mapNote + * $mapTags + * @since 2.8 */ trait MapLike[A, B, +This <: MapLike[A, B, This] with Map[A, B]] extends scala.collection.MapLike[A, B, This] diff --git a/src/library/scala/collection/mutable/MapProxy.scala b/src/library/scala/collection/mutable/MapProxy.scala index cb768f6778..7fbb016a57 100644 --- a/src/library/scala/collection/mutable/MapProxy.scala +++ b/src/library/scala/collection/mutable/MapProxy.scala @@ -12,20 +12,17 @@ package scala.collection package mutable -/** <p> - * This is a simple wrapper class for <a href="Map.html" - * target="contentFrame"><code>scala.collection.mutable.Map</code></a>. - * </p> - * <p> - * It is most useful for assembling customized map abstractions - * dynamically using object composition and forwarding. - * </p> +/** + * This trait implements a proxy for <a href="Map.html" + * target="contentFrame"><code>scala.collection.mutable.Map</code></a>. + * + * It is most useful for assembling customized map abstractions + * dynamically using object composition and forwarding. * * @author Matthias Zenger, Martin Odersky * @version 2.0, 31/12/2006 * @since 1 */ - trait MapProxy[A, B] extends Map[A, B] with MapProxyLike[A, B, Map[A, B]] { private def newProxy[B1 >: B](newSelf: Map[A, B1]): MapProxy[A, B1] = diff --git a/src/library/scala/collection/mutable/MutableList.scala b/src/library/scala/collection/mutable/MutableList.scala index 4324fa7ef9..4b6d727c34 100644 --- a/src/library/scala/collection/mutable/MutableList.scala +++ b/src/library/scala/collection/mutable/MutableList.scala @@ -16,11 +16,10 @@ import generic._ import immutable.{List, Nil} // !!! todo: convert to LinkedListBuffer? -/** <p> - * This class is used internally to represent mutable lists. It is the - * basis for the implementation of the classes - * <code>Stack</code>, and <code>Queue</code>. - * </p> +/** + * This class is used internally to represent mutable lists. It is the + * basis for the implementation of the classes + * `Stack`, and `Queue`. * * @author Matthias Zenger * @author Martin Odersky diff --git a/src/library/scala/collection/mutable/ObservableBuffer.scala b/src/library/scala/collection/mutable/ObservableBuffer.scala index d3bf49a5b4..8881e78ebc 100644 --- a/src/library/scala/collection/mutable/ObservableBuffer.scala +++ b/src/library/scala/collection/mutable/ObservableBuffer.scala @@ -15,9 +15,9 @@ package mutable import script._ /** This class is typically used as a mixin. It adds a subscription - * mechanism to the <code>Buffer</code> class into which this abstract - * class is mixed in. Class <code>ObservableBuffer</code> publishes - * events of the type <code>Message</code>. + * mechanism to the `Buffer` class into which this abstract + * class is mixed in. Class `ObservableBuffer` publishes + * events of the type `Message`. * * @author Matthias Zenger * @version 1.0, 08/07/2003 diff --git a/src/library/scala/collection/mutable/ObservableMap.scala b/src/library/scala/collection/mutable/ObservableMap.scala index b15b2e54e9..0cde1b2288 100644 --- a/src/library/scala/collection/mutable/ObservableMap.scala +++ b/src/library/scala/collection/mutable/ObservableMap.scala @@ -16,9 +16,9 @@ import script._ /** This class is typically used as a mixin. It adds a subscription - * mechanism to the <code>Map</code> class into which this abstract - * class is mixed in. Class <code>ObservableMap</code> publishes - * events of the type <code>Message</code>. + * mechanism to the `Map` class into which this abstract + * class is mixed in. Class `ObservableMap` publishes + * events of the type `Message`. * * @author Matthias Zenger * @author Martin Odersky diff --git a/src/library/scala/collection/mutable/ObservableSet.scala b/src/library/scala/collection/mutable/ObservableSet.scala index 024c2415ce..1f2f1789f9 100644 --- a/src/library/scala/collection/mutable/ObservableSet.scala +++ b/src/library/scala/collection/mutable/ObservableSet.scala @@ -15,9 +15,9 @@ package mutable import script._ /** This class is typically used as a mixin. It adds a subscription - * mechanism to the <code>Set</code> class into which this abstract - * class is mixed in. Class <code>ObservableSet</code> publishes - * events of the type <code>Message</code>. + * mechanism to the `Set` class into which this abstract + * class is mixed in. Class `ObservableSet` publishes + * events of the type `Message`. * * @author Matthias Zenger * @version 1.0, 08/07/2003 diff --git a/src/library/scala/collection/mutable/OpenHashMap.scala b/src/library/scala/collection/mutable/OpenHashMap.scala index cbcc19c3e8..4ecfe0e762 100644 --- a/src/library/scala/collection/mutable/OpenHashMap.scala +++ b/src/library/scala/collection/mutable/OpenHashMap.scala @@ -12,8 +12,12 @@ package scala.collection package mutable + /** - * @since 2.7 + * @define Coll OpenHashMap + * @define coll open hash map + * + * @since 2.7 */ object OpenHashMap { def apply[K, V](elems : (K, V)*) = { @@ -42,17 +46,26 @@ object OpenHashMap { private[mutable] def nextPowerOfTwo(i : Int) = highestOneBit(i) << 1; } -/** - * A mutable hash map based on an open hashing scheme. The precise scheme is undefined, - * but it should make a reasonable effort to ensure that an insert with consecutive hash - * codes is not unneccessarily penalised. In particular, mappings of consecutive integer - * keys should work without significant performance loss. +/** A mutable hash map based on an open hashing scheme. The precise scheme is undefined, + * but it should make a reasonable effort to ensure that an insert with consecutive hash + * codes is not unneccessarily penalised. In particular, mappings of consecutive integer + * keys should work without significant performance loss. + * + * @tparam Key type of the keys in this map. + * @tparam Value type of the values in this map. + * @param initialSize the initial size of the internal hash table. * - * @author David MacIver - * @since 2.7 + * @author David MacIver + * @since 2.7 + * + * @define Coll OpenHashMap + * @define coll open hash map + * @define mayNotTerminateInf + * @define willNotTerminateInf */ -class OpenHashMap[Key, Value](initialSize : Int) extends Map[Key, Value] - with MapLike[Key, Value, OpenHashMap[Key, Value]] { +class OpenHashMap[Key, Value](initialSize : Int) +extends Map[Key, Value] + with MapLike[Key, Value, OpenHashMap[Key, Value]] { import OpenHashMap.OpenEntry type Entry = OpenEntry[Key, Value] @@ -77,6 +90,7 @@ class OpenHashMap[Key, Value](initialSize : Int) extends Map[Key, Value] override def size = _size; private[this] def size_=(s : Int) = _size = s; + /** Returns a mangled hash code of the provided key. */ protected def hashOf(key : Key) = { var h = key.hashCode; h ^= ((h >>> 20) ^ (h >>> 12)); @@ -173,9 +187,10 @@ class OpenHashMap[Key, Value](initialSize : Int) extends Map[Key, Value] None; } - /** - * An iterator over the elements of this map. Use of this iterator follows the same - * contract for concurrent modification as the foreach method. + /** An iterator over the elements of this map. Use of this iterator follows the same + * contract for concurrent modification as the foreach method. + * + * @return the iterator */ def iterator = new Iterator[(Key, Value)]{ var index = 0; @@ -203,19 +218,20 @@ class OpenHashMap[Key, Value](initialSize : Int) extends Map[Key, Value] } /** - * Loop over the key, value mappings of this map. + * Loop over the key, value mappings of this map. * - * The behaviour of modifying the map during an iteration is as follows: + * The behaviour of modifying the map during an iteration is as follows: * - * <ul> - * <li>Deleting a mapping is always permitted.</li> - * <li>Changing the value of mapping which is already present is permitted.</li> - * <li>Anything else is not permitted. It will usually, but not always, throw an exception.</li> - * </ul> + * <ul> + * <li>Deleting a mapping is always permitted.</li> + * <li>Changing the value of mapping which is already present is permitted.</li> + * <li>Anything else is not permitted. It will usually, but not always, throw an exception.</li> + * </ul> * - * @param f The function to apply to each key, value mapping. + * @tparam U The return type of the specified function `f`, return result of which is ignored. + * @param f The function to apply to each key, value mapping. */ - override def foreach[U](f : ((Key, Value)) => U) { + override def foreach[U](f : ((Key, Value)) => U) { val startModCount = modCount; foreachUndeletedEntry(entry => { if (modCount != startModCount) error("Concurrent Modification") @@ -226,6 +242,7 @@ class OpenHashMap[Key, Value](initialSize : Int) extends Map[Key, Value] private[this] def foreachUndeletedEntry(f : Entry => Unit){ table.foreach(entry => if (entry != null && entry.value != None) f(entry)); } + override def transform(f : (Key, Value) => Value) = { foreachUndeletedEntry(entry => entry.value = Some(f(entry.key, entry.value.get))); this diff --git a/src/library/scala/collection/mutable/PriorityQueue.scala b/src/library/scala/collection/mutable/PriorityQueue.scala index eade376abe..37e1b0ccae 100644 --- a/src/library/scala/collection/mutable/PriorityQueue.scala +++ b/src/library/scala/collection/mutable/PriorityQueue.scala @@ -19,11 +19,20 @@ import annotation.migration * To prioritize elements of type T there must be an implicit * Ordering[T] available at creation. * + * @tparam A type of the elements in this priority queue. + * @param ord implicit ordering used to compare the elements of type `A`. + * * @author Matthias Zenger * @version 1.0, 03/05/2004 * @since 1 + * + * @define Coll PriorityQueue + * @define coll priority queue + * @define orderDependent + * @define orderDependentFold + * @define mayNotTerminateInf + * @define willNotTerminateInf */ - @serializable @cloneable class PriorityQueue[A](implicit ord: Ordering[A]) extends Seq[A] @@ -98,6 +107,7 @@ class PriorityQueue[A](implicit ord: Ordering[A]) k = k / 2 } } + protected def fixDown(as: Array[AnyRef], m: Int, n: Int): Unit = { var k: Int = m while (n >= 2 * k) { @@ -134,7 +144,8 @@ class PriorityQueue[A](implicit ord: Ordering[A]) /** Inserts a single element into the priority queue. * - * @param elem the element to insert + * @param elem the element to insert. + * @return this $coll. */ def +=(elem: A): this.type = { resarr.p_ensureSize(resarr.p_size0 + 1) @@ -147,7 +158,8 @@ class PriorityQueue[A](implicit ord: Ordering[A]) /** Adds all elements provided by a `TraversableOnce` object * into the priority queue. * - * @param xs an iterable object + * @param xs a traversable object. + * @return a new priority queue containing elements of both `xs` and `this`. */ def ++(xs: TraversableOnce[A]) = { this.clone() ++= xs } @@ -203,19 +215,19 @@ class PriorityQueue[A](implicit ord: Ordering[A]) } } - /** - * Returns the reverse of this queue. The priority queue that gets - * returned will have an inversed ordering - if for some elements - * `x` and `y` the original queue's ordering - * had `compare` returning an integer ''w'', the new one will return ''-w'', - * assuming the original ordering abides its contract. + + /** Returns the reverse of this queue. The priority queue that gets + * returned will have an inversed ordering - if for some elements + * `x` and `y` the original queue's ordering + * had `compare` returning an integer ''w'', the new one will return ''-w'', + * assuming the original ordering abides its contract. * - * Note that the order of the elements will be reversed unless the - * `compare` method returns 0. In this case, such elements - * will be subsequent, but their corresponding subinterval may be inappropriately - * reversed. However, due to the compare-equals contract, they will also be equal. + * Note that the order of the elements will be reversed unless the + * `compare` method returns 0. In this case, such elements + * will be subsequent, but their corresponding subinterval may be inappropriately + * reversed. However, due to the compare-equals contract, they will also be equal. * - * @return A reversed priority queue. + * @return A reversed priority queue. */ override def reverse = { val revq = new PriorityQueue[A]()(new math.Ordering[A] { diff --git a/src/library/scala/collection/mutable/PriorityQueueProxy.scala b/src/library/scala/collection/mutable/PriorityQueueProxy.scala index 3f1ee5d217..f99755128f 100644 --- a/src/library/scala/collection/mutable/PriorityQueueProxy.scala +++ b/src/library/scala/collection/mutable/PriorityQueueProxy.scala @@ -13,7 +13,7 @@ package mutable /** This class servers as a proxy for priority queues. The * elements of the queue have to be ordered in terms of the - * <code>Ordered[T]</code> class. + * `Ordered[T]` class. * * @author Matthias Zenger * @version 1.0, 03/05/2004 @@ -22,7 +22,6 @@ package mutable abstract class PriorityQueueProxy[A](implicit ord: Ordering[A]) extends PriorityQueue[A] with Proxy { - def self: PriorityQueue[A] /** Creates a new iterator over all elements contained in this diff --git a/src/library/scala/collection/mutable/Publisher.scala b/src/library/scala/collection/mutable/Publisher.scala index 58e4394ef7..f91864f974 100644 --- a/src/library/scala/collection/mutable/Publisher.scala +++ b/src/library/scala/collection/mutable/Publisher.scala @@ -13,12 +13,14 @@ package scala.collection package mutable -/** <code>Publisher[A,This]</code> objects publish events of type <code>A</code> +/** `Publisher[A,This]` objects publish events of type `A` * to all registered subscribers. When subscribing, a subscriber may specify * a filter which can be used to constrain the number of events sent to the * subscriber. Subscribers may suspend their subscription, or reactivate a - * suspended subscription. Class <code>Publisher</code> is typically used - * as a mixin. The abstract type <code>Pub</code> models the type of the publisher itself. + * suspended subscription. Class `Publisher` is typically used + * as a mixin. The abstract type `Pub` models the type of the publisher itself. + * + * @tparam Evt type of the published event. * * @author Matthias Zenger * @author Martin Odersky diff --git a/src/library/scala/collection/mutable/Queue.scala b/src/library/scala/collection/mutable/Queue.scala index 3754dbc3f2..3132e2f422 100644 --- a/src/library/scala/collection/mutable/Queue.scala +++ b/src/library/scala/collection/mutable/Queue.scala @@ -14,13 +14,20 @@ package mutable import generic._ -/** <code>Queue</code> objects implement data structures that allow to +/** `Queue` objects implement data structures that allow to * insert and retrieve elements in a first-in-first-out (FIFO) manner. * * @author Matthias Zenger * @author Martin Odersky * @version 2.8 * @since 1 + * + * @define Coll mutable.Queue + * @define coll mutable queue + * @define orderDependent + * @define orderDependentFold + * @define mayNotTerminateInf + * @define willNotTerminateInf */ @serializable @cloneable class Queue[A] extends MutableList[A] with Cloneable[Queue[A]] { diff --git a/src/library/scala/collection/mutable/QueueProxy.scala b/src/library/scala/collection/mutable/QueueProxy.scala index b2548b26cc..6adb3d490b 100644 --- a/src/library/scala/collection/mutable/QueueProxy.scala +++ b/src/library/scala/collection/mutable/QueueProxy.scala @@ -12,9 +12,11 @@ package scala.collection package mutable -/** <code>Queue</code> objects implement data structures that allow to +/** `Queue` objects implement data structures that allow to * insert and retrieve elements in a first-in-first-out (FIFO) manner. * + * @tparam A type of the elements in this queue proxy. + * * @author Matthias Zenger * @version 1.1, 03/05/2004 * @since 1 diff --git a/src/library/scala/collection/mutable/ResizableArray.scala b/src/library/scala/collection/mutable/ResizableArray.scala index 80ab1cd559..96d24136cf 100644 --- a/src/library/scala/collection/mutable/ResizableArray.scala +++ b/src/library/scala/collection/mutable/ResizableArray.scala @@ -17,6 +17,8 @@ import generic._ /** This class is used internally to implement data structures that * are based on resizable arrays. * + * @tparam A type of the elements contained in this resizeable array. + * * @author Matthias Zenger, Burak Emir * @author Martin Odersky * @version 2.8 diff --git a/src/library/scala/collection/mutable/RevertibleHistory.scala b/src/library/scala/collection/mutable/RevertibleHistory.scala index 62e1efba2f..b16577486a 100644 --- a/src/library/scala/collection/mutable/RevertibleHistory.scala +++ b/src/library/scala/collection/mutable/RevertibleHistory.scala @@ -13,10 +13,13 @@ package scala.collection package mutable -/** A revertible history is a <code>History</code> object which supports - * an undo operation. Type variable <code>A</code> refers to the type - * of the published events, <code>B</code> denotes the publisher type. - * Type <code>B</code> is typically a subtype of <code>Publisher</code>. +/** A revertible history is a `History` object which supports + * an undo operation. Type variable `Evt` refers to the type + * of the published events, `Pub` denotes the publisher type. + * Type `Pub` is typically a subtype of `Publisher`. + * + * @tparam Evt type of the events + * @tparam Pub type of the publisher * * @author Matthias Zenger * @version 1.0, 08/07/2003 diff --git a/src/library/scala/collection/mutable/Seq.scala b/src/library/scala/collection/mutable/Seq.scala index 8d11e14063..679cc24389 100644 --- a/src/library/scala/collection/mutable/Seq.scala +++ b/src/library/scala/collection/mutable/Seq.scala @@ -14,12 +14,16 @@ package mutable import generic._ -/** A subtrait of <code>collection.Seq</code> which represents sequences + +/** A subtrait of `collection.Seq` which represents sequences * that can be mutated. * * $seqInfo * - * The class adds an <code>update</code> method to <code>collection.Seq</code>. + * The class adds an `update` method to `collection.Seq`. + * + * @define Coll mutable.Seq + * @define coll mutable sequence */ trait Seq[A] extends Iterable[A] with scala.collection.Seq[A] @@ -36,11 +40,10 @@ trait Seq[A] extends Iterable[A] def update(idx: Int, elem: A) } -/** A factory object for the trait <code>Seq</code>. - * - * @author Martin Odersky - * @version 2.8 - * @since 2.8 +/** $factoryInfo + * The current default implementation of a $Coll is an `ArrayBuffer`. + * @define coll mutable sequence + * @define Coll mutable.Seq */ object Seq extends SeqFactory[Seq] { implicit def canBuildFrom[A]: CanBuildFrom[Coll, A, Seq[A]] = new GenericCanBuildFrom[A] diff --git a/src/library/scala/collection/mutable/Set.scala b/src/library/scala/collection/mutable/Set.scala index cca592b5a0..2e7f1cbc6b 100644 --- a/src/library/scala/collection/mutable/Set.scala +++ b/src/library/scala/collection/mutable/Set.scala @@ -14,18 +14,11 @@ package mutable import generic._ -/** A generic trait for mutable sets. Concrete set implementations - * have to provide functionality for the abstract methods in Set: - * - * def contains(elem: A): Boolean - * def iterator: Iterator[A] - * def += (elem: A): this.type - * def -= (elem: A): this.type - * +/** A base trait for sets that can be mutated. + * $setNote + * $setTags + * @since 1.0 * @author Matthias Zenger - * @author Martin Odersky - * @version 2.8 - * @since 1 */ trait Set[A] extends Iterable[A] with scala.collection.Set[A] @@ -34,8 +27,10 @@ trait Set[A] extends Iterable[A] override def companion: GenericCompanion[Set] = Set } -/** The canonical factory methods for <a href="Set.html">mutable sets</a>. - * Currently this returns a HashSet. +/** $factoryInfo + * The current default implementation of a $Coll is a `HashSet`. + * @define coll mutable set + * @define Coll mutable.Set */ object Set extends SetFactory[Set] { implicit def canBuildFrom[A]: CanBuildFrom[Coll, A, Set[A]] = setCanBuildFrom[A] diff --git a/src/library/scala/collection/mutable/SetBuilder.scala b/src/library/scala/collection/mutable/SetBuilder.scala index 450d76463c..b8903372bd 100644 --- a/src/library/scala/collection/mutable/SetBuilder.scala +++ b/src/library/scala/collection/mutable/SetBuilder.scala @@ -15,6 +15,8 @@ import generic._ /** The canonical builder for mutable Sets. * + * @tparam A The type of the elements that will be contained in this set. + * @tparam Coll The type of the actual collection this set builds. * @param empty The empty element of the collection. * @since 2.8 */ diff --git a/src/library/scala/collection/mutable/Stack.scala b/src/library/scala/collection/mutable/Stack.scala index c224c030a4..72e2f928c8 100644 --- a/src/library/scala/collection/mutable/Stack.scala +++ b/src/library/scala/collection/mutable/Stack.scala @@ -20,10 +20,18 @@ import annotation.migration /** A stack implements a data structure which allows to store and retrieve * objects in a last-in-first-out (LIFO) fashion. * + * @tparam A type of the elements contained in this stack. + * * @author Matthias Zenger * @author Martin Odersky * @version 2.8 * @since 1 + * @define Coll Stack + * @define coll stack + * @define orderDependent + * @define orderDependentFold + * @define mayNotTerminateInf + * @define willNotTerminateInf */ @serializable @cloneable class Stack[A] private (var elems: List[A]) extends scala.collection.Seq[A] with Cloneable[Stack[A]] { diff --git a/src/library/scala/collection/mutable/StackProxy.scala b/src/library/scala/collection/mutable/StackProxy.scala index d3810dd158..740afdfd7d 100644 --- a/src/library/scala/collection/mutable/StackProxy.scala +++ b/src/library/scala/collection/mutable/StackProxy.scala @@ -12,9 +12,12 @@ package scala.collection package mutable + /** A stack implements a data structure which allows to store and retrieve * objects in a last-in-first-out (LIFO) fashion. * + * @tparam A type of the elements in this stack proxy. + * * @author Matthias Zenger * @version 1.0, 10/05/2004 * @since 1 diff --git a/src/library/scala/collection/mutable/StringBuilder.scala b/src/library/scala/collection/mutable/StringBuilder.scala index d622d15056..40e7e991ee 100644 --- a/src/library/scala/collection/mutable/StringBuilder.scala +++ b/src/library/scala/collection/mutable/StringBuilder.scala @@ -16,11 +16,8 @@ import generic._ import compat.Platform.arraycopy import scala.reflect.Manifest -/** <p> - * A mutable sequence of characters. This class provides an API compatible - * with <a class="java/lang/StringBuilder" href="" target="_top"> - * <code>java.lang.StringBuilder</code></a>. - * </p>generic/ +/** A builder for mutable sequence of characters. This class provides an API compatible + * with <a class="java/lang/StringBuilder" href="" target="_top">`java.lang.StringBuilder`</a>. * * @author Stephane Micheloud * @author Martin Odersky diff --git a/src/library/scala/collection/mutable/SynchronizedBuffer.scala b/src/library/scala/collection/mutable/SynchronizedBuffer.scala index 0fef1a6635..7bdbd5e520 100644 --- a/src/library/scala/collection/mutable/SynchronizedBuffer.scala +++ b/src/library/scala/collection/mutable/SynchronizedBuffer.scala @@ -14,12 +14,16 @@ package mutable import script._ -/** This class should be used as a mixin. It synchronizes the <code>Buffer</code> +/** This class should be used as a mixin. It synchronizes the `Buffer` * methods of the class into which it is mixed in. * + * @tparam A type of the elements contained in this buffer. + * * @author Matthias Zenger * @version 1.0, 08/07/2003 * @since 1 + * @define Coll SynchronizedBuffer + * @define coll synchronized buffer */ trait SynchronizedBuffer[A] extends Buffer[A] { diff --git a/src/library/scala/collection/mutable/SynchronizedMap.scala b/src/library/scala/collection/mutable/SynchronizedMap.scala index dabcaa7e1c..08c370ce90 100644 --- a/src/library/scala/collection/mutable/SynchronizedMap.scala +++ b/src/library/scala/collection/mutable/SynchronizedMap.scala @@ -14,12 +14,17 @@ package mutable import annotation.migration -/** This class should be used as a mixin. It synchronizes the <code>Map</code> +/** This class should be used as a mixin. It synchronizes the `Map` * functions of the class into which it is mixed in. * + * @tparam A type of the keys contained in this map. + * @tparam B type of the values associated with keys. + * * @author Matthias Zenger, Martin Odersky * @version 2.0, 31/12/2006 * @since 1 + * @define Coll SynchronizedMap + * @define coll synchronized map */ trait SynchronizedMap[A, B] extends Map[A, B] { diff --git a/src/library/scala/collection/mutable/SynchronizedPriorityQueue.scala b/src/library/scala/collection/mutable/SynchronizedPriorityQueue.scala index 933b3b41a4..bc70e35993 100644 --- a/src/library/scala/collection/mutable/SynchronizedPriorityQueue.scala +++ b/src/library/scala/collection/mutable/SynchronizedPriorityQueue.scala @@ -13,12 +13,16 @@ package scala.collection package mutable /** This class implements synchronized priority queues using a binary heap. - * The elements of the queue have to be ordered in terms of the - * <code>Ordered[T]</code> class. + * The elements of the queue have to be ordered in terms of the `Ordered[T]` class. + * + * @tparam A type of the elements contained in this synchronized priority queue + * @param ord implicit ordering used to compared elements of type `A` * * @author Matthias Zenger * @version 1.0, 03/05/2004 * @since 1 + * @define Coll SynchronizedPriorityQueue + * @define coll synchronized priority queue */ class SynchronizedPriorityQueue[A](implicit ord: Ordering[A]) extends PriorityQueue[A] { diff --git a/src/library/scala/collection/mutable/SynchronizedQueue.scala b/src/library/scala/collection/mutable/SynchronizedQueue.scala index b09687a78e..7a0f9f5f6f 100644 --- a/src/library/scala/collection/mutable/SynchronizedQueue.scala +++ b/src/library/scala/collection/mutable/SynchronizedQueue.scala @@ -13,13 +13,17 @@ package scala.collection package mutable -/** This is a synchronized version of the <code>Queue[T]</code> class. It +/** This is a synchronized version of the `Queue[T]` class. It * implements a data structure that allows one to insert and retrieve * elements in a first-in-first-out (FIFO) manner. * + * @tparam A type of elements contained in this synchronized queue. + * * @author Matthias Zenger * @version 1.0, 03/05/2004 * @since 1 + * @define Coll SynchronizedQueue + * @define coll synchronized queue */ class SynchronizedQueue[A] extends Queue[A] { import scala.collection.Traversable diff --git a/src/library/scala/collection/mutable/SynchronizedSet.scala b/src/library/scala/collection/mutable/SynchronizedSet.scala index d3023b9136..904da541c2 100644 --- a/src/library/scala/collection/mutable/SynchronizedSet.scala +++ b/src/library/scala/collection/mutable/SynchronizedSet.scala @@ -13,12 +13,16 @@ package mutable import script._ -/** This class should be used as a mixin. It synchronizes the <code>Set</code> +/** This class should be used as a mixin. It synchronizes the `Set` * functions of the class into which it is mixed in. * + * @tparam A type of the elements contained in this synchronized set. + * * @author Matthias Zenger * @version 1.0, 08/07/2003 * @since 1 + * @define Coll SynchronizedSet + * @define coll synchronized set */ trait SynchronizedSet[A] extends Set[A] { import scala.collection.Traversable diff --git a/src/library/scala/collection/mutable/SynchronizedStack.scala b/src/library/scala/collection/mutable/SynchronizedStack.scala index 4940884302..9109d2ef5d 100644 --- a/src/library/scala/collection/mutable/SynchronizedStack.scala +++ b/src/library/scala/collection/mutable/SynchronizedStack.scala @@ -13,13 +13,17 @@ package scala.collection package mutable -/** This is a synchronized version of the <code>Stack[T]</code> class. It +/** This is a synchronized version of the `Stack[T]` class. It * implements a data structure which allows to store and retrieve * objects in a last-in-first-out (LIFO) fashion. * + * @tparam A type of the elements contained in this stack. + * * @author Matthias Zenger * @version 1.0, 03/05/2004 * @since 1 + * @define Coll SynchronizedStack + * @define coll synchronized stack */ class SynchronizedStack[A] extends Stack[A] { import scala.collection.Traversable diff --git a/src/library/scala/collection/mutable/Traversable.scala b/src/library/scala/collection/mutable/Traversable.scala index 89c8868314..871e3a825d 100644 --- a/src/library/scala/collection/mutable/Traversable.scala +++ b/src/library/scala/collection/mutable/Traversable.scala @@ -25,10 +25,10 @@ trait Traversable[A] extends scala.collection.Traversable[A] override def companion: GenericCompanion[Traversable] = Traversable } -/** A factory object for the trait <code>Traversable</code>. - * - * @author Martin Odersky - * @version 2.8 +/** $factoryInfo + * The current default implementation of a $Coll is an `ArrayBuffer`. + * @define coll mutable traversable collection + * @define Coll mutable.Traversable */ object Traversable extends TraversableFactory[Traversable] { implicit def canBuildFrom[A]: CanBuildFrom[Coll, A, Traversable[A]] = new GenericCanBuildFrom[A] diff --git a/src/library/scala/collection/mutable/Undoable.scala b/src/library/scala/collection/mutable/Undoable.scala index 782e407843..45d3121bd3 100644 --- a/src/library/scala/collection/mutable/Undoable.scala +++ b/src/library/scala/collection/mutable/Undoable.scala @@ -13,8 +13,8 @@ package scala.collection package mutable -/** Classes that mix in the <code>Undoable</code> class provide an operation - * <code>undo</code> which can be used to undo the last operation. +/** Classes that mix in the `Undoable` class provide an operation + * `undo` which can be used to undo the last operation. * * @author Matthias Zenger * @version 1.0, 08/07/2003 diff --git a/src/library/scala/collection/mutable/WeakHashMap.scala b/src/library/scala/collection/mutable/WeakHashMap.scala index 8f496add1e..929c3f8fed 100644 --- a/src/library/scala/collection/mutable/WeakHashMap.scala +++ b/src/library/scala/collection/mutable/WeakHashMap.scala @@ -16,15 +16,35 @@ import JavaConversions._ import generic._ -/** A hash map with weak references to entries which are weakly reachable. +/** A hash map with references to entries which are weakly reachable. + * + * @tparam A type of keys contained in this map + * @tparam B type of values associated with the keys * * @since 2.8 + * @define Coll WeakHashMap + * @define coll weak hash map + * @define thatinfo the class of the returned collection. In the standard library configuration, + * `That` is always `WeakHashMap[A, B]` if the elements contained in the resulting collection are + * pairs of type `(A, B)`. This is because an implicit of type `CanBuildFrom[WeakHashMap, (A, B), WeakHashMap[A, B]]` + * is defined in object `WeakHashMap`. Otherwise, `That` resolves to the most specific type that doesn't have + * to contain pairs of type `(A, B)`, which is `Iterable`. + * @define $bfinfo an implicit value of class `CanBuildFrom` which determines the + * result class `That` from the current representation type `Repr` + * and the new element type `B`. This is usually the `canBuildFrom` value + * defined in object `WeakHashMap`. + * @define mayNotTerminateInf + * @define willNotTerminateInf */ class WeakHashMap[A, B] extends JMapWrapper[A, B](new java.util.WeakHashMap) with JMapWrapperLike[A, B, WeakHashMap[A, B]] { override def empty = new WeakHashMap[A, B] } +/** $factoryInfo + * @define Coll WeakHashMap + * @define coll weak hash map + */ object WeakHashMap extends MutableMapFactory[WeakHashMap] { implicit def canBuildFrom[A, B]: CanBuildFrom[Coll, (A, B), WeakHashMap[A, B]] = new MapCanBuildFrom[A, B] def empty[A, B]: WeakHashMap[A, B] = new WeakHashMap[A, B] diff --git a/src/library/scala/collection/mutable/WrappedArray.scala b/src/library/scala/collection/mutable/WrappedArray.scala index 10117a1086..b9e803d8dc 100644 --- a/src/library/scala/collection/mutable/WrappedArray.scala +++ b/src/library/scala/collection/mutable/WrappedArray.scala @@ -16,11 +16,19 @@ import scala.reflect.ClassManifest import scala.collection.generic._ /** - * <p>A class representing <code>Array[T]</code></p> + * A class representing `Array[T]`. + * + * @tparam T type of the elements in this wrapped array. * * @author Martin Odersky, Stephane Micheloud * @version 1.0 * @since 2.8 + * @define Coll WrappedArray + * @define coll wrapped array + * @define orderDependent + * @define orderDependentFold + * @define mayNotTerminateInf + * @define willNotTerminateInf */ abstract class WrappedArray[T] extends IndexedSeq[T] with ArrayLike[T, WrappedArray[T]] { @@ -59,6 +67,8 @@ abstract class WrappedArray[T] extends IndexedSeq[T] with ArrayLike[T, WrappedAr new WrappedArrayBuilder[T](elemManifest) } +/** A companion object used to create instances of `WrappedArray`. + */ object WrappedArray { def make[T](x: AnyRef): WrappedArray[T] = x match { case x: Array[AnyRef] => wrapRefArray[AnyRef](x).asInstanceOf[WrappedArray[T]] diff --git a/src/library/scala/collection/mutable/WrappedArrayBuilder.scala b/src/library/scala/collection/mutable/WrappedArrayBuilder.scala index 7f1e4b3254..012a0be862 100644 --- a/src/library/scala/collection/mutable/WrappedArrayBuilder.scala +++ b/src/library/scala/collection/mutable/WrappedArrayBuilder.scala @@ -15,7 +15,10 @@ package mutable import generic._ import scala.reflect.ClassManifest -/** A builder class for arrays +/** A builder class for arrays. + * + * @tparam A type of elements that can be added to this builder. + * @param manifest class manifest for objects of type `A`. * * @since 2.8 */ diff --git a/src/library/scala/math/BigDecimal.scala b/src/library/scala/math/BigDecimal.scala index bb6965fcdc..c4cccd1f52 100644 --- a/src/library/scala/math/BigDecimal.scala +++ b/src/library/scala/math/BigDecimal.scala @@ -30,6 +30,9 @@ object BigDecimal private val minCached = -512 private val maxCached = 512 + val MinLong = BigDecimal(Long.MinValue) + val MaxLong = BigDecimal(Long.MaxValue) + /** Cache ony for defaultMathContext using BigDecimals in a small range. */ private lazy val cache = new Array[BigDecimal](maxCached - minCached + 1) @@ -173,12 +176,11 @@ extends ScalaNumber with ScalaNumericConversions else doubleValue.hashCode() /** Compares this BigDecimal with the specified value for equality. - * Will only claim equality with scala.BigDecimal and java.math.BigDecimal. */ override def equals (that: Any): Boolean = that match { case that: BigDecimal => this equals that case that: BigInt => this.toBigIntExact exists (that equals _) - case x => unifiedPrimitiveEquals(x) + case x => (this <= BigDecimal.MaxLong && this >= BigDecimal.MinLong) && unifiedPrimitiveEquals(x) } protected[math] def isWhole = (this remainder 1) == BigDecimal(0) diff --git a/src/library/scala/math/BigInt.scala b/src/library/scala/math/BigInt.scala index 5267ad8b95..f0988f2934 100644 --- a/src/library/scala/math/BigInt.scala +++ b/src/library/scala/math/BigInt.scala @@ -124,7 +124,7 @@ class BigInt(val bigInteger: BigInteger) extends ScalaNumber with ScalaNumericCo override def equals(that: Any): Boolean = that match { case that: BigInt => this equals that case that: BigDecimal => that.toBigIntExact exists (this equals _) - case x => unifiedPrimitiveEquals(x) + case x => (this <= BigInt.MaxLong && this >= BigInt.MinLong) && unifiedPrimitiveEquals(x) } protected[math] def isWhole = true diff --git a/src/library/scala/math/ScalaNumericConversions.scala b/src/library/scala/math/ScalaNumericConversions.scala index d983595c17..2e754c2584 100644 --- a/src/library/scala/math/ScalaNumericConversions.scala +++ b/src/library/scala/math/ScalaNumericConversions.scala @@ -33,15 +33,28 @@ trait ScalaNumericConversions extends ScalaNumber { else lv.hashCode } + /** Should only be called after all known non-primitive + * types have been excluded. This method won't dispatch + * anywhere else after checking against the primitives + * to avoid infinite recursion between equals and this on + * unknown "Number" variants. + * + * Additionally, this should only be called if the numeric + * type is happy to be converted to Long, Float, and Double. + * If for instance a BigInt much larger than the Long range is + * sent here, it will claim equality with whatever Long is left + * in its lower 64 bits. Or a BigDecimal with more precision + * than Double can hold: same thing. There's no way given the + * interface available here to prevent this error. + */ protected def unifiedPrimitiveEquals(x: Any) = x match { case x: Char => isValidChar && (toInt == x.toInt) case x: Byte => isValidByte && (toByte == x) case x: Short => isValidShort && (toShort == x) case x: Int => isValidInt && (toInt == x) - case x: Long => toLong == x // XXX - case x: Float => toFloat == x // XXX - case x: Double => toDouble == x // XXX - case x: Number => this equals x + case x: Long => toLong == x + case x: Float => toFloat == x + case x: Double => toDouble == x case _ => false } } diff --git a/src/library/scala/runtime/AbstractFunction0.scala b/src/library/scala/runtime/AbstractFunction0.scala index 2d7d613132..a9e564f6f8 100644 --- a/src/library/scala/runtime/AbstractFunction0.scala +++ b/src/library/scala/runtime/AbstractFunction0.scala @@ -6,31 +6,14 @@ ** |/ ** \* */ +// $Id$ + +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 + package scala.runtime -abstract class AbstractFunction0[@specialized(Unit, Int, Long, Double) +R] extends Function0[R] { } -abstract class AbstractFunction1[@specialized(Int, Long, Double) -T1, - @specialized(Unit, Int, Long, Double) +R] extends Function1[T1, R] { } -abstract class AbstractFunction2[@specialized(Int, Long, Double) -T1, - @specialized(Int, Long, Double) -T2, - @specialized(Unit, Int, Long, Double) +R] extends Function2[T1, T2, R] { } -abstract class AbstractFunction3[-T1, -T2, -T3, +R] extends Function3[T1, T2, T3, R] { } -abstract class AbstractFunction4[-T1, -T2, -T3, -T4, +R] extends Function4[T1, T2, T3, T4, R] { } -abstract class AbstractFunction5[-T1, -T2, -T3, -T4, -T5, +R] extends Function5[T1, T2, T3, T4, T5, R] { } -abstract class AbstractFunction6[-T1, -T2, -T3, -T4, -T5, -T6, +R] extends Function6[T1, T2, T3, T4, T5, T6, R] { } -abstract class AbstractFunction7[-T1, -T2, -T3, -T4, -T5, -T6, -T7, +R] extends Function7[T1, T2, T3, T4, T5, T6, T7, R] { } -abstract class AbstractFunction8[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, +R] extends Function8[T1, T2, T3, T4, T5, T6, T7, T8, R] { } -abstract class AbstractFunction9[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, +R] extends Function9[T1, T2, T3, T4, T5, T6, T7, T8, T9, R] { } -abstract class AbstractFunction10[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, +R] extends Function10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, R] { } -abstract class AbstractFunction11[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, +R] extends Function11[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, R] { } -abstract class AbstractFunction12[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, +R] extends Function12[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, R] { } -abstract class AbstractFunction13[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, -T13, +R] extends Function13[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, R] { } -abstract class AbstractFunction14[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, -T13, -T14, +R] extends Function14[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, R] { } -abstract class AbstractFunction15[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, -T13, -T14, -T15, +R] extends Function15[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, R] { } -abstract class AbstractFunction16[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, -T13, -T14, -T15, -T16, +R] extends Function16[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, R] { } -abstract class AbstractFunction17[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, -T13, -T14, -T15, -T16, -T17, +R] extends Function17[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, R] { } -abstract class AbstractFunction18[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, -T13, -T14, -T15, -T16, -T17, -T18, +R] extends Function18[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, R] { } -abstract class AbstractFunction19[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, -T13, -T14, -T15, -T16, -T17, -T18, -T19, +R] extends Function19[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, R] { } -abstract class AbstractFunction20[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, -T13, -T14, -T15, -T16, -T17, -T18, -T19, -T20, +R] extends Function20[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, R] { } -abstract class AbstractFunction21[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, -T13, -T14, -T15, -T16, -T17, -T18, -T19, -T20, -T21, +R] extends Function21[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, R] { } -abstract class AbstractFunction22[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, -T13, -T14, -T15, -T16, -T17, -T18, -T19, -T20, -T21, -T22, +R] extends Function22[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, R] { } + + +abstract class AbstractFunction0[@specialized +R] extends Function0[R] { + +} diff --git a/src/library/scala/runtime/AbstractFunction1.scala b/src/library/scala/runtime/AbstractFunction1.scala new file mode 100644 index 0000000000..0a8a754236 --- /dev/null +++ b/src/library/scala/runtime/AbstractFunction1.scala @@ -0,0 +1,19 @@ +/* __ *\ +** ________ ___ / / ___ Scala API ** +** / __/ __// _ | / / / _ | (c) 2002-2010, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ + +// $Id$ + +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 + +package scala.runtime + + + +abstract class AbstractFunction1[@specialized(Int, Long, Double) -T1, @specialized(Unit, Boolean, Int, Long, Double) +R] extends Function1[T1, R] { + +} diff --git a/src/library/scala/runtime/AbstractFunction10.scala b/src/library/scala/runtime/AbstractFunction10.scala new file mode 100644 index 0000000000..0830054e1a --- /dev/null +++ b/src/library/scala/runtime/AbstractFunction10.scala @@ -0,0 +1,19 @@ +/* __ *\ +** ________ ___ / / ___ Scala API ** +** / __/ __// _ | / / / _ | (c) 2002-2010, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ + +// $Id$ + +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 + +package scala.runtime + + + +abstract class AbstractFunction10[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, +R] extends Function10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, R] { + +} diff --git a/src/library/scala/runtime/AbstractFunction11.scala b/src/library/scala/runtime/AbstractFunction11.scala new file mode 100644 index 0000000000..6ee68126d5 --- /dev/null +++ b/src/library/scala/runtime/AbstractFunction11.scala @@ -0,0 +1,19 @@ +/* __ *\ +** ________ ___ / / ___ Scala API ** +** / __/ __// _ | / / / _ | (c) 2002-2010, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ + +// $Id$ + +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 + +package scala.runtime + + + +abstract class AbstractFunction11[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, +R] extends Function11[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, R] { + +} diff --git a/src/library/scala/runtime/AbstractFunction12.scala b/src/library/scala/runtime/AbstractFunction12.scala new file mode 100644 index 0000000000..cda522dd37 --- /dev/null +++ b/src/library/scala/runtime/AbstractFunction12.scala @@ -0,0 +1,19 @@ +/* __ *\ +** ________ ___ / / ___ Scala API ** +** / __/ __// _ | / / / _ | (c) 2002-2010, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ + +// $Id$ + +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 + +package scala.runtime + + + +abstract class AbstractFunction12[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, +R] extends Function12[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, R] { + +} diff --git a/src/library/scala/runtime/AbstractFunction13.scala b/src/library/scala/runtime/AbstractFunction13.scala new file mode 100644 index 0000000000..016bcd4a31 --- /dev/null +++ b/src/library/scala/runtime/AbstractFunction13.scala @@ -0,0 +1,19 @@ +/* __ *\ +** ________ ___ / / ___ Scala API ** +** / __/ __// _ | / / / _ | (c) 2002-2010, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ + +// $Id$ + +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 + +package scala.runtime + + + +abstract class AbstractFunction13[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, -T13, +R] extends Function13[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, R] { + +} diff --git a/src/library/scala/runtime/AbstractFunction14.scala b/src/library/scala/runtime/AbstractFunction14.scala new file mode 100644 index 0000000000..fc97bc8936 --- /dev/null +++ b/src/library/scala/runtime/AbstractFunction14.scala @@ -0,0 +1,19 @@ +/* __ *\ +** ________ ___ / / ___ Scala API ** +** / __/ __// _ | / / / _ | (c) 2002-2010, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ + +// $Id$ + +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 + +package scala.runtime + + + +abstract class AbstractFunction14[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, -T13, -T14, +R] extends Function14[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, R] { + +} diff --git a/src/library/scala/runtime/AbstractFunction15.scala b/src/library/scala/runtime/AbstractFunction15.scala new file mode 100644 index 0000000000..9dc7a75b36 --- /dev/null +++ b/src/library/scala/runtime/AbstractFunction15.scala @@ -0,0 +1,19 @@ +/* __ *\ +** ________ ___ / / ___ Scala API ** +** / __/ __// _ | / / / _ | (c) 2002-2010, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ + +// $Id$ + +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 + +package scala.runtime + + + +abstract class AbstractFunction15[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, -T13, -T14, -T15, +R] extends Function15[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, R] { + +} diff --git a/src/library/scala/runtime/AbstractFunction16.scala b/src/library/scala/runtime/AbstractFunction16.scala new file mode 100644 index 0000000000..3f8f19621a --- /dev/null +++ b/src/library/scala/runtime/AbstractFunction16.scala @@ -0,0 +1,19 @@ +/* __ *\ +** ________ ___ / / ___ Scala API ** +** / __/ __// _ | / / / _ | (c) 2002-2010, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ + +// $Id$ + +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 + +package scala.runtime + + + +abstract class AbstractFunction16[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, -T13, -T14, -T15, -T16, +R] extends Function16[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, R] { + +} diff --git a/src/library/scala/runtime/AbstractFunction17.scala b/src/library/scala/runtime/AbstractFunction17.scala new file mode 100644 index 0000000000..1b8ea58c56 --- /dev/null +++ b/src/library/scala/runtime/AbstractFunction17.scala @@ -0,0 +1,19 @@ +/* __ *\ +** ________ ___ / / ___ Scala API ** +** / __/ __// _ | / / / _ | (c) 2002-2010, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ + +// $Id$ + +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 + +package scala.runtime + + + +abstract class AbstractFunction17[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, -T13, -T14, -T15, -T16, -T17, +R] extends Function17[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, R] { + +} diff --git a/src/library/scala/runtime/AbstractFunction18.scala b/src/library/scala/runtime/AbstractFunction18.scala new file mode 100644 index 0000000000..63aa6cf8d1 --- /dev/null +++ b/src/library/scala/runtime/AbstractFunction18.scala @@ -0,0 +1,19 @@ +/* __ *\ +** ________ ___ / / ___ Scala API ** +** / __/ __// _ | / / / _ | (c) 2002-2010, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ + +// $Id$ + +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 + +package scala.runtime + + + +abstract class AbstractFunction18[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, -T13, -T14, -T15, -T16, -T17, -T18, +R] extends Function18[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, R] { + +} diff --git a/src/library/scala/runtime/AbstractFunction19.scala b/src/library/scala/runtime/AbstractFunction19.scala new file mode 100644 index 0000000000..7a511ddd6e --- /dev/null +++ b/src/library/scala/runtime/AbstractFunction19.scala @@ -0,0 +1,19 @@ +/* __ *\ +** ________ ___ / / ___ Scala API ** +** / __/ __// _ | / / / _ | (c) 2002-2010, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ + +// $Id$ + +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 + +package scala.runtime + + + +abstract class AbstractFunction19[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, -T13, -T14, -T15, -T16, -T17, -T18, -T19, +R] extends Function19[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, R] { + +} diff --git a/src/library/scala/runtime/AbstractFunction2.scala b/src/library/scala/runtime/AbstractFunction2.scala new file mode 100644 index 0000000000..0f75b2af87 --- /dev/null +++ b/src/library/scala/runtime/AbstractFunction2.scala @@ -0,0 +1,19 @@ +/* __ *\ +** ________ ___ / / ___ Scala API ** +** / __/ __// _ | / / / _ | (c) 2002-2010, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ + +// $Id$ + +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 + +package scala.runtime + + + +abstract class AbstractFunction2[@specialized(Int, Long, Double) -T1, @specialized(Int, Long, Double) -T2, @specialized(Unit, Boolean, Int, Long, Double) +R] extends Function2[T1, T2, R] { + +} diff --git a/src/library/scala/runtime/AbstractFunction20.scala b/src/library/scala/runtime/AbstractFunction20.scala new file mode 100644 index 0000000000..6afb329503 --- /dev/null +++ b/src/library/scala/runtime/AbstractFunction20.scala @@ -0,0 +1,19 @@ +/* __ *\ +** ________ ___ / / ___ Scala API ** +** / __/ __// _ | / / / _ | (c) 2002-2010, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ + +// $Id$ + +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 + +package scala.runtime + + + +abstract class AbstractFunction20[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, -T13, -T14, -T15, -T16, -T17, -T18, -T19, -T20, +R] extends Function20[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, R] { + +} diff --git a/src/library/scala/runtime/AbstractFunction21.scala b/src/library/scala/runtime/AbstractFunction21.scala new file mode 100644 index 0000000000..8996f2f397 --- /dev/null +++ b/src/library/scala/runtime/AbstractFunction21.scala @@ -0,0 +1,19 @@ +/* __ *\ +** ________ ___ / / ___ Scala API ** +** / __/ __// _ | / / / _ | (c) 2002-2010, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ + +// $Id$ + +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 + +package scala.runtime + + + +abstract class AbstractFunction21[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, -T13, -T14, -T15, -T16, -T17, -T18, -T19, -T20, -T21, +R] extends Function21[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, R] { + +} diff --git a/src/library/scala/runtime/AbstractFunction22.scala b/src/library/scala/runtime/AbstractFunction22.scala new file mode 100644 index 0000000000..8b33534291 --- /dev/null +++ b/src/library/scala/runtime/AbstractFunction22.scala @@ -0,0 +1,19 @@ +/* __ *\ +** ________ ___ / / ___ Scala API ** +** / __/ __// _ | / / / _ | (c) 2002-2010, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ + +// $Id$ + +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 + +package scala.runtime + + + +abstract class AbstractFunction22[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, -T13, -T14, -T15, -T16, -T17, -T18, -T19, -T20, -T21, -T22, +R] extends Function22[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, R] { + +} diff --git a/src/library/scala/runtime/AbstractFunction3.scala b/src/library/scala/runtime/AbstractFunction3.scala new file mode 100644 index 0000000000..463d3d8a1d --- /dev/null +++ b/src/library/scala/runtime/AbstractFunction3.scala @@ -0,0 +1,19 @@ +/* __ *\ +** ________ ___ / / ___ Scala API ** +** / __/ __// _ | / / / _ | (c) 2002-2010, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ + +// $Id$ + +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 + +package scala.runtime + + + +abstract class AbstractFunction3[-T1, -T2, -T3, +R] extends Function3[T1, T2, T3, R] { + +} diff --git a/src/library/scala/runtime/AbstractFunction4.scala b/src/library/scala/runtime/AbstractFunction4.scala new file mode 100644 index 0000000000..f7bc7d12a9 --- /dev/null +++ b/src/library/scala/runtime/AbstractFunction4.scala @@ -0,0 +1,19 @@ +/* __ *\ +** ________ ___ / / ___ Scala API ** +** / __/ __// _ | / / / _ | (c) 2002-2010, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ + +// $Id$ + +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 + +package scala.runtime + + + +abstract class AbstractFunction4[-T1, -T2, -T3, -T4, +R] extends Function4[T1, T2, T3, T4, R] { + +} diff --git a/src/library/scala/runtime/AbstractFunction5.scala b/src/library/scala/runtime/AbstractFunction5.scala new file mode 100644 index 0000000000..6642bb75bb --- /dev/null +++ b/src/library/scala/runtime/AbstractFunction5.scala @@ -0,0 +1,19 @@ +/* __ *\ +** ________ ___ / / ___ Scala API ** +** / __/ __// _ | / / / _ | (c) 2002-2010, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ + +// $Id$ + +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 + +package scala.runtime + + + +abstract class AbstractFunction5[-T1, -T2, -T3, -T4, -T5, +R] extends Function5[T1, T2, T3, T4, T5, R] { + +} diff --git a/src/library/scala/runtime/AbstractFunction6.scala b/src/library/scala/runtime/AbstractFunction6.scala new file mode 100644 index 0000000000..70944947e7 --- /dev/null +++ b/src/library/scala/runtime/AbstractFunction6.scala @@ -0,0 +1,19 @@ +/* __ *\ +** ________ ___ / / ___ Scala API ** +** / __/ __// _ | / / / _ | (c) 2002-2010, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ + +// $Id$ + +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 + +package scala.runtime + + + +abstract class AbstractFunction6[-T1, -T2, -T3, -T4, -T5, -T6, +R] extends Function6[T1, T2, T3, T4, T5, T6, R] { + +} diff --git a/src/library/scala/runtime/AbstractFunction7.scala b/src/library/scala/runtime/AbstractFunction7.scala new file mode 100644 index 0000000000..ba4a35f743 --- /dev/null +++ b/src/library/scala/runtime/AbstractFunction7.scala @@ -0,0 +1,19 @@ +/* __ *\ +** ________ ___ / / ___ Scala API ** +** / __/ __// _ | / / / _ | (c) 2002-2010, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ + +// $Id$ + +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 + +package scala.runtime + + + +abstract class AbstractFunction7[-T1, -T2, -T3, -T4, -T5, -T6, -T7, +R] extends Function7[T1, T2, T3, T4, T5, T6, T7, R] { + +} diff --git a/src/library/scala/runtime/AbstractFunction8.scala b/src/library/scala/runtime/AbstractFunction8.scala new file mode 100644 index 0000000000..c3a0f0f9e3 --- /dev/null +++ b/src/library/scala/runtime/AbstractFunction8.scala @@ -0,0 +1,19 @@ +/* __ *\ +** ________ ___ / / ___ Scala API ** +** / __/ __// _ | / / / _ | (c) 2002-2010, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ + +// $Id$ + +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 + +package scala.runtime + + + +abstract class AbstractFunction8[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, +R] extends Function8[T1, T2, T3, T4, T5, T6, T7, T8, R] { + +} diff --git a/src/library/scala/runtime/AbstractFunction9.scala b/src/library/scala/runtime/AbstractFunction9.scala new file mode 100644 index 0000000000..7e0541e246 --- /dev/null +++ b/src/library/scala/runtime/AbstractFunction9.scala @@ -0,0 +1,19 @@ +/* __ *\ +** ________ ___ / / ___ Scala API ** +** / __/ __// _ | / / / _ | (c) 2002-2010, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ + +// $Id$ + +// generated by genprod on Mon Apr 12 15:28:18 CEST 2010 + +package scala.runtime + + + +abstract class AbstractFunction9[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, +R] extends Function9[T1, T2, T3, T4, T5, T6, T7, T8, T9, R] { + +} diff --git a/src/library/scala/util/Random.scala b/src/library/scala/util/Random.scala index ffa248d638..cd9d5eed0e 100644 --- a/src/library/scala/util/Random.scala +++ b/src/library/scala/util/Random.scala @@ -89,14 +89,12 @@ class Random(val self: java.util.Random) { List.fill(length)(safeChar()).mkString } - /** Returns a pseudorandomly generated String drawing upon - * only ASCII characters between 33 and 126. + /** Returns the next pseudorandom, uniformly distributed value + * from the ASCII range 33-126. */ - def nextASCIIString(length: Int) = { - val (min, max) = (33, 126) - def nextDigit = nextInt(max - min) + min - - new String(Array.fill(length)(nextDigit.toByte), "ASCII") + def nextPrintableChar(): Char = { + val (low, high) = (33, 126) + (self.nextInt(high - low) + low).toChar } def setSeed(seed: Long) { self.setSeed(seed) } @@ -111,6 +109,17 @@ object Random extends Random { import collection.mutable.ArrayBuffer import collection.generic.CanBuildFrom + /** Returns a Stream of pseudorandomly chosen alphanumeric characters, + * equally chosen from A-Z, a-z, and 0-9. + * + * @since 2.8 + */ + def alphanumeric: Stream[Char] = { + def isAlphaNum(c: Char) = (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') + + Stream continually nextPrintableChar filter isAlphaNum + } + /** Returns a new collection of the same type in a randomly chosen order. * * @param coll the TraversableOnce to shuffle |