diff options
author | michelou <michelou@epfl.ch> | 2011-07-20 21:52:50 +0000 |
---|---|---|
committer | michelou <michelou@epfl.ch> | 2011-07-20 21:52:50 +0000 |
commit | c0ddb8f941dcb4ec0ca0aae0739406352e17cdfa (patch) | |
tree | d2107fa9c923dbd53f1c17cd8d4b6159b15b7768 /src/library/scala/PartialFunction.scala | |
parent | 628c0265aaeaab8ef84dfc623d45119972f83656 (diff) | |
download | scala-c0ddb8f941dcb4ec0ca0aae0739406352e17cdfa.tar.gz scala-c0ddb8f941dcb4ec0ca0aae0739406352e17cdfa.tar.bz2 scala-c0ddb8f941dcb4ec0ca0aae0739406352e17cdfa.zip |
4th round of clean ups (see r25293, r25285, r25...
4th round of clean ups (see r25293, r25285, r25292)
Diffstat (limited to 'src/library/scala/PartialFunction.scala')
-rw-r--r-- | src/library/scala/PartialFunction.scala | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/src/library/scala/PartialFunction.scala b/src/library/scala/PartialFunction.scala index 3e6c363acc..b8e20c2de1 100644 --- a/src/library/scala/PartialFunction.scala +++ b/src/library/scala/PartialFunction.scala @@ -6,14 +6,12 @@ ** |/ ** \* */ - - package scala -/** A partial function of type `PartialFunction[A, B]` is a - * unary function where the domain does not necessarily include all values of type - * `A`. The function `isDefinedAt` allows to - * test dynamically if a value is in the domain of the function. +/** A partial function of type `PartialFunction[A, B]` is a unary function + * where the domain does not necessarily include all values of type `A`. + * The function `isDefinedAt` allows to test dynamically if a value is in + * the domain of the function. * * @author Martin Odersky * @version 1.0, 16/07/2003 @@ -23,12 +21,12 @@ trait PartialFunction[-A, +B] extends (A => B) { /** Checks if a value is contained in the function's domain. * * @param x the value to test - * @return `true`, iff `x` is in the domain of this function, `false` otherwise. + * @return `'''true'''`, iff `x` is in the domain of this function, `'''false'''` otherwise. */ def isDefinedAt(x: A): Boolean - /** Composes this partial function with a fallback partial function which gets applied where this partial function - * is not defined. + /** Composes this partial function with a fallback partial function which + * gets applied where this partial function is not defined. * * @param that the fallback function * @tparam A1 the argument type of the fallback function @@ -46,8 +44,8 @@ trait PartialFunction[-A, +B] extends (A => B) { else that.apply(x) } - /** Composes this partial function with a transformation function that gets applied - * to results of this partial function. + /** Composes this partial function with a transformation function that + * gets applied to results of this partial function. * @param k the transformation function * @tparam C the result type of the transformation function. * @return a partial function with the same domain as this partial function, which maps @@ -70,8 +68,7 @@ trait PartialFunction[-A, +B] extends (A => B) { /** A few handy operations which leverage the extra bit of information * available in partial functions. Examples: - * - * <pre> + * {{{ * import PartialFunction._ * * def strangeConditional(other: Any): Boolean = cond(other) { @@ -79,7 +76,7 @@ trait PartialFunction[-A, +B] extends (A => B) { * case x: Int => true * } * def onlyInt(v: Any): Option[Int] = condOpt(v) { case x: Int => x } - * </pre> + * }}} * * @author Paul Phillips * @since 2.8 @@ -98,9 +95,10 @@ object PartialFunction (pf isDefinedAt x) && pf(x) /** Transforms a PartialFunction[T, U] `pf` into Function1[T, Option[U]] `f` - * whose result is Some(x) if the argument is in pf's domain and None otherwise, - * and applies it to the value `x`. In effect, it is a `match` statement - * which wraps all case results in Some(_) and adds `case _ => None` to the end. + * whose result is `Some(x)` if the argument is in `pf`'s domain and `None` + * otherwise, and applies it to the value `x`. In effect, it is a + * `'''match'''` statement which wraps all case results in `Some(_)` and + * adds `'''case''' _ => None` to the end. * * @param x the value to test * @param pf the PartialFunction[T, U] |