/scala-compiler-sxr/scala-compiler-2.9.2/scala/Function1.scala.html
HTML | 77 lines | 70 code | 7 blank | 0 comment | 0 complexity | 117745f54e079a1d4cc76efaae2fa827 MD5 | raw file
- <?xml version="1.0" encoding="utf-8"?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html;charset=utf-8" ></meta>
- <meta http-equiv="Expires" content="0" />
- <title>scala/Function1.scala</title>
- <script type="text/javascript" src="../jquery-all.js"></script>
- <script type="text/javascript" src="../linked.js"></script>
- <link rel="stylesheet" type="text/css" href="../style.css" title="Style"></link>
- </head>
- <body>
- <pre>
- <span class="comment">/* __ *\
- ** ________ ___ / / ___ Scala API **
- ** / __/ __// _ | / / / _ | (c) 2002-2011, LAMP/EPFL **
- ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
- ** /____/\___/_/ |_/____/_/ | | **
- ** |/ **
- \* */</span>
- <span class="comment">// GENERATED CODE: DO NOT EDIT. See scala.Function0 for timestamp.</span>
- <span class="keyword">package</span> scala
- <span class="comment">/** A function of 1 parameter.
- *
- * In the following example, the definition of succ is a
- * shorthand for the anonymous class definition anonfun1:
- *
- * {{{
- * object Main extends Application {
- * val succ = (x: Int) => x + 1
- * val anonfun1 = new Function1[Int, Int] {
- * def apply(x: Int): Int = x + 1
- * }
- * assert(succ(0) == anonfun1(0))
- * }
- * }}}
- *
- * Note that `Function1` does not define a total function, as might
- * be suggested by the existence of [[scala.PartialFunction]]. The only
- * distinction between `Function1` and `PartialFunction` is that the
- * latter can specify inputs which it will not handle.
- *
- */</span>
- @annotation.implicitNotFound<span class="delimiter">(</span>msg = <span class="string">"No implicit view available from ${T1} => ${R}."</span><span class="delimiter">)</span>
- <span class="keyword">trait</span> <a title="trait Function1[-T1, +R] extends java.lang.Object with ScalaObject" id="1367">Function1</a><span class="delimiter">[</span>@specialized<span class="delimiter">(</span>scala.Int, scala.Long, scala.Float, scala.Double<span class="delimiter">)</span> -<a title=">: Nothing <: Any" id="9794">T1</a>, @specialized<span class="delimiter">(</span>scala.Unit, scala.Boolean, scala.Int, scala.Float, scala.Long, scala.Double<span class="delimiter">)</span> +<a title=">: Nothing <: Any" id="9795">R</a><span class="delimiter">]</span> <a href="ScalaObject.scala.html#464" title="ScalaObject" class="keyword">extends</a> <span title="java.lang.Object">AnyRef</span> <span class="delimiter">{</span> self =>
- <span class="comment">/** Apply the body of this function to the argument. It may throw an
- * exception.
- *
- * @return the result of function application.
- */</span>
- <span class="keyword">def</span> <a title="(v1: T1)R" id="53453">apply</a><span class="delimiter">(</span><a title="T1" id="57840">v1</a>: <a href="#9794" title="T1">T1</a><span class="delimiter">)</span>: <a href="#9795" title="R">R</a>
- <span class="comment">/** Composes two instances of Function1 in a new Function1, with this function applied last.
- *
- * @tparam A the type to which function `g` can be applied
- * @param g a function A => T1
- * @return a new function `f` such that `f(x) == apply(g(x))`
- */</span>
- <span class="keyword">def</span> <a title="[A](g: A => T1)A => R" id="53454">compose</a><span class="delimiter">[</span><a title=">: Nothing <: Any" id="53456">A</a><span class="delimiter">]</span><span class="delimiter">(</span><a title="A => T1" id="77142">g</a>: A => T1<span class="delimiter">)</span>: A => R = <span class="delimiter">{</span> <a title="A" id="77146">x</a> => <a href="#53453" title="(v1: T1)R">apply</a><span class="delimiter">(</span><a href="#53453" title="(v1: A)T1">g</a><span class="delimiter">(</span><a href="#77146" title="A">x</a><span class="delimiter">)</span><span class="delimiter">)</span> <span class="delimiter">}</span>
- <span class="comment">/** Composes two instances of Function1 in a new Function1, with this function applied first.
- *
- * @tparam A the result type of function `g`
- * @param g a function R => A
- * @return a new function `f` such that `f(x) == g(apply(x))`
- */</span>
- <span class="keyword">def</span> <a title="[A](g: R => A)T1 => A" id="53457">andThen</a><span class="delimiter">[</span><a title=">: Nothing <: Any" id="53459">A</a><span class="delimiter">]</span><span class="delimiter">(</span><a title="R => A" id="76761">g</a>: R => A<span class="delimiter">)</span>: T1 => A = <span class="delimiter">{</span> <a title="T1" id="77149">x</a> => <a href="#53453" title="(v1: R)A">g</a><span class="delimiter">(</span><a href="#53453" title="(v1: T1)R">apply</a><span class="delimiter">(</span><a href="#77149" title="T1">x</a><span class="delimiter">)</span><span class="delimiter">)</span> <span class="delimiter">}</span>
- <span class="keyword">override</span> <span class="keyword">def</span> <a title="()java.lang.String" id="53460">toString</a><span class="delimiter">(</span><span class="delimiter">)</span> = <span title="java.lang.String("<function1>")" class="string">"<function1>"</span>
- <span class="delimiter">}</span>
- </pre>
- </body>
- </html>