summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormichelou <michelou@epfl.ch>2007-05-03 12:43:50 +0000
committermichelou <michelou@epfl.ch>2007-05-03 12:43:50 +0000
commitb927a915b08b38888ea52c2433ff9376bcf33a83 (patch)
tree202a5d215578245f4a43691f57d63fa251f5de80 /src
parent97caf77483fa29a81068a9b37da999e49bed016c (diff)
downloadscala-b927a915b08b38888ea52c2433ff9376bcf33a83.tar.gz
scala-b927a915b08b38888ea52c2433ff9376bcf33a83.tar.bz2
scala-b927a915b08b38888ea52c2433ff9376bcf33a83.zip
updated Scala comments (code examples, links, o...
updated Scala comments (code examples, links, overrides)
Diffstat (limited to 'src')
-rw-r--r--src/actors/scala/actors/Actor.scala25
-rw-r--r--src/actors/scala/actors/ActorProxy.scala4
-rw-r--r--src/actors/scala/actors/Channel.scala12
-rw-r--r--src/actors/scala/actors/Future.scala28
-rw-r--r--src/actors/scala/actors/Reaction.scala20
-rw-r--r--src/actors/scala/actors/remote/RemoteActor.scala79
-rw-r--r--src/compiler/scala/tools/nsc/doc/ModelToXML.scala24
-rw-r--r--src/compiler/scala/tools/nsc/transform/Constructors.scala16
-rw-r--r--src/library/scala/Enumeration.scala192
-rw-r--r--src/library/scala/concurrent/Process.scala5
-rw-r--r--src/library/scala/unsealed.scala5
-rw-r--r--src/library/scala/xml/HasKeyValue.scala28
-rw-r--r--src/library/scala/xml/MalformedAttributeException.scala6
-rw-r--r--src/library/scala/xml/Node.scala45
-rw-r--r--src/library/scala/xml/NodeBuffer.scala24
-rw-r--r--src/library/scala/xml/SpecialNode.scala17
-rw-r--r--src/library/scala/xml/Text.scala3
-rw-r--r--src/library/scala/xml/TypeSymbol.scala8
-rw-r--r--src/library/scala/xml/Unparsed.scala11
-rw-r--r--src/library/scala/xml/UnprefixedAttribute.scala16
20 files changed, 328 insertions, 240 deletions
diff --git a/src/actors/scala/actors/Actor.scala b/src/actors/scala/actors/Actor.scala
index 1580960869..8aa465e104 100644
--- a/src/actors/scala/actors/Actor.scala
+++ b/src/actors/scala/actors/Actor.scala
@@ -262,13 +262,22 @@ object Actor {
* implementation of event-based actors.
* </p>
* <p>
- * The main ideas of our approach are explained in the papers<br>
- * <b>Event-Based Programming without Inversion of Control</b>,
- * Philipp Haller and Martin Odersky, <i>Proc. JMLC 2006</i>
- * <br><br>
- * <b>Actors that Unify Threads and Events</b>,
- * Philipp Haller and Martin Odersky, <i>LAMP-REPORT-2007-001, EPFL</i>
+ * The main ideas of our approach are explained in the two papers
* </p>
+ * <ul>
+ * <li>
+ * <a href="http://lampwww.epfl.ch/~odersky/papers/jmlc06.pdf">
+ * <span style="font-weight:bold; white-space:nowrap;">Event-Based
+ * Programming without Inversion of Control</span></a>,<br/>
+ * Philipp Haller and Martin Odersky, <i>Proc. JMLC 2006</i>, and
+ * </li>
+ * <li>
+ * <a href="http://www.scala-lang.org/docu/files/haller07actorsunify.pdf">
+ * <span style="font-weight:bold; white-space:nowrap;">Actors that
+ * Unify Threads and Events</span></a>,<br/>
+ * Philipp Haller and Martin Odersky, <i>LAMP-REPORT-2007-001, EPFL</i>.
+ * </li>
+ * </ul>
*
* @version 0.9.6
* @author Philipp Haller
@@ -730,9 +739,9 @@ trait Actor extends OutputChannel[Any] {
/** <p>
* This object is used as the timeout pattern in
- * <a href="Actor.html#receiveWithin(scala.Long)" target="contentFrame">
+ * <a href="Actor.html#receiveWithin(Long)" target="contentFrame">
* <code>receiveWithin</code></a> and
- * <a href="Actor.html#reactWithin(scala.Long)" target="contentFrame">
+ * <a href="Actor.html#reactWithin(Long)" target="contentFrame">
* <code>reactWithin</code></a>.
* </p>
* <p>
diff --git a/src/actors/scala/actors/ActorProxy.scala b/src/actors/scala/actors/ActorProxy.scala
index 9c9626c8d6..5d6198fe96 100644
--- a/src/actors/scala/actors/ActorProxy.scala
+++ b/src/actors/scala/actors/ActorProxy.scala
@@ -1,7 +1,7 @@
/* __ *\
** ________ ___ / / ___ Scala API **
** / __/ __// _ | / / / _ | (c) 2005-2007, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
@@ -15,7 +15,7 @@ package scala.actors
import java.lang.Thread
/**
- * The class <code>ActorProxy</code>provides a dynamic actor proxy for normal
+ * The class <code>ActorProxy</code> provides a dynamic actor proxy for normal
* Java threads.
*
* @version 0.9.6
diff --git a/src/actors/scala/actors/Channel.scala b/src/actors/scala/actors/Channel.scala
index 51b1c30a21..52386c9b70 100644
--- a/src/actors/scala/actors/Channel.scala
+++ b/src/actors/scala/actors/Channel.scala
@@ -1,7 +1,7 @@
/* __ *\
** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2005-2006, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | **
+** / __/ __// _ | / / / _ | (c) 2005-2007, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
@@ -20,8 +20,8 @@ package scala.actors
* The following example demonstrates its usage:
* </p><pre>
* receive {
- * case Chan1 ! msg1 => ...
- * case Chan2 ! msg2 => ...
+ * <b>case</b> Chan1 ! msg1 => ...
+ * <b>case</b> Chan2 ! msg2 => ...
* }
* </pre>
*
@@ -55,7 +55,7 @@ class Channel[Msg] extends InputChannel[Msg] with OutputChannel[Msg] {
*
* @param msg the message to be sent
*/
- def !(msg: Msg): unit = {
+ def !(msg: Msg) {
receiver ! scala.actors.!(this, msg)
}
@@ -63,7 +63,7 @@ class Channel[Msg] extends InputChannel[Msg] with OutputChannel[Msg] {
* Forwards <code>msg</code> to <code>this</code> keeping the
* last sender as sender instead of <code>self</code>.
*/
- def forward(msg: Msg): unit = {
+ def forward(msg: Msg) {
receiver forward scala.actors.!(this, msg)
}
diff --git a/src/actors/scala/actors/Future.scala b/src/actors/scala/actors/Future.scala
index 3cbe9507ef..66f6e7d163 100644
--- a/src/actors/scala/actors/Future.scala
+++ b/src/actors/scala/actors/Future.scala
@@ -11,14 +11,18 @@
package scala.actors
/**
- * A Future is a function of arity 0 that returns a value of type Any.
- * Applying a future blocks the current actor until its value
- * is available.
- * A future can be queried to find out whether its value
- * is already available.
+ * <p>
+ * A Future is a function of arity 0 that returns a value of type Any.
+ * Applying a future blocks the current actor until its value
+ * is available.
+ * </p>
+ * <p>
+ * A future can be queried to find out whether its value
+ * is already available.
+ * </p>
*
- * @version 0.9.6
* @author Philipp Haller
+ * @version 0.9.6
*/
abstract class Future[T](val ch: InputChannel[Any]) extends Function0[T] {
protected var value: Option[T] = None
@@ -26,7 +30,7 @@ abstract class Future[T](val ch: InputChannel[Any]) extends Function0[T] {
}
/**
- * The Futures object contains methods that operate on Futures.
+ * The <code>Futures</code> object contains methods that operate on Futures.
*
* @version 0.9.6
* @author Philipp Haller
@@ -58,9 +62,13 @@ object Futures {
}
/**
- * Awaits all futures returning an option containing a list of replies,
- * or timeouts returning None.
- * Note that some of the futures might already have been awaited.
+ * <p>
+ * Awaits all futures returning an option containing a list of replies,
+ * or timeouts returning <code>None</code>.
+ * </p>
+ * <p>
+ * Note that some of the futures might already have been awaited.
+ * </p>
*/
def awaitAll(timeout: long, fts: Future[Any]*): List[Option[Any]] = {
var resultsMap: collection.mutable.Map[Int, Option[Any]] = new collection.mutable.HashMap[Int, Option[Any]]
diff --git a/src/actors/scala/actors/Reaction.scala b/src/actors/scala/actors/Reaction.scala
index f5d67bc1e1..a6eaa18833 100644
--- a/src/actors/scala/actors/Reaction.scala
+++ b/src/actors/scala/actors/Reaction.scala
@@ -19,18 +19,20 @@ import java.lang.{InterruptedException, Runnable}
* return type <code>Nothing</code>.
* </p>
*
- * @version 0.9.6
- * @author Philipp Haller
+ * @version 0.9.6
+ * @author Philipp Haller
*/
private[actors] class ExitActorException extends Throwable
-/**
- * The abstract class <code>Reaction</code> associates
- * an instance of an <code>Actor</code> with a
- * <code>java.lang.Runnable</code>.
+/** <p>
+ * The abstract class <code>Reaction</code> associates
+ * an instance of an <code>Actor</code> with a
+ * <a class="java/lang/Runnable" href="" target="contentFrame">
+ * <code>java.lang.Runnable</code></a>.
+ * </p>
*
- * @version 0.9.6
- * @author Philipp Haller
+ * @version 0.9.6
+ * @author Philipp Haller
*/
private[actors] class Reaction(a: Actor,
f: PartialFunction[Any, Unit],
@@ -39,7 +41,7 @@ private[actors] class Reaction(a: Actor,
def actor = a
- def run(): Unit = {
+ def run() {
val saved = Actor.tl.get.asInstanceOf[Actor]
Actor.tl.set(a)
Scheduler.unPendReaction
diff --git a/src/actors/scala/actors/remote/RemoteActor.scala b/src/actors/scala/actors/remote/RemoteActor.scala
index 81c9cea3d0..b30e363b46 100644
--- a/src/actors/scala/actors/remote/RemoteActor.scala
+++ b/src/actors/scala/actors/remote/RemoteActor.scala
@@ -1,7 +1,7 @@
/* __ *\
** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2005-2006, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | **
+** / __/ __// _ | / / / _ | (c) 2005-2007, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
@@ -12,32 +12,33 @@
package scala.actors.remote
-/**
- This object provides methods for creating, registering, and
- selecting remotely accessible actors.
-
- A remote actor is typically created like this:
- <pre>
- actor {
- alive(9010)
- register('myName, self)
-
- // behavior
- }
- </pre>
-
- It can be accessed by an actor running on a (possibly)
- different node by selecting it in the following way:
- <pre>
- actor {
- // ...
- <b>val</b> c = select(TcpNode("127.0.0.1", 9010), 'myName)
- c ! msg
- // ...
- }
- </pre>
-
- @author Philipp Haller
+/** <p>
+ * This object provides methods for creating, registering, and
+ * selecting remotely accessible actors.
+ * </p>
+ * <p>
+ * A remote actor is typically created like this:
+ * </p><pre>
+ * actor {
+ * alive(9010)
+ * register('myName, self)
+ *
+ * // behavior
+ * }
+ * </pre>
+ * <p>
+ * It can be accessed by an actor running on a (possibly)
+ * different node by selecting it in the following way:
+ * </p><pre>
+ * actor {
+ * // ...
+ * <b>val</b> c = select(TcpNode("127.0.0.1", 9010), 'myName)
+ * c ! msg
+ * // ...
+ * }
+ * </pre>
+ *
+ * @author Philipp Haller
*/
object RemoteActor {
@@ -47,7 +48,7 @@ object RemoteActor {
* Makes <code>self</code> remotely accessible on TCP port
* <code>port</code>.
*/
- def alive(port: int): Unit = {
+ def alive(port: int) {
val serv = new TcpService(port)
serv.start()
kernels += Actor.self -> serv.kernel
@@ -57,15 +58,15 @@ object RemoteActor {
* Registers <code>a</code> under <code>name</code> on this
* node.
*/
- def register(name: Symbol, a: Actor): Unit = {
+ def register(name: Symbol, a: Actor) {
val kernel = kernels.get(Actor.self) match {
- case None => {
+ case None =>
val serv = new TcpService(TcpService.generatePort)
serv.start()
kernels += Actor.self -> serv.kernel
serv.kernel
- }
- case Some(k) => k
+ case Some(k) =>
+ k
}
kernel.register(name, a)
}
@@ -76,22 +77,22 @@ object RemoteActor {
*/
def select(node: Node, sym: Symbol): Actor =
new Actor {
- def act(): Unit = {}
+ def act() {}
override def !(msg: Any): Unit = msg match {
- case a: AnyRef => {
+ case a: AnyRef =>
// establish remotely accessible
// return path (sender)
val kernel = kernels.get(Actor.self) match {
- case None => {
+ case None =>
val serv = new TcpService(TcpService.generatePort)
serv.start()
kernels += Actor.self -> serv.kernel
serv.kernel
- }
- case Some(k) => k
+ case Some(k) =>
+ k
}
kernel.send(node, sym, a)
- }
+
case other =>
error("Cannot send non-AnyRef value remotely.")
}
diff --git a/src/compiler/scala/tools/nsc/doc/ModelToXML.scala b/src/compiler/scala/tools/nsc/doc/ModelToXML.scala
index 3b39bc9a85..85e6e117a6 100644
--- a/src/compiler/scala/tools/nsc/doc/ModelToXML.scala
+++ b/src/compiler/scala/tools/nsc/doc/ModelToXML.scala
@@ -88,7 +88,7 @@ trait ModelToXML extends ModelExtractor {
}
def extendsFor(entity: Entity)(implicit frame: Frame): NodeSeq = {
- if (entity.parents.isEmpty) NodeSeq.Empty;
+ if (entity.parents.isEmpty) NodeSeq.Empty
else <code> extends </code>++
entity.parents.mkXML(Text(""), <code> with </code>, Text(""))(link);
}
@@ -122,18 +122,26 @@ trait ModelToXML extends ModelExtractor {
case _ => NodeSeq.Empty
}) ++ {
val overridden = entity.overridden
- if (!overridden.isEmpty) {
- var seq : NodeSeq = Text("Overrides ");
- seq = seq ++ overridden.mkXML("",", ", "")(sym => link(decode(sym.owner)) ++ Text(".") ++ link(sym));
- seq
- } else NodeSeq.Empty;
+ if (overridden.isEmpty)
+ NodeSeq.Empty
+ else {
+ <dl>
+ <dt style="margin:10px 0 0 20px;">
+ <b>Overrides</b>
+ </dt>
+ <dd>
+ { overridden.mkXML("",", ", "")(sym => link(decode(sym.owner)) ++ Text(".") ++ link(sym))
+ }
+ </dd>
+ </dl>
+ }
} ++ <hr/>);
def longComment(cmnt: Comment): NodeSeq = {
val attrs = <dl>{
var seq: NodeSeq = NodeSeq.Empty
cmnt.decodeAttributes.foreach{
- case (tag,xs) =>
+ case (tag, xs) =>
seq = seq ++ <dt style="margin:10px 0 0 20px;">
<b>{decodeTag(tag)}</b></dt> ++ {xs.flatMap{
case (option,body) => <dd>{
@@ -142,7 +150,7 @@ trait ModelToXML extends ModelExtractor {
}{parse(body)}</dd>
}}
};
- seq;
+ seq
}</dl>;
<xml:group>
<dl><dd>{parse(cmnt.body)}</dd></dl>
diff --git a/src/compiler/scala/tools/nsc/transform/Constructors.scala b/src/compiler/scala/tools/nsc/transform/Constructors.scala
index c458e9a089..72df84c9b3 100644
--- a/src/compiler/scala/tools/nsc/transform/Constructors.scala
+++ b/src/compiler/scala/tools/nsc/transform/Constructors.scala
@@ -1,5 +1,5 @@
/* NSC -- new Scala compiler
- * Copyright 2005-2006 LAMP/EPFL
+ * Copyright 2005-2007 LAMP/EPFL
* @author
*/
// $Id$
@@ -31,7 +31,7 @@ abstract class Constructors extends Transform {
var constrParams: List[Symbol] = null
var constrBody: Block = null
// decompose primary constructor into the three entities above.
- for (val stat <- stats) {
+ for (stat <- stats) {
stat match {
case ddef @ DefDef(_, _, _, List(vparams), _, rhs @ Block(_, Literal(_))) =>
if (ddef.symbol.isPrimaryConstructor) {
@@ -101,7 +101,7 @@ abstract class Constructors extends Transform {
localTyper.typed {
Assign(Select(This(clazz), to), from)
}
- }
+ }
def copyParam(to: Symbol, from: Symbol): Tree = {
var result = mkAssign(to, Ident(from))
@@ -121,7 +121,7 @@ abstract class Constructors extends Transform {
val constrStatBuf = new ListBuffer[Tree]
val constrPrefixBuf = new ListBuffer[Tree]
val presupers = treeInfo.preSuperFields(stats)
- for (val stat <- constrBody.stats) {
+ for (stat <- constrBody.stats) {
constrStatBuf += stat
stat match {
case ValDef(mods, name, _, _) if (mods hasFlag PRESUPER) =>
@@ -140,7 +140,7 @@ abstract class Constructors extends Transform {
}
}
- for (val stat <- stats) stat match {
+ for (stat <- stats) stat match {
case DefDef(mods, name, tparams, vparamss, tpt, rhs) =>
stat.symbol.tpe match {
case MethodType(List(), tp @ ConstantType(c)) =>
@@ -186,9 +186,9 @@ abstract class Constructors extends Transform {
}
}
- for (val stat <- defBuf.elements) accessTraverser.traverse(stat);
+ for (stat <- defBuf.elements) accessTraverser.traverse(stat)
- val paramInits = for (val acc <- paramAccessors; isAccessed(acc))
+ val paramInits = for (acc <- paramAccessors if isAccessed(acc))
yield copyParam(acc, parameter(acc))
defBuf += copy.DefDef(
@@ -198,7 +198,7 @@ abstract class Constructors extends Transform {
paramInits ::: constrPrefixBuf.toList ::: constrStatBuf.toList,
constrBody.expr));
- for (val sym <- clazz.info.decls.toList)
+ for (sym <- clazz.info.decls.toList)
if (!isAccessed(sym)) clazz.info.decls unlink sym
copy.Template(impl, impl.parents, defBuf.toList filter (stat => isAccessed(stat.symbol)))
diff --git a/src/library/scala/Enumeration.scala b/src/library/scala/Enumeration.scala
index d377f72890..81d956c647 100644
--- a/src/library/scala/Enumeration.scala
+++ b/src/library/scala/Enumeration.scala
@@ -1,7 +1,7 @@
/* __ *\
** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2002-2006, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | **
+** / __/ __// _ | / / / _ | (c) 2002-2007, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
@@ -14,35 +14,43 @@ package scala
import scala.collection.mutable.{Map, HashMap}
-/** <p>Defines a finite set of values specific to the enumeration. Typically
- * these values enumerate all possible forms something can take and provide a
- * lightweight alternative to case classes.</p>
- * <p>Each call to a <code>Value</code> method adds a new unique value to the
- * enumeration. To be accessible, these values are usually defined as
- * <code>val</code> members of the evaluation</p>
- * <p>All values in an enumeration share a common, unique type defined as the
- * <code>Value</code> type member of the enumeration (<code>Value</code>
- * selected on the stable identifier path of the enumeration instance).</p>
- * <p><b>Example use</b></p>
- * <pre>
- * <b>object</b> Main <b>extends</b> Application {
- *
- * <b>object</b> WeekDays <b>extends</b> Enumeration {
- * <b>val</b> Mon, Tue, Wed, Thu, Fri, Sat, Sun = Value
- * }
- *
- * <b>def</b> isWorkingDay(d: WeekDays.Value) =
- * ! (d == WeekDays.Sat || d == WeekDays.Sun)
- *
- * WeekDays filter (isWorkingDay) foreach { d =&gt; Console.println(d) }
- * }</pre>
- *
- * @param initial The initial value from which to count the integers that
- * identifies values at run-time.
- * @param names The sequence of names to give to this enumeration's values.
- *
- * @author Matthias Zenger
- * @version 1.0, 10/02/04 */
+/** <p>
+ * Defines a finite set of values specific to the enumeration. Typically
+ * these values enumerate all possible forms something can take and provide a
+ * lightweight alternative to case classes.
+ * </p>
+ * <p>
+ * Each call to a <code>Value</code> method adds a new unique value to the
+ * enumeration. To be accessible, these values are usually defined as
+ * <code>val</code> members of the evaluation.
+ * </p>
+ * <p>
+ * All values in an enumeration share a common, unique type defined as the
+ * <code>Value</code> type member of the enumeration (<code>Value</code>
+ * selected on the stable identifier path of the enumeration instance).
+ * </p>
+ * <p>
+ * <b>Example use</b>
+ * </p><pre>
+ * <b>object</b> Main <b>extends</b> Application {
+ *
+ * <b>object</b> WeekDays <b>extends</b> Enumeration {
+ * <b>val</b> Mon, Tue, Wed, Thu, Fri, Sat, Sun = Value
+ * }
+ *
+ * <b>def</b> isWorkingDay(d: WeekDays.Value) =
+ * ! (d == WeekDays.Sat || d == WeekDays.Sun)
+ *
+ * WeekDays filter (isWorkingDay) foreach { d =&gt; Console.println(d) }
+ * }</pre>
+ *
+ * @param initial The initial value from which to count the integers that
+ * identifies values at run-time.
+ * @param names The sequence of names to give to this enumeration's values.
+ *
+ * @author Matthias Zenger
+ * @version 1.0, 10/02/04
+ */
abstract class Enumeration(initial: Int, names: String*) {
def this() = this(0, null)
@@ -124,21 +132,29 @@ abstract class Enumeration(initial: Int, names: String*) {
new Val(nextId, if (nextName.hasNext) nextName.next else null)
/** Creates a fresh value, part of this enumeration, identified by the integer
- * <code>i</code>.
- * @param i An integer that identifies this value at run-time. It must be
- * unique amongst all values of the enumeration. */
+ * <code>i</code>.
+ *
+ * @param i An integer that identifies this value at run-time. It must be
+ * unique amongst all values of the enumeration.
+ * @return ..
+ */
protected final def Value(i: Int): Value =
new Val(i, if (nextName.hasNext) nextName.next else null)
/** Creates a fresh value, part of this enumeration, called <code>name</code>.
- * @param name A human-readable name for that value. */
+ *
+ * @param name A human-readable name for that value.
+ */
protected final def Value(name: String): Value = new Val(nextId, name)
/** Creates a fresh value, part of this enumeration, called <code>name</code>
- * and identified by the integer <code>i</code>.
- * @param i An integer that identifies this value at run-time. It must be
- * unique amongst all values of the enumeration.
- * @param name A human-readable name for that value. */
+ * and identified by the integer <code>i</code>.
+ *
+ * @param i An integer that identifies this value at run-time. It must be
+ * unique amongst all values of the enumeration.
+ * @param name A human-readable name for that value.
+ * @return ..
+ */
protected final def Value(i: Int, name: String): Value = new Val(i, name)
/** The type of the enumerated values. */
@@ -149,21 +165,24 @@ abstract class Enumeration(initial: Int, names: String*) {
/** this enumeration value as an <code>Int</code> bit mask.
* @throws IllegalArgumentException if <code>id</code> is greater than 31
*/
- def mask32 : Int = {
+ def mask32: Int = {
if (id >= 32) throw new IllegalArgumentException
1 << id
}
/** this enumeration value as an <code>Long</code> bit mask.
* @throws IllegalArgumentException if <code>id</code> is greater than 63
*/
- def mask64 : Long = {
+ def mask64: Long = {
if (id >= 64) throw new IllegalArgumentException
1L << id
}
}
- /** A class implementing the Value type. This class can be overriden to
- * change the enumeration's naming and integer identification behaviour. */
+ /** A class implementing the <a href="Enumeration.Value.html"
+ * target="contentFrame"><code>Value</code></a> type. This class can be
+ * overriden to change the enumeration's naming and integer identification
+ * behaviour.
+ */
protected class Val(i: Int, name: String) extends Value {
def this(i: Int) =
this(i, if (nextName.hasNext) nextName.next else i.toString())
@@ -182,63 +201,71 @@ abstract class Enumeration(initial: Int, names: String*) {
}
/** A set that efficiently stores enumeration values as bits.
+ *
* @author Sean McDirmid
*
* @ex
*
-<code>
-object flags extends Enumeration {
- val Public = Value(5, "public");
- val Private = Value(4, "private");
- val Protected = Value(6, "protected");
- val Final = Value(7, "final");
-}
-
-class Entity {
- var flags0 : Int = ...;
- def flags = flags.Set32(flags0);
-}
-
-val e : Entity = ...;
-
-if (e.flags.contains(flags.Private))
- e.flags0 = (e.flags | flags.Final).underlying;
-</code>
+ * <pre>
+ * <b>object</b> flags <b>extends</b> Enumeration {
+ * <b>val</b> Public = Value(5, "public");
+ * <b>val</b> Private = Value(4, "private");
+ * <b>val</b> Protected = Value(6, "protected");
+ * <b>val</b> Final = Value(7, "final");
+ * }
+ *
+ * <b>class</b> Entity {
+ * <b>var</b> flags0 : Int = ...;
+ * <b>def</b> flags = flags.Set32(flags0);
+ * }
+ *
+ * <b>val</b> e : Entity = ...;
+ *
+ * <b>if</b> (e.flags.contains(flags.Private))
+ * e.flags0 = (e.flags | flags.Final).underlying;
+ * </pre>
*/
abstract class SetXX extends collection.immutable.Set[Value] {
+
/** either Int or Long */
type Underlying <: AnyVal
type TSet <: SetXX
+
/** The integer that bit-encodes a set of enumeration values.
*/
- val underlying : Underlying
+ val underlying: Underlying
+
/** returns the underlying integer representation of this set as a long. */
- protected def underlyingAsLong : Long
+ protected def underlyingAsLong: Long
+
/** Equivalent to <code>++</code> for bit sets. Returns a set
* that has all values in <code>this</code> and <code>set</code>.
*/
- def |(set : TSet) : TSet
+ def |(set: TSet): TSet
+
/** Equivalent to <code>+</code> for bit sets. Returns a set
* that has all values in <code>this</code> with the addition of <code>value</code>.
*/
- def |(value : Value) : TSet
+ def |(value: Value): TSet
+
/** Equivalent to <code>**</code> for bit sets.
* Returns a bit set that has all values that are both in <code>this</code> and <code>set</code>.
*/
- def &(set : TSet) : TSet
+ def &(set: TSet): TSet
+
/** Equivalent to <code>-</code> for bit sets.
* Returns a bit set that has all values in <code>this</code> except for <code>value</code>.
*/
- def &~(value : Value) : TSet
- def -(value : Value) : TSet = this &~ value
- def +(value : Value) : TSet = this | value
- def ++(set : TSet) : TSet = this | set
- def **(set : TSet) : TSet = this & set
+ def &~(value: Value): TSet
+ def -(value: Value): TSet = this &~ value
+ def +(value: Value): TSet = this | value
+ def ++(set: TSet): TSet = this | set
+ def **(set: TSet): TSet = this & set
def size = {
var x = underlyingAsLong
var sz = 0
while (x != 0) {
- if ((x & 1) != 0) sz = sz + 1
+ if ((x & 1) != 0) sz += 1
x = x >> 1
}
sz
@@ -250,7 +277,7 @@ if (e.flags.contains(flags.Private))
def hasNext = underlying != 0
private def shift = {
underlying = underlying >> 1
- bit = bit + 1
+ bit += 1
}
def next = {
if (underlying == 0) throw new NoSuchElementException
@@ -262,7 +289,9 @@ if (e.flags.contains(flags.Private))
}
def empty[B]: scala.collection.immutable.Set[B] = new scala.collection.immutable.HashSet[B];
}
- /** An enumeration bit set that can handle enumeration values with ids up to 31 in an <code>Int</code>.
+
+ /** An enumeration bit set that can handle enumeration values with ids up
+ * to 31 in an <code>Int</code>.
*/
class Set32(val underlying : Int) extends SetXX {
def this() = this(0)
@@ -282,11 +311,15 @@ if (e.flags.contains(flags.Private))
def &~(value : Value) = new Set32(underlying & (~value.mask32))
def &(set : Set32) = new Set32(underlying & set.underlying)
}
+
/** create an empty 32 bit enumeration set */
def Set32 = new Set32
+
/** create a bit enumeration set according ot underlying */
def Set32(underlying : Int) = new Set32(underlying)
- /** An enumeration bit set that can handle enumeration values with ids up to 63 in a <code>Long</code>.
+
+ /** An enumeration bit set that can handle enumeration values with ids up
+ * to 63 in a <code>Long</code>.
*/
class Set64(val underlying : Long) extends SetXX {
def this() = this(0)
@@ -299,18 +332,21 @@ if (e.flags.contains(flags.Private))
def &~(value : Value) = new Set64(underlying & (~value.mask64))
def &(set : Set64) = new Set64(underlying & set.underlying)
}
+
/** create an empty 64 bit enumeration set */
def Set64 = new Set64
+
/** create a bit enumeration set according ot underlying */
- def Set64(underlying : Long) = new Set64(underlying)
+ def Set64(underlying: Long) = new Set64(underlying)
+
/** used to reverse engineer bit locations from pre-defined bit masks */
- def maskToBit(n : Long) = {
+ def maskToBit(n: Long) = {
assert(n != 0)
var bit = 0
var m = n
while ((m & 1) != 1) {
m = m >> 1
- bit = bit + 1
+ bit += 1
}
assert(m == 1)
bit
diff --git a/src/library/scala/concurrent/Process.scala b/src/library/scala/concurrent/Process.scala
index 22397684ce..1804c3a984 100644
--- a/src/library/scala/concurrent/Process.scala
+++ b/src/library/scala/concurrent/Process.scala
@@ -16,7 +16,8 @@ package scala.concurrent
*
* @author Erik Stenman
* @version 1.0, 01/10/2003
- * @deprecated use scala.actors package instead
+ *
+ * @deprecated use <a href="../actors$content.html">scala.actors</a> package instead
*/
@deprecated
object Process {
@@ -87,7 +88,7 @@ class Process(body: => Unit) extends Actor() {
//def self = this
- def exit(reason: AnyRef): Unit = {
+ def exit(reason: AnyRef) {
exitReason = reason
interrupt()
}
diff --git a/src/library/scala/unsealed.scala b/src/library/scala/unsealed.scala
index ff59000579..66c59d287a 100644
--- a/src/library/scala/unsealed.scala
+++ b/src/library/scala/unsealed.scala
@@ -11,6 +11,7 @@
package scala
-/** @deprecated use @unchecked instead
+/** @deprecated use <a href="unchecked.html">
+ * <code>@unchecked</code></a> instead.
*/
-@deprecated class unsealed extends Annotation {}
+@deprecated class unsealed extends Annotation
diff --git a/src/library/scala/xml/HasKeyValue.scala b/src/library/scala/xml/HasKeyValue.scala
index 563fc2b7f8..e92fa0d9ae 100644
--- a/src/library/scala/xml/HasKeyValue.scala
+++ b/src/library/scala/xml/HasKeyValue.scala
@@ -1,15 +1,27 @@
+/* __ *\
+** ________ ___ / / ___ Scala API **
+** / __/ __// _ | / / / _ | (c) 2003-2007, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
+** /____/\___/_/ |_/____/_/ | | **
+** |/ **
+\* */
+
+// $Id$
+
package scala.xml
// $Id$
-/** use this class to match on (unprefixed) attribute values
- * <p>
- val hasName = new HasKeyValue("name")
- node match {
- case Node("foo", hasName(x), _*) => x // foo had attribute with key "name" and with value x
- }
+/** <p>
+ * Use this class to match on (unprefixed) attribute values
+ * <p><pre>
+ * <b>val</b> hasName = <b>new</b> HasKeyValue("name")
+ * node <b>match</b> {
+ * <b>case</b> Node("foo", hasName(x), _*) => x // foo had attribute with key "name" and with value x
+ * }</pre>
+ *
+ * @author Burak Emir
*/
class HasKeyValue(key: String) {
- def unapplySeq(x:MetaData): Option[Seq[Node]] = x.get(key)
+ def unapplySeq(x: MetaData): Option[Seq[Node]] = x.get(key)
}
-
diff --git a/src/library/scala/xml/MalformedAttributeException.scala b/src/library/scala/xml/MalformedAttributeException.scala
index 0437006583..9dd4c2cf6e 100644
--- a/src/library/scala/xml/MalformedAttributeException.scala
+++ b/src/library/scala/xml/MalformedAttributeException.scala
@@ -1,7 +1,7 @@
/* __ *\
** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2003-2006, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | **
+** / __/ __// _ | / / / _ | (c) 2003-2007, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
@@ -12,4 +12,4 @@
package scala.xml
-case class MalformedAttributeException(msg: String) extends java.lang.RuntimeException(msg)
+case class MalformedAttributeException(msg: String) extends RuntimeException(msg)
diff --git a/src/library/scala/xml/Node.scala b/src/library/scala/xml/Node.scala
index 1d424395b2..9a32667a79 100644
--- a/src/library/scala/xml/Node.scala
+++ b/src/library/scala/xml/Node.scala
@@ -1,7 +1,7 @@
/* __ *\
** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2003-2006, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | **
+** / __/ __// _ | / / / _ | (c) 2003-2007, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
@@ -11,8 +11,6 @@
package scala.xml
-import compat.StringBuilder
-
/**
* This object provides methods ...
*
@@ -27,7 +25,7 @@ object Node {
/** the empty namespace */
val EmptyNamespace = ""
- def unapplySeq(n:Node) = Some (Tuple3(n.label, n.attributes, n.child))
+ def unapplySeq(n: Node) = Some(Tuple3(n.label, n.attributes, n.child))
}
@@ -51,8 +49,9 @@ abstract class Node extends NodeSeq {
def typeTag$: Int = 0
/**
- * method returning the namespace bindings of this node. by default, this is TopScope,
- * which means there are no namespace bindings except the predefined one for "xml".
+ * method returning the namespace bindings of this node. by default, this
+ * is TopScope, which means there are no namespace bindings except the
+ * predefined one for "xml".
*/
def scope: NamespaceBinding = TopScope
@@ -90,11 +89,13 @@ abstract class Node extends NodeSeq {
* @return value of <code>PrefixedAttribute</code> with given namespace
* and given key, otherwise <code>null</code>.
*/
- final def attribute(uri: String, key: String): Option[Seq[Node]] = attributes.get(uri, this, key)
+ final def attribute(uri: String, key: String): Option[Seq[Node]] =
+ attributes.get(uri, this, key)
/**
- * Returns attribute meaning all attributes of this node, prefixed and unprefixed,
- * in no particular order. In class Node, this defaults to Null (the empty attribute list).
+ * Returns attribute meaning all attributes of this node, prefixed and
+ * unprefixed, in no particular order. In class <code>Node</code>, this
+ * defaults to <code>Null</code> (the empty attribute list).
*
* @return all attributes of this node
*/
@@ -137,14 +138,18 @@ abstract class Node extends NodeSeq {
case _ => false
}
- /**
- * Returns a hashcode. A standard implementation of hashcodes is obtained by calling
- * Utility.hashCode(pre, label, attributes.hashCode(), child);
- * Martin to Burak: to do: if you make this method abstract, the compiler will now
- * complain if there's no implementation in a subclass. Is this what we want? Note that
- * this would break doc/DocGenator and doc/ModelToXML, with an error message like:
-doc/ModelToXML.scala:95: error: object creation impossible, since there is a deferred declaration of method hashCode in class Node of type ()Int which is not implemented in a subclass
- new SpecialNode {
+ /** <p>
+ * Returns a hashcode. A standard implementation of hashcodes is obtained
+ * by calling <code>Utility.hashCode(pre, label, attributes.hashCode(), child)</code>.
+ * </p>
+ * <p>
+ * Martin to Burak: to do: if you make this method abstract, the compiler
+ * will now complain if there's no implementation in a subclass. Is this
+ * what we want? Note that this would break <code>doc/DocGenator</code> and
+ * doc/ModelToXML, with an error message like:
+ * </p><pre>
+ * doc/ModelToXML.scala:95: error: object creation impossible, since there is a deferred declaration of method hashCode in class Node of type ()Int which is not implemented in a subclass
+ * new SpecialNode {<pre>
*/
override def hashCode(): Int = super.hashCode
@@ -177,12 +182,12 @@ doc/ModelToXML.scala:95: error: object creation impossible, since there is a def
* @param sb ...
* @return ...
*/
- def nameToString(sb: StringBuilder): StringBuilder = {
+ def nameToString(sb: StringBuilder): StringBuilder = {
if (null != prefix) {
sb.append(prefix)
sb.append(':')
}
- sb.append(label);
+ sb.append(label)
}
/**
diff --git a/src/library/scala/xml/NodeBuffer.scala b/src/library/scala/xml/NodeBuffer.scala
index 0e7e1b665e..3e77ea126b 100644
--- a/src/library/scala/xml/NodeBuffer.scala
+++ b/src/library/scala/xml/NodeBuffer.scala
@@ -1,7 +1,7 @@
/* __ *\
** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2003-2006, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | **
+** / __/ __// _ | / / / _ | (c) 2003-2007, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
@@ -12,13 +12,16 @@
package scala.xml
/**
- * This class acts as a Buffer for nodes. If it is used as a sequence
- * of nodes <code>Seq[Node]</code>, it must be ensured that no updates
- * occur after that point, because <code>scala.xml.Node</code> is assumed
- * to be immutable.
- *
- * Despite this being a sequence, don't use it as key in a hashtable.
- * Calling the hashcode function will result in a runtime error.
+ * <p>
+ * This class acts as a Buffer for nodes. If it is used as a sequence
+ * of nodes <code>Seq[Node]</code>, it must be ensured that no updates
+ * occur after that point, because <code>scala.xml.Node</code> is assumed
+ * to be immutable.
+ * </p>
+ * <p>
+ * Despite this being a sequence, don't use it as key in a hashtable.
+ * Calling the hashcode function will result in a runtime error.
+ * </p>
*
* @author Burak Emir
* @version 1.0
@@ -31,7 +34,6 @@ class NodeBuffer extends scala.collection.mutable.ArrayBuffer[Node] {
* an Iterator or Iterable, its elements will be added. If o is a node, it is
* added as it is. If it is anything else, it gets wrapped in an Atom.
*
- *
* @param o converts to an xml node and adds to this node buffer
* @return this nodebuffer
*/
@@ -41,7 +43,7 @@ class NodeBuffer extends scala.collection.mutable.ArrayBuffer[Node] {
// ignore
case it:Iterator[_] =>
- while(it.hasNext)
+ while (it.hasNext)
this &+ it.next
case n:Node =>
diff --git a/src/library/scala/xml/SpecialNode.scala b/src/library/scala/xml/SpecialNode.scala
index 9fb23a64a3..0658ba3ee0 100644
--- a/src/library/scala/xml/SpecialNode.scala
+++ b/src/library/scala/xml/SpecialNode.scala
@@ -1,7 +1,7 @@
/* __ *\
** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2003-2006, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | **
+** / __/ __// _ | / / / _ | (c) 2003-2007, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
@@ -11,11 +11,14 @@
package scala.xml
-import compat.StringBuilder
-
-/** &lt;code&gt;SpecialNode&lt;/code&gt; is a special XML node which
- * represents either text (PCDATA), a comment, a PI, or an entity ref.
- * SpecialNodes also play the role of XMLEvents for pull-parsing.
+/** <p>
+ * <code>SpecialNode</code> is a special XML node which
+ * represents either text (PCDATA), a comment, a PI, or an entity ref.
+ * </p>
+ * <p>
+ * SpecialNodes also play the role of XMLEvents for pull-parsing.
+ * </p>
+ *
* @author Burak Emir
*/
abstract class SpecialNode extends Node with pull.XMLEvent {
diff --git a/src/library/scala/xml/Text.scala b/src/library/scala/xml/Text.scala
index 7170239611..f78150b205 100644
--- a/src/library/scala/xml/Text.scala
+++ b/src/library/scala/xml/Text.scala
@@ -1,7 +1,7 @@
/* __ *\
** ________ ___ / / ___ Scala API **
** / __/ __// _ | / / / _ | (c) 2003-2007, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
@@ -11,7 +11,6 @@
package scala.xml
-import compat.StringBuilder
/** The class <code>Text</code> implements an XML node for text (PCDATA).
* It is used in both non-bound and bound XML representations.
diff --git a/src/library/scala/xml/TypeSymbol.scala b/src/library/scala/xml/TypeSymbol.scala
index 4834139f92..3b44676333 100644
--- a/src/library/scala/xml/TypeSymbol.scala
+++ b/src/library/scala/xml/TypeSymbol.scala
@@ -1,7 +1,7 @@
/* __ *\
** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2002-2006, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | **
+** / __/ __// _ | / / / _ | (c) 2002-2007, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
@@ -9,7 +9,7 @@
// $Id$
-package scala.xml;
+package scala.xml
-abstract class TypeSymbol;
+abstract class TypeSymbol
diff --git a/src/library/scala/xml/Unparsed.scala b/src/library/scala/xml/Unparsed.scala
index c8fc2d5743..6bda932b89 100644
--- a/src/library/scala/xml/Unparsed.scala
+++ b/src/library/scala/xml/Unparsed.scala
@@ -1,7 +1,7 @@
/* __ *\
** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2003-2006, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | **
+** / __/ __// _ | / / / _ | (c) 2003-2007, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
@@ -11,10 +11,9 @@
package scala.xml
-import compat.StringBuilder
-
-/** an XML node for unparsed content. It will be output verbatim, all bets
- * are off regarding wellformedness etc.
+/** An XML node for unparsed content. It will be output verbatim, all bets
+ * are off regarding wellformedness etc.
+ *
* @author Burak Emir
* @param _data content in this node, may not be null.
*/
diff --git a/src/library/scala/xml/UnprefixedAttribute.scala b/src/library/scala/xml/UnprefixedAttribute.scala
index 4e4694fadb..e8790620de 100644
--- a/src/library/scala/xml/UnprefixedAttribute.scala
+++ b/src/library/scala/xml/UnprefixedAttribute.scala
@@ -11,14 +11,13 @@
package scala.xml
-import compat.StringBuilder
-
-/** unprefixed attributes have the null namespace, and no prefix field
+/** Unprefixed attributes have the null namespace, and no prefix field
*
+ * @author Burak Emir
*/
class UnprefixedAttribute(val key: String, val value: Seq[Node], next1: MetaData) extends MetaData {
- val next = if(value ne null) next1 else next1.remove(key)
+ val next = if (value ne null) next1 else next1.remove(key)
/** same as this(key, Utility.parseAttributeValue(value), next) */
def this(key: String, value: String, next: MetaData) =
@@ -28,7 +27,7 @@ class UnprefixedAttribute(val key: String, val value: Seq[Node], next1: MetaData
def copy(next: MetaData) =
new UnprefixedAttribute(key, value, next)
- def equals1(m:MetaData) =
+ def equals1(m: MetaData) =
!m.isPrefixed && (m.key == key) && (m.value sameElements value)
/** returns null */
@@ -63,8 +62,11 @@ class UnprefixedAttribute(val key: String, val value: Seq[Node], next1: MetaData
/** returns false */
final def isPrefixed = false
- /** appends string representation of only this attribute to stringbuffer */
- def toString1(sb:StringBuilder): Unit = if(value ne null) {
+ /** appends string representation of only this attribute to stringbuffer.
+ *
+ * @param sb ..
+ */
+ def toString1(sb: StringBuilder): Unit = if (value ne null) {
sb.append(key)
sb.append('=')
val sb2 = new StringBuilder()