aboutsummaryrefslogtreecommitdiff
path: root/imports/codemirror/mode/clike/scala.html
diff options
context:
space:
mode:
authorJon Reid2012-07-17 16:03:14 -0700
committerJon Reid2012-07-17 16:03:14 -0700
commit42a51e0c27f2e2cd825d07b3af5ec05b0e5208b3 (patch)
tree67deeb8c5b34aacc91f737cc64a3bc9ef1f4f05f /imports/codemirror/mode/clike/scala.html
parenta12cabc16273ffe04af4bce1f7438dc9326efa89 (diff)
parentb4b3e45d6684e77d361b4f8ca5be4889428320c5 (diff)
downloadninja-42a51e0c27f2e2cd825d07b3af5ec05b0e5208b3.tar.gz
Merge remote-tracking branch 'ninja-jduran/TimelineUber' into timeline-local
Diffstat (limited to 'imports/codemirror/mode/clike/scala.html')
-rw-r--r--imports/codemirror/mode/clike/scala.html765
1 files changed, 765 insertions, 0 deletions
diff --git a/imports/codemirror/mode/clike/scala.html b/imports/codemirror/mode/clike/scala.html
new file mode 100644
index 00000000..5fdd84ed
--- /dev/null
+++ b/imports/codemirror/mode/clike/scala.html
@@ -0,0 +1,765 @@
1<!doctype html>
2<html>
3 <head>
4 <title>CodeMirror: C-like mode</title>
5 <link rel="stylesheet" href="../../lib/codemirror.css">
6 <link rel="stylesheet" href="../../theme/ambiance.css">
7 <script src="../../lib/codemirror.js"></script>
8 <script src="clike.js"></script>
9 <link rel="stylesheet" href="../../doc/docs.css">
10 <style>
11 body
12 {
13 margin: 0;
14 padding: 0;
15 max-width:inherit;
16 height: 100%;
17 }
18 html, form, .CodeMirror, .CodeMirror-scroll
19 {
20 height: 100%;
21 }
22 </style>
23 </head>
24 <body>
25<form>
26<textarea id="code" name="code">
27
28 /* __ *\
29 ** ________ ___ / / ___ Scala API **
30 ** / __/ __// _ | / / / _ | (c) 2003-2011, LAMP/EPFL **
31 ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
32 ** /____/\___/_/ |_/____/_/ | | **
33 ** |/ **
34 \* */
35
36 package scala.collection
37
38 import generic._
39 import mutable.{ Builder, ListBuffer }
40 import annotation.{tailrec, migration, bridge}
41 import annotation.unchecked.{ uncheckedVariance => uV }
42 import parallel.ParIterable
43
44 /** A template trait for traversable collections of type `Traversable[A]`.
45 *
46 * $traversableInfo
47 * @define mutability
48 * @define traversableInfo
49 * This is a base trait of all kinds of $mutability Scala collections. It
50 * implements the behavior common to all collections, in terms of a method
51 * `foreach` with signature:
52 * {{{
53 * def foreach[U](f: Elem => U): Unit
54 * }}}
55 * Collection classes mixing in this trait provide a concrete
56 * `foreach` method which traverses all the
57 * elements contained in the collection, applying a given function to each.
58 * They also need to provide a method `newBuilder`
59 * which creates a builder for collections of the same kind.
60 *
61 * A traversable class might or might not have two properties: strictness
62 * and orderedness. Neither is represented as a type.
63 *
64 * The instances of a strict collection class have all their elements
65 * computed before they can be used as values. By contrast, instances of
66 * a non-strict collection class may defer computation of some of their
67 * elements until after the instance is available as a value.
68 * A typical example of a non-strict collection class is a
69 * <a href="../immutable/Stream.html" target="ContentFrame">
70 * `scala.collection.immutable.Stream`</a>.
71 * A more general class of examples are `TraversableViews`.
72 *
73 * If a collection is an instance of an ordered collection class, traversing
74 * its elements with `foreach` will always visit elements in the
75 * same order, even for different runs of the program. If the class is not
76 * ordered, `foreach` can visit elements in different orders for
77 * different runs (but it will keep the same order in the same run).'
78 *
79 * A typical example of a collection class which is not ordered is a
80 * `HashMap` of objects. The traversal order for hash maps will
81 * depend on the hash codes of its elements, and these hash codes might
82 * differ from one run to the next. By contrast, a `LinkedHashMap`
83 * is ordered because it's `foreach` method visits elements in the
84 * order they were inserted into the `HashMap`.
85 *
86 * @author Martin Odersky
87 * @version 2.8
88 * @since 2.8
89 * @tparam A the element type of the collection
90 * @tparam Repr the type of the actual collection containing the elements.
91 *
92 * @define Coll Traversable
93 * @define coll traversable collection
94 */
95 trait TraversableLike[+A, +Repr] extends HasNewBuilder[A, Repr]
96 with FilterMonadic[A, Repr]
97 with TraversableOnce[A]
98 with GenTraversableLike[A, Repr]
99 with Parallelizable[A, ParIterable[A]]
100 {
101 self =>
102
103 import Traversable.breaks._
104
105 /** The type implementing this traversable */
106 protected type Self = Repr
107
108 /** The collection of type $coll underlying this `TraversableLike` object.
109 * By default this is implemented as the `TraversableLike` object itself,
110 * but this can be overridden.
111 */
112 def repr: Repr = this.asInstanceOf[Repr]
113
114 /** The underlying collection seen as an instance of `$Coll`.
115 * By default this is implemented as the current collection object itself,
116 * but this can be overridden.
117 */
118 protected[this] def thisCollection: Traversable[A] = this.asInstanceOf[Traversable[A]]
119
120 /** A conversion from collections of type `Repr` to `$Coll` objects.
121 * By default this is implemented as just a cast, but this can be overridden.
122 */
123 protected[this] def toCollection(repr: Repr): Traversable[A] = repr.asInstanceOf[Traversable[A]]
124
125 /** Creates a new builder for this collection type.
126 */
127 protected[this] def newBuilder: Builder[A, Repr]
128
129 protected[this] def parCombiner = ParIterable.newCombiner[A]
130
131 /** Applies a function `f` to all elements of this $coll.
132 *
133 * Note: this method underlies the implementation of most other bulk operations.
134 * It's important to implement this method in an efficient way.
135 *
136 *
137 * @param f the function that is applied for its side-effect to every element.
138 * The result of function `f` is discarded.
139 *
140 * @tparam U the type parameter describing the result of function `f`.
141 * This result will always be ignored. Typically `U` is `Unit`,
142 * but this is not necessary.
143 *
144 * @usecase def foreach(f: A => Unit): Unit
145 */
146 def foreach[U](f: A => U): Unit
147
148 /** Tests whether this $coll is empty.
149 *
150 * @return `true` if the $coll contain no elements, `false` otherwise.
151 */
152 def isEmpty: Boolean = {
153 var result = true
154 breakable {
155 for (x <- this) {
156 result = false
157 break
158 }
159 }
160 result
161 }
162
163 /** Tests whether this $coll is known to have a finite size.
164 * All strict collections are known to have finite size. For a non-strict collection
165 * such as `Stream`, the predicate returns `true` if all elements have been computed.
166 * It returns `false` if the stream is not yet evaluated to the end.
167 *
168 * Note: many collection methods will not work on collections of infinite sizes.
169 *
170 * @return `true` if this collection is known to have finite size, `false` otherwise.
171 */
172 def hasDefiniteSize = true
173
174 def ++[B >: A, That](that: GenTraversableOnce[B])(implicit bf: CanBuildFrom[Repr, B, That]): That = {
175 val b = bf(repr)
176 if (that.isInstanceOf[IndexedSeqLike[_, _]]) b.sizeHint(this, that.seq.size)
177 b ++= thisCollection
178 b ++= that.seq
179 b.result
180 }
181
182 @bridge
183 def ++[B >: A, That](that: TraversableOnce[B])(implicit bf: CanBuildFrom[Repr, B, That]): That =
184 ++(that: GenTraversableOnce[B])(bf)
185
186 /** Concatenates this $coll with the elements of a traversable collection.
187 * It differs from ++ in that the right operand determines the type of the
188 * resulting collection rather than the left one.
189 *
190 * @param that the traversable to append.
191 * @tparam B the element type of the returned collection.
192 * @tparam That $thatinfo
193 * @param bf $bfinfo
194 * @return a new collection of type `That` which contains all elements
195 * of this $coll followed by all elements of `that`.
196 *
197 * @usecase def ++:[B](that: TraversableOnce[B]): $Coll[B]
198 *
199 * @return a new $coll which contains all elements of this $coll
200 * followed by all elements of `that`.
201 */
202 def ++:[B >: A, That](that: TraversableOnce[B])(implicit bf: CanBuildFrom[Repr, B, That]): That = {
203 val b = bf(repr)
204 if (that.isInstanceOf[IndexedSeqLike[_, _]]) b.sizeHint(this, that.size)
205 b ++= that
206 b ++= thisCollection
207 b.result
208 }
209
210 /** This overload exists because: for the implementation of ++: we should reuse
211 * that of ++ because many collections override it with more efficient versions.
212 * Since TraversableOnce has no '++' method, we have to implement that directly,
213 * but Traversable and down can use the overload.
214 */
215 def ++:[B >: A, That](that: Traversable[B])(implicit bf: CanBuildFrom[Repr, B, That]): That =
216 (that ++ seq)(breakOut)
217
218 def map[B, That](f: A => B)(implicit bf: CanBuildFrom[Repr, B