3rd round of clean ups (see r25285, r25292)

git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@25293 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
This commit is contained in:
michelou 2011-07-15 20:20:47 +00:00
parent 9f6e8eeb14
commit 22c15143a5
73 changed files with 652 additions and 829 deletions

View File

@ -6,39 +6,35 @@
** |/ **
\* */
package scala.actors
import scala.util.control.ControlThrowable
import java.util.{Timer, TimerTask}
/**
* Provides functions for the definition of
* actors, as well as actor operations, such as
* <code>receive</code>, <code>react</code>, <code>reply</code>,
* etc.
* Provides functions for the definition of actors, as well as actor
* operations, such as `receive`, `react`, `reply`, etc.
*
* @author Philipp Haller
*/
object Actor extends Combinators {
/** State of an actor.
* <ul>
* <li><b>New</b> -
* Not yet started</li>
* <li><b>Runnable</b> -
* Executing</li>
* <li><b>Suspended</b> -
* Suspended, waiting in a `react`</li>
* <li><b>TimedSuspended</b> -
* Suspended, waiting in a `reactWithin` </li>
* <li><b>Blocked</b> -
* Blocked waiting in a `receive` </li>
* <li><b>TimedBlocked</b> -
* Blocked waiting in a `receiveWithin` </li>
* <li><b>Terminated</b> -
* Actor has terminated </li>
* </ul>
*
* - '''New''' -
* Not yet started
* - '''Runnable''' -
* Executing
* - '''Suspended''' -
* Suspended, waiting in a `react`
* - '''TimedSuspended''' -
* Suspended, waiting in a `reactWithin`
* - '''Blocked''' -
* Blocked waiting in a `receive`
* - '''TimedBlocked''' -
* Blocked waiting in a `receiveWithin`
* - '''Terminated''' -
* Actor has terminated
*/
object State extends Enumeration {
val New,
@ -59,8 +55,7 @@ object Actor extends Combinators {
/**
* Returns the currently executing actor. Should be used instead
* of <code>this</code> in all blocks of code executed by
* actors.
* of `'''this'''` in all blocks of code executed by actors.
*
* @return returns the currently executing actor.
*/
@ -89,11 +84,11 @@ object Actor extends Combinators {
/**
* Resets an actor proxy associated with the current thread.
* It replaces the implicit <code>ActorProxy</code> instance
* It replaces the implicit `ActorProxy` instance
* of the current thread (if any) with a new instance.
*
* This permits to re-use the current thread as an actor
* even if its <code>ActorProxy</code> has died for some reason.
* even if its `ActorProxy` has died for some reason.
*/
def resetProxy() {
val a = tl.get
@ -102,16 +97,15 @@ object Actor extends Combinators {
}
/**
* Removes any reference to an <code>Actor</code> instance
* Removes any reference to an `Actor` instance
* currently stored in thread-local storage.
*
* This allows to release references from threads that are
* potentially long-running or being re-used (e.g. inside
* a thread pool). Permanent references in thread-local storage
* are a potential memory leak.
* This allows to release references from threads that are potentially
* long-running or being re-used (e.g. inside a thread pool). Permanent
* references in thread-local storage are a potential memory leak.
*/
def clearSelf() {
tl.set(null)
tl set null
}
/**
@ -168,15 +162,13 @@ object Actor extends Combinators {
}
/**
* Receives the next message from the mailbox of the current actor
* <code>self</code>.
* Receives the next message from the mailbox of the current actor `self`.
*/
def ? : Any = self.?
/**
* Receives a message from the mailbox of
* <code>self</code>. Blocks if no message matching any of the
* cases of <code>f</code> can be received.
* Receives a message from the mailbox of `self`. Blocks if no message
* matching any of the cases of `f` can be received.
*
* @example {{{
* receive {
@ -193,12 +185,10 @@ object Actor extends Combinators {
self.receive(f)
/**
* Receives a message from the mailbox of
* <code>self</code>. Blocks at most <code>msec</code>
* milliseconds if no message matching any of the cases of
* <code>f</code> can be received. If no message could be
* received the <code>TIMEOUT</code> action is executed if
* specified.
* Receives a message from the mailbox of `self`. Blocks at most `msec`
* milliseconds if no message matching any of the cases of `f` can be
* received. If no message could be received the `TIMEOUT` action is
* executed if specified.
*
* @param msec the time span before timeout
* @param f a partial function specifying patterns and actions
@ -208,11 +198,10 @@ object Actor extends Combinators {
self.receiveWithin(msec)(f)
/**
* Lightweight variant of <code>receive</code>.
* Lightweight variant of `receive`.
*
* Actions in <code>f</code> have to contain the rest of the
* computation of <code>self</code>, as this method will never
* return.
* Actions in `f` have to contain the rest of the computation of `self`,
* as this method will never return.
*
* A common method of continuting the computation is to send a message
* to another actor:
@ -241,11 +230,10 @@ object Actor extends Combinators {
rawSelf.react(f)
/**
* Lightweight variant of <code>receiveWithin</code>.
* Lightweight variant of `receiveWithin`.
*
* Actions in <code>f</code> have to contain the rest of the
* computation of <code>self</code>, as this method will never
* return.
* Actions in `f` have to contain the rest of the computation of `self`,
* as this method will never return.
*
* @param msec the time span before timeout
* @param f a partial function specifying patterns and actions
@ -274,23 +262,21 @@ object Actor extends Combinators {
rawSelf.sender
/**
* Sends <code>msg</code> to the actor waiting in a call to
* <code>!?</code>.
* Sends `msg` to the actor waiting in a call to `!?`.
*/
def reply(msg: Any): Unit =
rawSelf.reply(msg)
/**
* Sends <code>()</code> to the actor waiting in a call to
* <code>!?</code>.
* Sends `()` to the actor waiting in a call to `!?`.
*/
def reply(): Unit =
rawSelf.reply(())
/**
* Returns the number of messages in <code>self</code>'s mailbox
* Returns the number of messages in `self`'s mailbox
*
* @return the number of messages in <code>self</code>'s mailbox
* @return the number of messages in `self`'s mailbox
*/
def mailboxSize: Int = rawSelf.mailboxSize
@ -321,7 +307,7 @@ object Actor extends Combinators {
}
/**
* Links <code>self</code> to actor <code>to</code>.
* Links `self` to actor `to`.
*
* @param to the actor to link to
* @return the parameter actor
@ -329,7 +315,7 @@ object Actor extends Combinators {
def link(to: AbstractActor): AbstractActor = self.link(to)
/**
* Links <code>self</code> to the actor defined by <code>body</code>.
* Links `self` to the actor defined by `body`.
*
* @param body the body of the actor to link to
* @return the parameter actor
@ -337,107 +323,78 @@ object Actor extends Combinators {
def link(body: => Unit): Actor = self.link(body)
/**
* Unlinks <code>self</code> from actor <code>from</code>.
* Unlinks `self` from actor `from`.
*
* @param from the actor to unlink from
*/
def unlink(from: AbstractActor): Unit = self.unlink(from)
/**
* <p>
* Terminates execution of <code>self</code> with the following
* effect on linked actors:
* </p>
* <p>
* For each linked actor <code>a</code> with
* <code>trapExit</code> set to <code>true</code>, send message
* <code>Exit(self, reason)</code> to <code>a</code>.
* </p>
* <p>
* For each linked actor <code>a</code> with
* <code>trapExit</code> set to <code>false</code> (default),
* call <code>a.exit(reason)</code> if
* <code>reason != 'normal</code>.
* </p>
* Terminates execution of `self` with the following effect on
* linked actors:
*
* For each linked actor `a` with `trapExit` set to `'''true'''`,
* send message `Exit(self, reason)` to `a`.
*
* For each linked actor `a` with `trapExit` set to `'''false'''`
* (default), call `a.exit(reason)` if `reason != 'normal`.
*/
def exit(reason: AnyRef): Nothing = self.exit(reason)
/**
* <p>
* Terminates execution of <code>self</code> with the following
* effect on linked actors:
* </p>
* <p>
* For each linked actor <code>a</code> with
* <code>trapExit</code> set to <code>true</code>, send message
* <code>Exit(self, 'normal)</code> to <code>a</code>.
* </p>
* Terminates execution of `self` with the following effect on
* linked actors:
*
* For each linked actor `a` with `trapExit` set to `'''true'''`,
* send message `Exit(self, 'normal)` to `a`.
*/
def exit(): Nothing = rawSelf.exit()
}
/**
* <p>
* Provides lightweight, concurrent actors. Actors are
* created by extending the `Actor` trait (alternatively, one of the
* factory methods in its companion object can be used). The
* behavior of an `Actor` subclass is defined by implementing its
* `act` method:
*
* {{{
* class MyActor extends Actor {
* def act() {
* // actor behavior goes here
* }
* }
* }}}
*
* A new `Actor` instance is started by invoking its `start` method.
*
* '''Note:''' care must be taken when invoking thread-blocking methods
* other than those provided by the `Actor` trait or its companion
* object (such as `receive`). Blocking the underlying thread inside
* an actor may lead to starvation of other actors. This also
* applies to actors hogging their thread for a long time between
* invoking `receive`/`react`.
*
* If actors use blocking operations (for example, methods for
* blocking I/O), there are several options:
* <ul>
* <li>The run-time system can be configured to use a larger thread pool size
* (for example, by setting the `actors.corePoolSize` JVM property).</li>
*
* <li>The `scheduler` method of the `Actor` trait can be overridden to return a
* `ResizableThreadPoolScheduler`, which resizes its thread pool to
* avoid starvation caused by actors that invoke arbitrary blocking methods.</li>
*
* <li>The `actors.enableForkJoin` JVM property can be set to `false`, in which
* case a `ResizableThreadPoolScheduler` is used by default to execute actors.</li>
* </ul>
* </p>
* <p>
* The main ideas of the implementation are explained in the two papers
* <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>,
* Philipp Haller and Martin Odersky, <i>Proc. JMLC 2006</i>, and
* </li>
* <li>
* <a href="http://lamp.epfl.ch/~phaller/doc/haller07coord.pdf">
* <span style="font-weight:bold; white-space:nowrap;">Actors that
* Unify Threads and Events</span></a>,
* Philipp Haller and Martin Odersky, <i>Proc. COORDINATION 2007</i>.
* </li>
* </ul>
* </p>
/** Provides lightweight, concurrent actors. Actors are created by extending
* the `Actor` trait (alternatively, one of the factory methods in its
* companion object can be used). The behavior of an `Actor` subclass is
* defined by implementing its `act` method:
* {{{
* class MyActor extends Actor {
* def act() {
* // actor behavior goes here
* }
* }
* }}}
* A new `Actor` instance is started by invoking its `start` method.
*
* @author Philipp Haller
* '''Note:''' care must be taken when invoking thread-blocking methods other
* than those provided by the `Actor` trait or its companion object (such as
* `receive`). Blocking the underlying thread inside an actor may lead to
* starvation of other actors. This also applies to actors hogging their
* thread for a long time between invoking `receive`/`react`.
*
* If actors use blocking operations (for example, methods for blocking I/O),
* there are several options:
*
* - The run-time system can be configured to use a larger thread pool size
* (for example, by setting the `actors.corePoolSize` JVM property).
* - The `scheduler` method of the `Actor` trait can be overridden to return a
* `ResizableThreadPoolScheduler`, which resizes its thread pool to
* avoid starvation caused by actors that invoke arbitrary blocking methods.
* - The `actors.enableForkJoin` JVM property can be set to `false`, in which
* case a `ResizableThreadPoolScheduler` is used by default to execute actors.
*
* The main ideas of the implementation are explained in the two papers
*
* - [[http://lampwww.epfl.ch/~odersky/papers/jmlc06.pdf Event-Based
* Programming without Inversion of Control]],
* Philipp Haller and Martin Odersky, ''Proc. JMLC 2006'', and
* - [[http://lamp.epfl.ch/~phaller/doc/haller07coord.pdf Actors that
* Unify Threads and Events]],
* Philipp Haller and Martin Odersky, ''Proc. COORDINATION 2007''.
*
* @author Philipp Haller
*
* @define actor actor
* @define channel actor's mailbox
* @define actor actor
* @define channel actor's mailbox
*/
@SerialVersionUID(-781154067877019505L)
trait Actor extends AbstractActor with ReplyReactor with ActorCanReply with InputChannel[Any] with Serializable {
@ -729,7 +686,7 @@ trait Actor extends AbstractActor with ReplyReactor with ActorCanReply with Inpu
private[actors] var links: List[AbstractActor] = Nil
/**
* Links <code>self</code> to actor <code>to</code>.
* Links `self` to actor `to`.
*
* @param to the actor to link to
* @return the parameter actor
@ -742,7 +699,7 @@ trait Actor extends AbstractActor with ReplyReactor with ActorCanReply with Inpu
}
/**
* Links <code>self</code> to the actor defined by <code>body</code>.
* Links `self` to the actor defined by `body`.
*
* @param body the body of the actor to link to
* @return the parameter actor
@ -763,7 +720,7 @@ trait Actor extends AbstractActor with ReplyReactor with ActorCanReply with Inpu
}
/**
* Unlinks <code>self</code> from actor <code>from</code>.
* Unlinks `self` from actor `from`.
*/
def unlink(from: AbstractActor) {
assert(Actor.self(scheduler) == this, "unlink called on actor different from self")
@ -783,21 +740,14 @@ trait Actor extends AbstractActor with ReplyReactor with ActorCanReply with Inpu
private[actors] var shouldExit = false
/**
* <p>
* Terminates execution of <code>self</code> with the following
* effect on linked actors:
* </p>
* <p>
* For each linked actor <code>a</code> with
* <code>trapExit</code> set to <code>true</code>, send message
* <code>Exit(self, reason)</code> to <code>a</code>.
* </p>
* <p>
* For each linked actor <code>a</code> with
* <code>trapExit</code> set to <code>false</code> (default),
* call <code>a.exit(reason)</code> if
* <code>reason != 'normal</code>.
* </p>
* Terminates execution of `self` with the following effect on
* linked actors:
*
* For each linked actor `a` with `trapExit` set to `'''true'''`,
* send message `Exit(self, reason)` to `a`.
*
* For each linked actor `a` with `trapExit` set to `'''false'''`
* (default), call `a.exit(reason)` if `reason != 'normal`.
*/
protected[actors] def exit(reason: AnyRef): Nothing = {
synchronized {
@ -807,7 +757,7 @@ trait Actor extends AbstractActor with ReplyReactor with ActorCanReply with Inpu
}
/**
* Terminates with exit reason <code>'normal</code>.
* Terminates with exit reason `'normal`.
*/
protected[actors] override def exit(): Nothing = {
val todo = synchronized {
@ -879,7 +829,7 @@ trait Actor extends AbstractActor with ReplyReactor with ActorCanReply with Inpu
}
}
/* Requires qualified private, because <code>RemoteActor</code> must
/** Requires qualified private, because `RemoteActor` must
* register a termination handler.
*/
private[actors] def onTerminate(f: => Unit) {
@ -907,9 +857,8 @@ trait Actor extends AbstractActor with ReplyReactor with ActorCanReply with Inpu
case object TIMEOUT
/** Sent to an actor
* with `trapExit` set to `true` whenever one of its linked actors
* terminates.
/** Sent to an actor with `trapExit` set to `'''true'''` whenever one of its
* linked actors terminates.
*
* @param from the actor that terminated
* @param reason the reason that caused the actor to terminate

View File

@ -12,8 +12,7 @@ package scala.actors
import java.lang.Thread
/**
* Provides a dynamic actor proxy for normal
* Java threads.
* Provides a dynamic actor proxy for normal Java threads.
*
* @author Philipp Haller
*/
@ -22,7 +21,7 @@ private[actors] class ActorProxy(t: Thread, override final val scheduler: ISched
def act() {}
/**
* Terminates with exit reason <code>'normal</code>.
* Terminates with exit reason `'normal`.
*/
override def exit(): Nothing = {
shouldExit = false

View File

@ -21,8 +21,7 @@ trait CanReply[-T, +R] {
type Future[+P] <: () => P
/**
* Sends <code>msg</code> to this $actor and
* awaits reply (synchronous).
* Sends `msg` to this $actor and awaits reply (synchronous).
*
* @param msg the message to be sent
* @return the reply
@ -30,20 +29,19 @@ trait CanReply[-T, +R] {
def !?(msg: T): R
/**
* Sends <code>msg</code> to this $actor and
* awaits reply (synchronous) within <code>msec</code>
* milliseconds.
* Sends `msg` to this $actor and awaits reply (synchronous) within
* `msec` milliseconds.
*
* @param msec the time span before timeout
* @param msg the message to be sent
* @return <code>None</code> in case of timeout, otherwise
* <code>Some(x)</code> where <code>x</code> is the reply
* @return `None` in case of timeout, otherwise
* `Some(x)` where `x` is the reply
*/
def !?(msec: Long, msg: T): Option[R]
/**
* Sends <code>msg</code> to this $actor and
* immediately returns a future representing the reply value.
* Sends `msg` to this $actor and immediately returns a future representing
* the reply value.
*
* @param msg the message to be sent
* @return the future
@ -51,11 +49,10 @@ trait CanReply[-T, +R] {
def !!(msg: T): Future[R]
/**
* Sends <code>msg</code> to this $actor and
* immediately returns a future representing the reply value.
* The reply is post-processed using the partial function
* <code>handler</code>. This also allows to recover a more
* precise type for the reply value.
* Sends `msg` to this $actor and immediately returns a future representing
* the reply value. The reply is post-processed using the partial function
* `handler`. This also allows to recover a more precise type for the reply
* value.
*
* @param msg the message to be sent
* @param handler the function to be applied to the response

View File

@ -6,15 +6,13 @@
** |/ **
\* */
package scala.actors
import scala.concurrent.SyncVar
/**
* Used to pattern match on values that were sent
* to some channel <code>Chan<sub>n</sub></code> by the current
* actor <code>self</code>.
* Used to pattern match on values that were sent to some channel `Chan,,n,,`
* by the current actor `self`.
*
* @example {{{
* receive {
@ -28,9 +26,8 @@ import scala.concurrent.SyncVar
case class ! [a](ch: Channel[a], msg: a)
/**
* Provides a means for typed communication among
* actors. Only the actor creating an instance of a
* <code>Channel</code> may receive from it.
* Provides a means for typed communication among actors. Only the
* actor creating an instance of a `Channel` may receive from it.
*
* @author Philipp Haller
*

View File

@ -10,13 +10,14 @@ package scala.actors
import scheduler.DaemonScheduler
/**
/**
* Base trait for actors with daemon semantics.
* Unlike a regular <code>Actor</code>, an active <code>DaemonActor</code> will
* not prevent an application terminating, much like a daemon thread.
*
* @author Erik Engbrecht
*/
trait DaemonActor extends Actor {
* Unlike a regular `Actor`, an active `DaemonActor` will not
* prevent an application terminating, much like a daemon thread.
*
* @author Erik Engbrecht
*/
trait DaemonActor extends Actor {
override def scheduler: IScheduler = DaemonScheduler
}

View File

@ -10,12 +10,10 @@
package scala.actors
/**
* A common interface
* for all schedulers used to execute actor tasks.
* A common interface for all schedulers used to execute actor tasks.
*
* Subclasses of <code>Actor</code> that override its
* <code>scheduler</code> member must provide
* an <code>IScheduler</code> implementation.
* Subclasses of `Actor` that override its `scheduler` member must provide
* an `IScheduler` implementation.
*
* @author Philipp Haller
*/
@ -27,7 +25,7 @@ trait IScheduler {
*/
def execute(fun: => Unit): Unit
/** Submits a <code>Runnable</code> for execution.
/** Submits a `Runnable` for execution.
*
* @param task the task to be executed
*/

View File

@ -6,12 +6,10 @@
** |/ **
\* */
package scala.actors
/**
* This class is used by our efficient message queue
* implementation.
* This class is used by our efficient message queue implementation.
*
* @author Philipp Haller
*/
@ -28,10 +26,9 @@ private[actors] class MQueueElement[Msg >: Null](val msg: Msg, val session: Outp
}
/**
* The class <code>MessageQueue</code> provides an efficient
* implementation of a message queue specialized for this actor
* library. Classes in this package are supposed to be the only
* clients of this class.
* The class `MessageQueue` provides an efficient implementation of a message
* queue specialized for this actor library. Classes in this package are
* supposed to be the only clients of this class.
*
* @author Philipp Haller
*/
@ -107,7 +104,7 @@ private[actors] class MQueue[Msg >: Null](protected val label: String) {
acc
}
/** Returns the n-th message that satisfies the predicate <code>p</code>
/** Returns the n-th message that satisfies the predicate `p`
* without removing it.
*/
def get(n: Int)(p: Msg => Boolean): Option[Msg] = {
@ -129,8 +126,8 @@ private[actors] class MQueue[Msg >: Null](protected val label: String) {
def remove(n: Int)(p: (Msg, OutputChannel[Any]) => Boolean): Option[(Msg, OutputChannel[Any])] =
removeInternal(n)(p) map (x => (x.msg, x.session))
/** Extracts the first message that satisfies the predicate <code>p</code>
* or <code>null</code> if <code>p</code> fails for all of them.
/** Extracts the first message that satisfies the predicate `p`
* or `'''null'''` if `p` fails for all of them.
*/
def extractFirst(p: (Msg, OutputChannel[Any]) => Boolean): MQueueElement[Msg] =
removeInternal(0)(p) orNull

View File

@ -6,7 +6,6 @@
** |/ **
\* */
package scala.actors
/**
@ -19,14 +18,14 @@ package scala.actors
trait OutputChannel[-Msg] {
/**
* Sends <code>msg</code> to this $actor (asynchronous).
* Sends `msg` to this $actor (asynchronous).
*
* @param msg the message to send
*/
def !(msg: Msg): Unit
/**
* Sends <code>msg</code> to this $actor (asynchronous) supplying
* Sends `msg` to this $actor (asynchronous) supplying
* explicit reply destination.
*
* @param msg the message to send
@ -35,14 +34,14 @@ trait OutputChannel[-Msg] {
def send(msg: Msg, replyTo: OutputChannel[Any]): Unit
/**
* Forwards <code>msg</code> to this $actor (asynchronous).
* Forwards `msg` to this $actor (asynchronous).
*
* @param msg the message to forward
*/
def forward(msg: Msg): Unit
/**
* Returns the <code>Actor</code> that is receiving from this $actor.
* Returns the `Actor` that is receiving from this $actor.
*/
def receiver: Actor
}

View File

@ -26,8 +26,8 @@ private[actors] class ReactChannel[Msg](receiver: ReplyReactor) extends InputCha
}
/**
* Sends a message to this <code>ReactChannel</code>
* (asynchronous) supplying explicit reply destination.
* Sends a message to this `ReactChannel` (asynchronous) supplying
* explicit reply destination.
*
* @param msg the message to send
* @param replyTo the reply destination
@ -37,17 +37,17 @@ private[actors] class ReactChannel[Msg](receiver: ReplyReactor) extends InputCha
}
/**
* Forwards <code>msg</code> to <code>this</code> keeping the
* last sender as sender instead of <code>self</code>.
* Forwards `msg` to `'''this'''` keeping the last sender as sender
* instead of `self`.
*/
def forward(msg: Msg) {
receiver forward SendToReactor(this, msg)
}
/**
* Receives a message from this <code>ReactChannel</code>.
* <p>
* This method never returns. Therefore, the rest of the computation
* Receives a message from this `ReactChannel`.
*
* This method ''never'' returns. Therefore, the rest of the computation
* has to be contained in the actions of the partial function.
*
* @param f a partial function with message patterns and actions
@ -61,10 +61,9 @@ private[actors] class ReactChannel[Msg](receiver: ReplyReactor) extends InputCha
}
/**
* Receives a message from this <code>ReactChannel</code> within
* a certain time span.
* <p>
* This method never returns. Therefore, the rest of the computation
* Receives a message from this `ReactChannel` within a certain time span.
*
* This method ''never'' returns. Therefore, the rest of the computation
* has to be contained in the actions of the partial function.
*
* @param msec the time span before timeout
@ -81,7 +80,7 @@ private[actors] class ReactChannel[Msg](receiver: ReplyReactor) extends InputCha
}
/**
* Receives a message from this <code>ReactChannel</code>.
* Receives a message from this `ReactChannel`.
*
* @param f a partial function with message patterns and actions
* @return result of processing the received value
@ -96,8 +95,7 @@ private[actors] class ReactChannel[Msg](receiver: ReplyReactor) extends InputCha
}
/**
* Receives a message from this <code>ReactChannel</code> within a certain
* time span.
* Receives a message from this `ReactChannel` within a certain time span.
*
* @param msec the time span before timeout
* @param f a partial function with message patterns and actions
@ -114,7 +112,7 @@ private[actors] class ReactChannel[Msg](receiver: ReplyReactor) extends InputCha
}
/**
* Receives the next message from this <code>ReactChannel</code>.
* Receives the next message from this `ReactChannel`.
*/
def ? : Msg = receive {
case x => x

View File

@ -6,16 +6,16 @@
** |/ **
\* */
package scala.actors
import java.util.{Timer, TimerTask}
/**
* Extends the [[scala.actors.Reactor]]
* trait with methods to reply to the sender of a message.
* Sending a message to a <code>ReplyReactor</code> implicitly
* passes a reference to the sender together with the message.
* Extends the [[scala.actors.Reactor]] trait with methods to reply to the
* sender of a message.
*
* Sending a message to a `ReplyReactor` implicitly passes a reference to
* the sender together with the message.
*
* @author Philipp Haller
*
@ -43,7 +43,7 @@ trait ReplyReactor extends Reactor[Any] with ReactorCanReply {
protected[actors] def sender: OutputChannel[Any] = senders.head
/**
* Replies with <code>msg</code> to the sender.
* Replies with `msg` to the sender.
*/
protected[actors] def reply(msg: Any) {
sender ! msg

View File

@ -38,7 +38,7 @@ object Scheduler extends DelegatingScheduler {
sched
}
/* Only <code>ForkJoinScheduler</code> implements this method.
/* Only `ForkJoinScheduler` implements this method.
*/
@deprecated("snapshot will be removed", "2.8.0")
def snapshot() {
@ -48,7 +48,7 @@ object Scheduler extends DelegatingScheduler {
sys.error("scheduler does not implement snapshot")
}
/* Only <code>ForkJoinScheduler</code> implements this method.
/* Only `ForkJoinScheduler` implements this method.
*/
@deprecated("restart will be removed", "2.8.0")
def restart() {

View File

@ -77,7 +77,7 @@ class TcpService(port: Int, cl: ClassLoader) extends Thread with Service {
/**
* Sends a byte array to another node on the network.
* If the node is not yet up, up to <code>TcpService.BufSize</code>
* If the node is not yet up, up to `TcpService.BufSize`
* messages are buffered.
*/
def send(node: Node, data: Array[Byte]): Unit = synchronized {

View File

@ -19,9 +19,9 @@ import scala.collection.mutable
* either been explicitly terminated or garbage collected.
*
* When an actor is started, it is registered with the ActorGC via the
* <code>newActor</code> method, and when an actor is knowingly terminated
* `newActor` method, and when an actor is knowingly terminated
* (e.g. act method finishes, exit explicitly called, an exception is thrown),
* the ActorGC is informed via the <code>terminated</code> method.
* the ActorGC is informed via the `terminated` method.
*/
trait ActorGC extends TerminationMonitor {
self: IScheduler =>
@ -31,8 +31,8 @@ trait ActorGC extends TerminationMonitor {
/**
* This is a set of references to all the actors registered with
* this ActorGC. It is maintained so that the WeakReferences will not be GC'd
* before the actors to which they point.
* this ActorGC. It is maintained so that the WeakReferences will
* not be GC'd before the actors to which they point.
*/
private val refSet = new mutable.HashSet[Reference[t] forSome { type t <: TrackedReactor }]

View File

@ -11,8 +11,8 @@ package scala.actors.scheduler
import scala.util.control.ControlThrowable
/**
* The <code>QuitControl</code> class is used to manage control flow
* of certain schedulers.
* The `QuitControl` class is used to manage control flow of certain
* schedulers.
*
* @author Philipp Haller
*/

View File

@ -6,7 +6,6 @@
** |/ **
\* */
package scala.actors.scheduler
import scala.actors.threadpool.{ThreadPoolExecutor, TimeUnit, LinkedBlockingQueue,
@ -15,13 +14,11 @@ import scala.actors.{Debug, IScheduler}
import scala.concurrent.ManagedBlocker
/**
* This scheduler class uses a <code>ThreadPoolExecutor</code>
* to execute <code>Actor</code>s.
* This scheduler class uses a `ThreadPoolExecutor` to execute `Actor`s.
*
* The scheduler attempts to shut down itself and the underlying
* <code>ThreadPoolExecutor</code> only if <code>terminate</code>
* is set to true. Otherwise, the scheduler must be shut down
* explicitly.
* `ThreadPoolExecutor` only if `terminate` is set to true. Otherwise,
* the scheduler must be shut down explicitly.
*
* @author Philipp Haller
*/
@ -176,7 +173,7 @@ class ResizableThreadPoolScheduler(protected val terminate: Boolean,
}
/** Resumes the execution of the scheduler if it was previously
* suspended using <code>snapshot</code>.
* suspended using `snapshot`.
*/
def restart() {
synchronized {

View File

@ -172,7 +172,8 @@ object JavaConverters {
* returned.
*
* @param b The `Buffer` to be converted.
* @return An object with an `asJava` method that returns a Java <code>List</code> view of the argument.
* @return An object with an `asJava` method that returns a Java `List` view
* of the argument.
*/
implicit def bufferAsJavaListConverter[A](b : mutable.Buffer[A]): AsJava[ju.List[A]] =
new AsJava(bufferAsJavaList(b))
@ -234,8 +235,9 @@ object JavaConverters {
* call of `asSet(java.util.Set)` then the original Java `Set` will be
* returned.
*
* @param s The <code>Set</code> to be converted.
* @return An object with an `asJava` method that returns a Java <code>Set</code> view of the argument.
* @param s The `Set` to be converted.
* @return An object with an `asJava` method that returns a Java `Set` view
* of the argument.
*/
implicit def mutableSetAsJavaSetConverter[A](s : mutable.Set[A]): AsJava[ju.Set[A]] =
new AsJava(mutableSetAsJavaSet(s))
@ -252,8 +254,8 @@ object JavaConverters {
* the Scala interface and vice versa.
*
* If the Scala `Set` was previously obtained from an implicit or explicit
* call of <code>asSet(java.util.Set)</code> then the original Java `Set`
* will be returned.
* call of `asSet(java.util.Set)` then the original Java `Set` will be
* returned.
*
* @param s The `Set` to be converted.
* @return An object with an `asJava` method that returns a Java `Set` view
@ -299,7 +301,7 @@ object JavaConverters {
* explicit call of `asMap(java.util.Dictionary)` then the original
* Java `Dictionary` will be returned.
*
* @param m The <code>Map</code> to be converted.
* @param m The `Map` to be converted.
* @return An object with an `asJavaDictionary` method that returns a
* Java `Dictionary` view of the argument.
*/
@ -386,17 +388,20 @@ object JavaConverters {
new AsScala(enumerationAsScalaIterator(i))
/**
* Adds an `asScala` method that implicitly converts a Java <code>Iterable</code> to a Scala <code>Iterable</code>.
* The returned Scala <code>Iterable</code> is backed by the provided Java
* <code>Iterable</code> and any side-effects of using it via the Scala interface will
* be visible via the Java interface and vice versa.
* <p>
* If the Java <code>Iterable</code> was previously obtained from an implicit or
* explicit call of <code>asIterable(scala.collection.Iterable)</code> then the original
* Scala <code>Iterable</code> will be returned.
* Adds an `asScala` method that implicitly converts a Java `Iterable` to
* a Scala `Iterable`.
*
* The returned Scala `Iterable` is backed by the provided Java `Iterable`
* and any side-effects of using it via the Scala interface will be visible
* via the Java interface and vice versa.
*
* @param i The <code>Iterable</code> to be converted.
* @return An object with an `asScala` method that returns a Scala <code>Iterable</code> view of the argument.
* If the Java `Iterable` was previously obtained from an implicit or
* explicit call of `asIterable(scala.collection.Iterable)` then the original
* Scala `Iterable` will be returned.
*
* @param i The `Iterable` to be converted.
* @return An object with an `asScala` method that returns a Scala `Iterable`
* view of the argument.
*/
implicit def iterableAsScalaIterableConverter[A](i : jl.Iterable[A]): AsScala[Iterable[A]] =
new AsScala(iterableAsScalaIterable(i))
@ -405,14 +410,16 @@ object JavaConverters {
def asScalaIterableConverter[A](i : jl.Iterable[A]): AsScala[Iterable[A]] = iterableAsScalaIterableConverter(i)
/**
* Adds an `asScala` method that implicitly converts a Java <code>Collection</code> to an Scala <code>Iterable</code>.
* <p>
* If the Java <code>Collection</code> was previously obtained from an implicit or
* explicit call of <code>asCollection(scala.collection.SizedIterable)</code> then
* the original Scala <code>SizedIterable</code> will be returned.
* Adds an `asScala` method that implicitly converts a Java `Collection` to
* an Scala `Iterable`.
*
* @param i The <code>Collection</code> to be converted.
* @return An object with an `asScala` method that returns a Scala <code>SizedIterable</code> view of the argument.
* If the Java `Collection` was previously obtained from an implicit or
* explicit call of `asCollection(scala.collection.SizedIterable)` then
* the original Scala `SizedIterable` will be returned.
*
* @param i The `Collection` to be converted.
* @return An object with an `asScala` method that returns a Scala
* `SizedIterable` view of the argument.
*/
implicit def collectionAsScalaIterableConverter[A](i : ju.Collection[A]): AsScala[Iterable[A]] =
new AsScala(collectionAsScalaIterable(i))

View File

@ -6,12 +6,9 @@
** |/ **
\* */
package scala.collection
/** This is a simple wrapper class for <a href="Map.html"
* target="contentFrame"><code>scala.collection.Map</code></a>.
/** This is a simple wrapper class for [[scala.collection.Map]].
* It is most useful for assembling customized map abstractions
* dynamically using object composition and forwarding.
*

View File

@ -683,9 +683,8 @@ trait SeqLike[+A, +Repr] extends IterableLike[A, Repr] with GenSeqLike[A, Repr]
def equalsWith[B](that: Seq[B])(f: (A,B) => Boolean): Boolean = corresponds(that)(f)
/**
* returns a projection that can be used to call non-strict <code>filter</code>,
* <code>map</code>, and <code>flatMap</code> methods that build projections
* of the collection.
* returns a projection that can be used to call non-strict `filter`,
* `map`, and `flatMap` methods that build projections of the collection.
*/
@deprecated("use `view` instead", "2.8.0")
override def projection = view
@ -729,10 +728,10 @@ object SeqLike {
}
arr
}
var m, i = 0
def mi = m + i
while (mi < S.length) {
if (W(i) == S(mi)) {
i += 1
@ -781,7 +780,7 @@ object SeqLike {
}
/** Finds a particular index at which one sequence occurs in another sequence.
* Like indexOf, but finds the latest occurrence rather than earliest.
* Like `indexOf`, but finds the latest occurrence rather than earliest.
*
* @see SeqLike#indexOf
*/

View File

@ -6,12 +6,9 @@
** |/ **
\* */
package scala.collection
/** This is a simple wrapper class for <a href="Set.html"
* target="contentFrame"><code>scala.collection.Set</code></a>.
/** This is a simple wrapper class for [[scala.collection.Set]].
* It is most useful for assembling customized set abstractions
* dynamically using object composition and forwarding.
*
@ -19,5 +16,4 @@ package scala.collection
* @author Martin Odersky
* @version 2.0, 01/01/2007
*/
trait SetProxy[A] extends Set[A] with SetProxyLike[A, Set[A]]

View File

@ -6,7 +6,6 @@
** |/ **
\* */
package scala.collection
package generic
@ -31,17 +30,19 @@ trait Sorted[K, +This <: Sorted[K, This]] {
def lastKey: K
/** Comparison function that orders keys. */
def compare(k0: K, k1: K): Int = ordering.compare(k0, k1);
def compare(k0: K, k1: K): Int = ordering.compare(k0, k1)
/** Creates a ranged projection of this collection. Any mutations in the
* ranged projection will update this collection and vice versa. Note: keys
* are not garuanteed to be consistent between this collection and the projection.
* This is the case for buffers where indexing is relative to the projection.
* ranged projection will update this collection and vice versa.
*
* Note: keys are not garuanteed to be consistent between this collection
* and the projection. This is the case for buffers where indexing is
* relative to the projection.
*
* @param from The lower-bound (inclusive) of the ranged projection.
* <code>None</code> if there is no lower bound.
* `None` if there is no lower bound.
* @param until The upper-bound (exclusive) of the ranged projection.
* <code>None</code> if there is no upper bound.
* `None` if there is no upper bound.
*/
def rangeImpl(from: Option[K], until: Option[K]): This

View File

@ -63,11 +63,9 @@ class ListMap[A, +B] extends Map[A, B] with MapLike[A, B, ListMap[A, B]] with Se
*/
def get(key: A): Option[B] = None
/** This method allows one to create a new map with an
* additional mapping from <code>key</code>
* to <code>value</code>. If the map contains already a
* mapping for <code>key</code>, it will be overridden by this
* function.
/** This method allows one to create a new map with an additional mapping
* from `key` to `value`. If the map contains already a mapping for `key`,
* it will be overridden by this function.
*
* @param key the key element of the updated entry.
* @param value the value element of the updated entry.
@ -103,7 +101,7 @@ class ListMap[A, +B] extends Map[A, B] with MapLike[A, B, ListMap[A, B]] with Se
@bridge def ++[B1 >: B](xs: TraversableOnce[(A, B1)]): ListMap[A, B1] =
++(xs: GenTraversableOnce[(A, B1)])
/** This creates a new mapping without the given <code>key</code>.
/** This creates a new mapping without the given `key`.
* If the map does not contain a mapping for the given key, the
* method returns the same map.
*
@ -154,10 +152,10 @@ class ListMap[A, +B] extends Map[A, B] with MapLike[A, B, ListMap[A, B]] with Se
* @return the value associated with the given key.
*/
override def apply(k: A): B1 = apply0(this, k)
@tailrec private def apply0(cur: ListMap[A, B1], k: A): B1 = if (k == cur.key) cur.value else apply0(cur.next, k)
/** 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
@ -181,7 +179,7 @@ class ListMap[A, +B] extends Map[A, B] with MapLike[A, B, ListMap[A, B]] with Se
new m.Node[B2](k, v)
}
/** Creates a new mapping without the given <code>key</code>.
/** Creates a new mapping without the given `key`.
* If the map does not contain a mapping for the given key, the
* method returns the same map.
*

View File

@ -6,8 +6,6 @@
** |/ **
\* */
package scala.collection
package immutable
@ -78,10 +76,10 @@ class ListSet[A] extends Set[A]
override def size: Int = 0
override def isEmpty: Boolean = true;
/** 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 = false
@ -151,17 +149,17 @@ class ListSet[A] extends Set[A]
@tailrec private def sizeInternal(n: ListSet[A], acc: Int): Int =
if (n.isEmpty) acc
else sizeInternal(n.unchecked_outer, acc + 1)
/** Checks if this set is empty.
*
* @return true, iff there is no element in the set.
*/
override def isEmpty: Boolean = false
/** 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.
*/
override def contains(e: A) = containsInternal(this, e)
@tailrec private def containsInternal(n: ListSet[A], e: A): Boolean =
@ -170,9 +168,8 @@ class ListSet[A] extends Set[A]
/** This method creates a new set with an additional element.
*/
override def +(e: A): ListSet[A] = if (contains(e)) this else new Node(e)
/** <code>-</code> can be used to remove a single element from
* a set.
/** `-` can be used to remove a single element from a set.
*/
override def -(e: A): ListSet[A] = if (e == elem) self else {
val tail = self - e; new tail.Node(elem)

View File

@ -6,8 +6,6 @@
** |/ **
\* */
package scala.collection
package immutable
@ -166,8 +164,8 @@ self =>
* `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
* sequence is <code>a<sub>0</sub>, ..., a<sub>n</sub></code>.
* @return `f(a,,0,,), ..., f(a,,n,,)` if this
* sequence is `a,,0,,, ..., a,,n,,`.
*/
override final def map[B, That](f: A => B)(implicit bf: CanBuildFrom[Stream[A], B, That]): That = {
if (isStreamBuilder(bf)) asThat(
@ -198,8 +196,8 @@ self =>
*
* @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>.
* @return `f(a,,0,,) ::: ... ::: f(a,,n,,)` if
* this stream is `[a,,0,,, ..., a,,n,,]`.
*/
override final def flatMap[B, That](f: A => GenTraversableOnce[B])(implicit bf: CanBuildFrom[Stream[A], B, That]): That =
// we assume there is no other builder factory on streams and therefore know that That = Stream[B]
@ -224,10 +222,10 @@ self =>
else super.flatMap(f)(bf)
/** Returns all the elements of this stream that satisfy the
* predicate <code>p</code>. The order of the elements is preserved.
* predicate `p`. The order of the elements is preserved.
*
* @param p the predicate used to filter the stream.
* @return the elements of this stream satisfying <code>p</code>.
* @return the elements of this stream satisfying `p`.
*/
override def filter(p: A => Boolean): Stream[A] = {
// optimization: drop leading prefix of elems for which f returns false
@ -268,7 +266,7 @@ self =>
override def foreach[B](f: A => B) =
for (x <- self)
if (p(x)) f(x)
override def withFilter(q: A => Boolean): StreamWithFilter =
new StreamWithFilter(x => p(x) && q(x))
}
@ -276,7 +274,7 @@ self =>
/** A lazier Iterator than LinearSeqLike's. */
override def iterator: Iterator[A] = new StreamIterator(self)
/** Apply the given function <code>f</code> to each element of this linear sequence
/** Apply the given function `f` to each element of this linear sequence
* (while respecting the order of the elements).
*
* @param f the treatment to apply to each element.
@ -319,22 +317,24 @@ self =>
}
/** Returns all the elements of this stream that satisfy the
* predicate <code>p</code>. The order of the elements is preserved.
* predicate `p`. The order of the elements is preserved.
*
* @param p the predicate used to filter the stream.
* @return the elements of this stream satisfying <code>p</code>.
* @return the elements of this stream satisfying `p`.
*/
override def partition(p: A => Boolean): (Stream[A], Stream[A]) = (filter(p(_)), filterNot(p(_)))
/** Returns a stream formed from this stream and the specified stream
* <code>that</code> by associating each element of the former with
* the element at the same position in the latter.
* If one of the two streams is longer than the other, its remaining elements are ignored.
* `that` by associating each element of the former with the element at
* the same position in the latter.
*
* @return <code>Stream({a<sub>0</sub>,b<sub>0</sub>}, ...,
* {a<sub>min(m,n)</sub>,b<sub>min(m,n)</sub>)}</code> when
* <code>Stream(a<sub>0</sub>, ..., a<sub>m</sub>)
* zip Stream(b<sub>0</sub>, ..., b<sub>n</sub>)</code> is invoked.
* If one of the two streams is longer than the other, its remaining
* elements are ignored.
*
* @return `Stream({a,,0,,,b,,0,,}, ...,
* {a,,min(m,n),,,b,,min(m,n),,)}` when
* `Stream(a,,0,,, ..., a,,m,,)
* zip Stream(b,,0,,, ..., b,,n,,)` is invoked.
*/
override final def zip[A1 >: A, B, That](that: collection.GenIterable[B])(implicit bf: CanBuildFrom[Stream[A], (A1, B), That]): That =
// we assume there is no other builder factory on streams and therefore know that That = Stream[(A1, B)]
@ -351,11 +351,11 @@ self =>
this.zip[A1, Int, That](Stream.from(0))
/** Write all defined elements of this iterable into given string builder.
* The written text begins with the string <code>start</code> and is finished by the string
* <code>end</code>. Inside, the string representations of defined elements (w.r.t.
* the method <code>toString()</code>) are separated by the string
* <code>sep</code>. The method will not force evaluation of undefined elements. A
* tail of such elements will be represented by a "?" instead.
* The written text begins with the string `start` and is finished by the string
* `end`. Inside, the string representations of defined elements (w.r.t.
* the method `toString()`) are separated by the string `sep`. The method will
* not force evaluation of undefined elements. A tail of such elements will be
* represented by a `"?"` instead.
*/
override def addString(b: StringBuilder, start: String, sep: String, end: String): StringBuilder = {
def loop(pre: String, these: Stream[A]) {
@ -381,11 +381,11 @@ self =>
override def splitAt(n: Int): (Stream[A], Stream[A]) = (take(n), drop(n))
/** Returns the <code>n</code> first elements of this stream, or else the whole
* stream, if it has less than <code>n</code> elements.
/** Returns the `n` first elements of this stream, or else the whole
* stream, if it has less than `n` elements.
*
* @param n the number of elements to take.
* @return the <code>n</code> first elements of this stream.
* @return the `n` first elements of this stream.
*/
override def take(n: Int): Stream[A] =
if (n <= 0 || isEmpty) Stream.empty
@ -409,14 +409,14 @@ self =>
}
/** The stream without its last element.
* @throws Predef.UnsupportedOperationException if the stream is empty.
* @throws `Predef.UnsupportedOperationException` if the stream is empty.
*/
override def init: Stream[A] =
if (isEmpty) super.init
else if (tail.isEmpty) Stream.Empty
else cons(head, tail.init)
/** Returns the rightmost <code>n</code> elements from this iterable.
/** Returns the rightmost `n` elements from this iterable.
* @param n the number of elements to take
*/
override def takeRight(n: Int): Stream[A] = {
@ -432,7 +432,7 @@ self =>
// there's nothing we can do about dropRight, so we just keep the definition in LinearSeq
/** Returns the longest prefix of this stream whose elements satisfy
* the predicate <code>p</code>.
* the predicate `p`.
*
* @param p the test predicate.
*/
@ -441,7 +441,7 @@ self =>
else Stream.Empty
/** Returns the longest suffix of this iterable whose first element
* does not satisfy the predicate <code>p</code>.
* does not satisfy the predicate `p`.
*
* @param p the test predicate.
*/
@ -458,8 +458,8 @@ self =>
if (isEmpty) this
else cons(head, tail.filter(head !=).distinct)
/** Returns a new sequence of given length containing the elements of this sequence followed by zero
* or more occurrences of given elements.
/** Returns a new sequence of given length containing the elements of this
* sequence followed by zero or more occurrences of given elements.
*/
override def padTo[B >: A, That](len: Int, elem: B)(implicit bf: CanBuildFrom[Stream[A], B, That]): That = {
def loop(len: Int, these: Stream[A]): Stream[B] =
@ -494,14 +494,14 @@ self =>
if (isEmpty) Stream.empty
else flatten1(asTraversable(head).seq.toTraversable)
}
override def view = new StreamView[A, Stream[A]] {
protected lazy val underlying = self.repr
override def iterator = self.iterator
override def length = self.length
override def apply(idx: Int) = self.apply(idx)
}
/** Defines the prefix of this object's `toString` representation as `Stream`.
*/
override def stringPrefix = "Stream"
@ -514,7 +514,7 @@ final class StreamIterator[+A](self: Stream[A]) extends Iterator[A] {
class LazyCell(st: => Stream[A]) {
lazy val v = st
}
private var these = new LazyCell(self)
def hasNext: Boolean = these.v.nonEmpty
def next: A =
@ -534,17 +534,16 @@ final class StreamIterator[+A](self: Stream[A]) extends Iterator[A] {
}
/**
* The object <code>Stream</code> provides helper functions
* to manipulate streams.
* The object `Stream` provides helper functions to manipulate streams.
*
* @author Martin Odersky, Matthias Zenger
* @version 1.1 08/08/03
* @since 2.8
*/
object Stream extends SeqFactory[Stream] {
/** The factory for streams.
* @note Methods such as map/flatMap will not invoke the Builder factory,
* @note Methods such as map/flatMap will not invoke the `Builder` factory,
* but will return a new stream directly, to preserve laziness.
* The new stream is then cast to the factory's result type.
* This means that every CanBuildFrom that takes a
@ -554,7 +553,7 @@ object Stream extends SeqFactory[Stream] {
class StreamCanBuildFrom[A] extends GenericCanBuildFrom[A]
implicit def canBuildFrom[A]: CanBuildFrom[Coll, A, Stream[A]] = new StreamCanBuildFrom[A]
/** Creates a new builder for a stream */
def newBuilder[A]: Builder[A, Stream[A]] = new StreamBuilder[A]
@ -650,28 +649,27 @@ object Stream extends SeqFactory[Stream] {
iterate(start)(f) take len
/**
* Create an infinite stream starting at <code>start</code>
* and incrementing by step <code>step</code>
* Create an infinite stream starting at `start` and incrementing by
* step `step`.
*
* @param start the start value of the stream
* @param step the increment value of the stream
* @return the stream starting at value <code>start</code>.
* @return the stream starting at value `start`.
*/
def from(start: Int, step: Int): Stream[Int] =
cons(start, from(start+step, step))
/**
* Create an infinite stream starting at <code>start</code>
* and incrementing by 1.
* Create an infinite stream starting at `start` and incrementing by `1`.
*
* @param start the start value of the stream
* @return the stream starting at value <code>start</code>.
* @return the stream starting at value `start`.
*/
def from(start: Int): Stream[Int] = from(start, 1)
/**
* Create an infinite stream containing the given element expression (which is computed for each
* occurrence)
* Create an infinite stream containing the given element expression (which
* is computed for each occurrence).
*
* @param elem the element composing the resulting stream
* @return the stream containing an infinite number of elem
@ -720,15 +718,14 @@ object Stream extends SeqFactory[Stream] {
def concat[A](xs: Iterator[Stream[A]]): Stream[A] = xs.toStream.flatten //(conforms[Stream[A], scala.collection.Traversable[A]])
/**
* Create a stream with element values
* <code>v<sub>n+1</sub> = step(v<sub>n</sub>)</code>
* where <code>v<sub>0</sub> = start</code>
* and elements are in the range between <code>start</code> (inclusive)
* and <code>end</code> (exclusive)
* Create a stream with element values `v,,n+1,, = step(v,,n,,)` where
* `v,,0,, = start` and elements are in the range between `start` (inclusive)
* and `end` (exclusive).
*
* @param start the start value of the stream
* @param end the end value of the stream
* @param step the increment function of the stream, must be monotonically increasing or decreasing
* @return the stream starting at value <code>start</code>.
* @return the stream starting at value `start`.
*/
@deprecated("use `iterate` instead.", "2.8.0")
def range(start: Int, end: Int, step: Int => Int): Stream[Int] =

View File

@ -6,15 +6,11 @@
** |/ **
\* */
package scala.collection
package mutable
import generic._
/** Factory object for the `ArrayStack` class.
*
* $factoryInfo
@ -30,7 +26,7 @@ object ArrayStack extends SeqFactory[ArrayStack] {
if (els.length == 0) new ArrayStack()
else new ArrayStack[A](els, els.length)
}
private[mutable] def growArray(x: Array[AnyRef]) = {
val y = new Array[AnyRef](x.length * 2)
Array.copy(x, 0, y, 0, x.length)
@ -85,11 +81,10 @@ extends Seq[T]
/** The number of elements in the stack */
def length = index
override def companion = ArrayStack
/** Replace element at index <code>n</code> with the new element
* <code>newelem</code>.
/** Replace element at index `n` with the new element `newelem`.
*
* This is a constant time operation.
*
@ -169,12 +164,12 @@ extends Seq[T]
* @return A reference to this stack.
*/
def +=(x: T): this.type = { push(x); this }
def result = {
reverseTable()
this
}
private def reverseTable() {
var i = 0
val until = index / 2
@ -186,7 +181,7 @@ extends Seq[T]
i += 1
}
}
/** Pop the top two elements off the stack, apply `f` to them and push the result
* back on to the stack.
*
@ -195,7 +190,7 @@ extends Seq[T]
* @param f The function to apply to the top two elements.
*/
def combine(f: (T, T) => T): Unit = push(f(pop, pop))
/** Repeatedly combine the top elements of the stack until the stack contains only
* one element.
*

View File

@ -55,10 +55,9 @@ trait BufferProxy[A] extends Buffer[A] with Proxy {
def +=(elem: A): this.type = { self.+=(elem); this }
override def readOnly = self.readOnly
/** Appends a number of elements provided by a traversable object
* via its <code>foreach</code> method. The identity of the
* buffer is returned.
/** Appends a number of elements provided by a traversable object via its
* `foreach` method. The identity of the buffer is returned.
*
* @param iter the traversable object.
* @return the updated buffer.

View File

@ -363,7 +363,7 @@ final class ListBuffer[A]
/** Returns a clone of this buffer.
*
* @return a <code>ListBuffer</code> with the same elements.
* @return a `ListBuffer` with the same elements.
*/
override def clone(): ListBuffer[A] = (new ListBuffer[A]) ++= this

View File

@ -1,17 +1,14 @@
/* __ *\
** ________ ___ / / ___ Scala API **
** / __/ __// _ | / / / _ | (c) 2003-2011, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | **
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
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.
*
@ -25,9 +22,9 @@ trait StackProxy[A] extends Stack[A] with Proxy {
def self: Stack[A]
/** Access element number <code>n</code>.
/** Access element number `n`.
*
* @return the element at index <code>n</code>.
* @return the element at index `n`.
*/
override def apply(n: Int): A = self.apply(n)
@ -52,9 +49,9 @@ trait StackProxy[A] extends Stack[A] with Proxy {
override def pushAll(xs: TraversableOnce[A]): this.type = { self pushAll xs; this }
/** Pushes all elements provided by an <code>Iterable</code> object
* on top of the stack. The elements are pushed in the order they
* are given out by the iterator.
/** Pushes all elements provided by an `Iterable` object on top of the
* stack. The elements are pushed in the order they are given out by
* the iterator.
*
* @param iter an iterable object
*/

View File

@ -85,7 +85,7 @@ trait SynchronizedBuffer[A] extends Buffer[A] {
}
/** Appends a number of elements provided by a traversable object
* via its <code>foreach</code> method.
* via its `foreach` method.
*
* @param xs the traversable object.
*/
@ -103,8 +103,7 @@ trait SynchronizedBuffer[A] extends Buffer[A] {
}
/** Prepends a number of elements provided by a traversable object
* via its <code>foreach</code> method. The identity of the
* buffer is returned.
* via its `foreach` method. The identity of the buffer is returned.
*
* @param xs the traversable object.
*/
@ -117,8 +116,7 @@ trait SynchronizedBuffer[A] extends Buffer[A] {
override def prepend(elems: A*): Unit = prependAll(elems)
/** Prepends a number of elements provided by a traversable object
* via its <code>foreach</code> method. The identity of the
* buffer is returned.
* via its `foreach` method. The identity of the buffer is returned.
*
* @param xs the traversable object.
*/
@ -126,9 +124,9 @@ trait SynchronizedBuffer[A] extends Buffer[A] {
super.prependAll(xs)
}
/** Inserts new elements at the index <code>n</code>. Opposed to method
* <code>update</code>, this method will not replace an element with a
* one. Instead, it will insert the new elements at index <code>n</code>.
/** Inserts new elements at the index `n`. Opposed to method `update`,
* this method will not replace an element with a one.
* Instead, it will insert the new elements at index `n`.
*
* @param n the index where a new element will be inserted.
* @param elems the new elements to insert.
@ -137,9 +135,9 @@ trait SynchronizedBuffer[A] extends Buffer[A] {
super.insertAll(n, elems)
}
/** Inserts new elements at the index <code>n</code>. Opposed to method
* <code>update</code>, this method will not replace an element with a
* one. Instead, it will insert a new element at index <code>n</code>.
/** Inserts new elements at the index `n`. Opposed to method `update`,
* this method will not replace an element with a one.
* Instead, it will insert a new element at index `n`.
*
* @param n the index where a new element will be inserted.
* @param xs the traversable object providing all elements to insert.
@ -148,8 +146,7 @@ trait SynchronizedBuffer[A] extends Buffer[A] {
super.insertAll(n, xs)
}
/** Replace element at index <code>n</code> with the new element
* <code>newelem</code>.
/** Replace element at index `n` with the new element `newelem`.
*
* @param n the index of the element to replace.
* @param newelem the new element.
@ -178,13 +175,13 @@ trait SynchronizedBuffer[A] extends Buffer[A] {
/** Return a clone of this buffer.
*
* @return an <code>ArrayBuffer</code> with the same elements.
* @return an `ArrayBuffer` with the same elements.
*/
override def clone(): Self = synchronized {
super.clone()
}
/** The hashCode method always yields an error, since it is not
/** The `hashCode` method always yields an error, since it is not
* safe to use buffers as keys in hash tables.
*
* @return never.

View File

@ -6,18 +6,15 @@
** |/ **
\* */
package scala.collection
package script
import mutable.ArrayBuffer
/** Class <code>Message</code> represents messages that are issued by observable
* collection classes whenever a data structure is changed. Class <code>Message</code>
* has several subclasses for the various kinds of events: <code>Update</code>
* <code>Remove</code>, <code>Include</code>, <code>Reset</code>, and
* <code>Script</code>.
/** Class `Message` represents messages that are issued by observable
* collection classes whenever a data structure is changed. Class `Message`
* has several subclasses for the various kinds of events: `Update`
* `Remove`, `Include`, `Reset`, and `Script`.
*
* @author Matthias Zenger
* @version 1.0, 08/07/2003
@ -78,7 +75,7 @@ class Script[A] extends ArrayBuffer[Message[A]] with Message[A] {
if (i > 1)
res = res + ", "
res = res + "[" + i + "] " + it.next
i = i + 1
i += 1
}
res + ")"
}

View File

@ -1,6 +1,14 @@
/* __ *\
** ________ ___ / / ___ Scala API **
** / __/ __// _ | / / / _ | (c) 2009-2011, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
package scala.concurrent
/** The <code>FutureTaskRunner</code> trait is a base trait of task runners
/** The `FutureTaskRunner</code> trait is a base trait of task runners
* that provide some sort of future abstraction.
*
* @author Philipp Haller

View File

@ -6,8 +6,6 @@
** |/ **
\* */
package scala.concurrent
/** This class ...
@ -83,7 +81,7 @@ class MailBox extends AnyRef with ListQueueCreator {
/**
* Block until there is a message in the mailbox for which the processor
* <code>f</code> is defined.
* `f` is defined.
*/
def receive[A](f: PartialFunction[Message, A]): A = {
val r = new Receiver(f)
@ -93,7 +91,7 @@ class MailBox extends AnyRef with ListQueueCreator {
/**
* Block until there is a message in the mailbox for which the processor
* <code>f</code> is defined or the timeout is over.
* `f` is defined or the timeout is over.
*/
def receiveWithin[A](msec: Long)(f: PartialFunction[Message, A]): A = {
val r = new Receiver(f)

View File

@ -6,14 +6,11 @@
** |/ **
\* */
package scala.concurrent
/** A <code>SyncChannel</code> allows one to exchange data
* synchronously between a reader and a writer thread.
* The writer thread is blocked until the data to be written
* has been read by a corresponding reader thread.
/** A `SyncChannel` allows one to exchange data synchronously between
* a reader and a writer thread. The writer thread is blocked until the
* data to be written has been read by a corresponding reader thread.
*
* @author Philipp Haller
* @version 2.0, 04/17/2008

View File

@ -6,13 +6,11 @@
** |/ **
\* */
package scala.concurrent
/**
* The message sent to a message box when the period specified in
* <code>receiveWithin</code> expires.
* `receiveWithin` expires.
*
* @author Martin Odersky
* @version 1.0, 10/03/2003

View File

@ -6,11 +6,9 @@
** |/ **
\* */
package scala.concurrent
/** The <code>TaskRunner</code> trait...
/** The `TaskRunner` trait...
*
* @author Philipp Haller
*/

View File

@ -6,13 +6,11 @@
** |/ **
\* */
package scala.concurrent
import java.util.concurrent.{ThreadPoolExecutor, LinkedBlockingQueue, TimeUnit}
/** The <code>TaskRunners</code> object...
/** The `TaskRunners` object...
*
* @author Philipp Haller
*/

View File

@ -6,14 +6,11 @@
** |/ **
\* */
package scala.concurrent
import java.util.concurrent.{ExecutorService, Callable, TimeUnit}
/** The <code>ThreadPoolRunner</code> trait uses
* a <code>java.util.concurrent.ExecutorService</code>
/** The `ThreadPoolRunner` trait uses a `java.util.concurrent.ExecutorService`
* to run submitted tasks.
*
* @author Philipp Haller

View File

@ -6,13 +6,11 @@
** |/ **
\* */
package scala.concurrent
import java.lang.Thread
/** The <code>ThreadRunner</code> trait...
/** The `ThreadRunner` trait...
*
* @author Philipp Haller
*/

View File

@ -36,7 +36,7 @@ object pilib {
/**
* Run several processes in parallel using the following syntax:
* <code>spawn &lt; p<sub>1</sub> | ... | p<sub>n</sub> &gt;</code>
* `spawn < p,,1,, | ... | p,,n,, >`.
*/
abstract class Spawn {
def <(p: => Unit): Spawn

View File

@ -6,8 +6,6 @@
** |/ **
\* */
package scala.io
import java.io.{ FileInputStream, InputStream, PrintStream, File => JFile }
@ -21,11 +19,11 @@ import java.net.{ URI, URL }
*/
object Source {
val DefaultBufSize = 2048
/** Creates a <code>Source</code> from System.in.
/** Creates a `Source` from System.in.
*/
def stdin = fromInputStream(System.in)
/** Creates a Source from an Iterable.
*
* @param iterable the Iterable
@ -59,7 +57,7 @@ object Source {
def fromFile(name: String, enc: String): BufferedSource =
fromFile(name)(Codec(enc))
/** creates <code>Source</code> from file with given file: URI
/** creates `ource` from file with given file `URI`.
*/
def fromFile(uri: URI)(implicit codec: Codec): BufferedSource =
fromFile(new JFile(uri))(codec)
@ -83,9 +81,9 @@ object Source {
def fromFile(file: JFile, enc: String, bufferSize: Int): BufferedSource =
fromFile(file, bufferSize)(Codec(enc))
/** Creates Source from <code>file</code>, using given character encoding,
* setting its description to filename. Input is buffered in a buffer of
* size <code>bufferSize</code>.
/** Creates Source from `file`, using given character encoding, setting
* its description to filename. Input is buffered in a buffer of size
* `bufferSize`.
*/
def fromFile(file: JFile, bufferSize: Int)(implicit codec: Codec): BufferedSource = {
val inputStream = new FileInputStream(file)
@ -98,12 +96,12 @@ object Source {
)(codec) withDescription ("file:" + file.getAbsolutePath)
}
/** Create a <code>Source</code> from array of bytes, decoding
/** Create a `Source` from array of bytes, decoding
* the bytes according to codec.
*
* @param bytes ...
* @param enc ...
* @return the created <code>Source</code> instance.
* @return the created `Source` instance.
*/
def fromBytes(bytes: Array[Byte])(implicit codec: Codec): Source =
fromString(new String(bytes, codec.name))
@ -111,13 +109,13 @@ object Source {
def fromBytes(bytes: Array[Byte], enc: String): Source =
fromBytes(bytes)(Codec(enc))
/** Create a <code>Source</code> from array of bytes, assuming
/** Create a `Source` from array of bytes, assuming
* one byte per character (ISO-8859-1 encoding.)
*/
def fromRawBytes(bytes: Array[Byte]): Source =
fromString(new String(bytes, Codec.ISO8859.name))
/** creates <code>Source</code> from file with given file: URI
/** creates `Source` from file with given file: URI
*/
def fromURI(uri: URI)(implicit codec: Codec): BufferedSource =
fromFile(new JFile(uri))(codec)
@ -163,7 +161,7 @@ object Source {
new BufferedSource(inputStream, bufferSize)(codec) withReset resetFn withClose close
}
def fromInputStream(is: InputStream, enc: String): BufferedSource =
fromInputStream(is)(Codec(enc))
@ -171,9 +169,9 @@ object Source {
createBufferedSource(is, reset = () => fromInputStream(is)(codec), close = () => is.close())(codec)
}
/** The class <code>Source</code> implements an iterable representation
* of source data. Calling method <code>reset</code> returns an identical,
* resetted source, where possible.
/** The class `Source` implements an iterable representation of source data.
* Calling method `reset` returns an identical, resetted source, where
* possible.
*
* @author Burak Emir
* @version 1.0
@ -233,7 +231,7 @@ abstract class Source extends Iterator[Char] {
*/
def getLines(): Iterator[String] = new LineIterator()
/** Returns <code>true</code> if this source has more characters.
/** Returns `'''true'''` if this source has more characters.
*/
def hasNext = iter.hasNext
@ -284,11 +282,11 @@ abstract class Source extends Iterator[Char] {
def ch = positioner.ch
def pos = positioner.pos
/** Reports an error message to the output stream <code>out</code>.
/** Reports an error message to the output stream `out`.
*
* @param pos the source position (line/column)
* @param msg the error message to report
* @param out PrintStream to use (optional: defaults to <code>Console.err</code>)
* @param out PrintStream to use (optional: defaults to `Console.err`)
*/
def reportError(
pos: Int,
@ -315,7 +313,7 @@ abstract class Source extends Iterator[Char] {
/**
* @param pos the source position (line/column)
* @param msg the warning message to report
* @param out PrintStream to use (optional: defaults to <code>Console.out</code>)
* @param out PrintStream to use (optional: defaults to `Console.out`)
*/
def reportWarning(
pos: Int,

View File

@ -6,8 +6,6 @@
** |/ **
\* */
package scala.math
import java.math.BigInteger
@ -25,15 +23,15 @@ object BigInt {
@deprecated("Use Long.MinValue", "2.9.0")
val MinLong = BigInt(Long.MinValue)
@deprecated("Use Long.MaxValue", "2.9.0")
val MaxLong = BigInt(Long.MaxValue)
/** Constructs a <code>BigInt</code> whose value is equal to that of the
/** Constructs a `BigInt` whose value is equal to that of the
* specified integer value.
*
* @param i the specified integer value
* @return the constructed <code>BigInt</code>
* @return the constructed `BigInt`
*/
def apply(i: Int): BigInt =
if (minCached <= i && i <= maxCached) {
@ -43,11 +41,11 @@ object BigInt {
n
} else new BigInt(BigInteger.valueOf(i))
/** Constructs a <code>BigInt</code> whose value is equal to that of the
/** Constructs a `BigInt` whose value is equal to that of the
* specified long value.
*
* @param l the specified long value
* @return the constructed <code>BigInt</code>
* @return the constructed `BigInt`
*/
def apply(l: Long): BigInt =
if (minCached <= l && l <= maxCached) apply(l.toInt)
@ -85,8 +83,8 @@ object BigInt {
def apply(x: String): BigInt =
new BigInt(new BigInteger(x))
/** Translates the string representation of a BigInt in the
* specified <code>radix</code> into a BigInt.
/** Translates the string representation of a `BigInt` in the
* specified `radix` into a BigInt.
*
* @param x ...
* @param radix ...
@ -100,7 +98,7 @@ object BigInt {
def probablePrime(bitLength: Int, rnd: scala.util.Random): BigInt =
new BigInt(BigInteger.probablePrime(bitLength, rnd.self))
/** Implicit conversion from <code>int</code> to <code>BigInt</code>.
/** Implicit conversion from `Int` to `BigInt`.
*/
implicit def int2bigInt(i: Int): BigInt = apply(i)
@ -340,21 +338,21 @@ class BigInt(val bigInteger: BigInteger) extends ScalaNumber with ScalaNumericCo
*/
def longValue = this.bigInteger.longValue
/** Converts this BigInt to a <tt>float</tt>.
* if this BigInt has too great a magnitude to represent as a float,
* it will be converted to <code>Float.NEGATIVE_INFINITY</code> or
* <code>Float.POSITIVE_INFINITY</code> as appropriate.
/** Converts this `BigInt` to a `float`.
* If this `BigInt` has too great a magnitude to represent as a float,
* it will be converted to `Float.NEGATIVE_INFINITY` or
* `Float.POSITIVE_INFINITY` as appropriate.
*/
def floatValue = this.bigInteger.floatValue
/** Converts this BigInt to a <tt>double</tt>.
* if this BigInt has too great a magnitude to represent as a double,
* it will be converted to <code>Double.NEGATIVE_INFINITY</code> or
* <code>Double.POSITIVE_INFINITY</code> as appropriate.
/** Converts this `BigInt` to a `double`.
* if this `BigInt` has too great a magnitude to represent as a double,
* it will be converted to `Double.NEGATIVE_INFINITY` or
* `Double.POSITIVE_INFINITY` as appropriate.
*/
def doubleValue = this.bigInteger.doubleValue
/** Create a NumericRange[BigInt] in range <code>[start;end)</code>
/** Create a `NumericRange[BigInt]` in range `[start;end)`
* with the specified step, where start is the target BigInt.
*
* @param end the end value of the range (exclusive)

View File

@ -6,34 +6,24 @@
** |/ **
\* */
package scala.math
/** <p>
* A trait for representing partial orderings. It is important to
* distinguish between a type that has a partial order and a representation
* of partial ordering on some type. This trait is for representing the
* latter.
* </p>
* <p>
* A <a href="http://en.wikipedia.org/wiki/Partial_order">partial ordering</a>
* is a binary relation on a type <code>T</code> that is also an equivalence
* relation on values of type <code>T</code>. This relation is exposed as
* the <code>lteq</code> method of the <code>PartialOrdering</code> trait.
* This relation must be:
* </p>
* <ul>
* <li>reflexive: <code>lteq(x, x) == true</code>, for any <code>x</code> of
* type <code>T</code>.</li>
* <li>anti-symmetric: <code>lteq(x, y) == true</code> and
* <code>lteq(y, x) == true</code> then <code>equiv(x, y)</code>, for any
* <code>x</code> and <code>y</code> of type <code>T</code>.</li>
* <li>transitive: if <code>lteq(x, y) == true</code> and
* <code>lteq(y, z) == true</code> then <code>lteq(x, z) == true</code>,
* for any <code>x</code>, <code>y</code>, and <code>z</code> of type
* <code>T</code>.</li>
* </ul>
/** A trait for representing partial orderings. It is important to
* distinguish between a type that has a partial order and a representation
* of partial ordering on some type. This trait is for representing the
* latter.
*
* A [[http://en.wikipedia.org/wiki/Partial_order partial ordering]] is a
* binary relation on a type `T` that is also an equivalence relation on
* values of type `T`. This relation is exposed as the `lteq` method of
* the `PartialOrdering` trait. This relation must be:
*
* - reflexive: `lteq(x, x) == '''true'''`, for any `x` of type `T`.
* - anti-symmetric: `lteq(x, y) == '''true'''` and `lteq(y, x) == true`
* then `equiv(x, y)`, for any `x` and `y` of type `T`.
* - transitive: if `lteq(x, y) == '''true'''` and
* `lteq(y, z) == '''true'''` then `lteq(x, z) == '''true'''`,
* for any `x`, `y`, and `z` of type `T`.
*
* @author Geoffrey Washburn
* @version 1.0, 2008-04-0-3
@ -43,37 +33,34 @@ package scala.math
trait PartialOrdering[T] extends Equiv[T] {
outer =>
/** Result of comparing <code>x</code> with operand <code>y</code>.
* Returns <code>None</code> if operands are not comparable.
* If operands are comparable, returns <code>Some(r)</code> where
* <code>r &lt; 0</code> iff <code>x &lt; y</code>
* <code>r == 0</code> iff <code>x == y</code>
* <code>r &gt; 0</code> iff <code>x &gt; y</code>
/** Result of comparing `x` with operand `y`.
* Returns `None` if operands are not comparable.
* If operands are comparable, returns `Some(r)` where
* - `r < 0` iff `x < y`
* - `r == 0` iff `x == y`
* - `r > 0` iff `x > y`
*/
def tryCompare(x: T, y: T): Option[Int]
/** Returns <code>true</code> iff <code>x</code> comes before
* <code>y</code> in the ordering.
/** Returns `'''true'''` iff `x` comes before `y` in the ordering.
*/
def lteq(x: T, y: T): Boolean
/** Returns <code>true</code> iff <code>y</code> comes before
* <code>x</code> in the ordering.
/** Returns `'''true'''` iff `y` comes before `x` in the ordering.
*/
def gteq(x: T, y: T): Boolean = lteq(y, x)
/** Returns <code>true</code> iff <code>x</code> comes before
* <code>y</code> in the ordering and is not the same as <code>y</code>.
/** Returns `'''true'''` iff `x` comes before `y` in the ordering
* and is not the same as `y`.
*/
def lt(x: T, y: T): Boolean = lteq(x, y) && !equiv(x, y)
/** Returns <code>true</code> iff <code>y</code> comes before
* <code>x</code> in the ordering and is not the same as <code>x</code>.
/** Returns `'''true'''` iff `y` comes before `x` in the ordering
* and is not the same as `x`.
*/
def gt(x: T, y: T): Boolean = gteq(x, y) && !equiv(x, y)
/** Returns <code>true</code> iff <code>x</code> is equivalent to
* <code>y</code> in the ordering.
/** Returns `'''true'''` iff `x` is equivalent to `y` in the ordering.
*/
def equiv(x: T, y: T): Boolean = lteq(x,y) && lteq(y,x)

View File

@ -17,12 +17,12 @@ package scala.math
*/
trait PartiallyOrdered[+A] {
/** Result of comparing <code>this</code> with operand <code>that</code>.
* Returns <code>None</code> if operands are not comparable.
* If operands are comparable, returns <code>Some(x)</code> where
* <code>x &lt; 0</code> iff <code>this &lt; that</code>
* <code>x == 0</code> iff <code>this == that</code>
* <code>x &gt; 0</code> iff <code>this &gt; that</code>
/** Result of comparing `'''this'''` with operand `that`.
* Returns `None` if operands are not comparable.
* If operands are comparable, returns `Some(x)` where
* - `x < 0` iff `'''this''' &lt; that`
* - `x == 0` iff `'''this''' == that`
* - `x > 0` iff `'''this''' &gt; that`
*/
def tryCompareTo [B >: A <% PartiallyOrdered[B]](that: B): Option[Int]

View File

@ -8,17 +8,17 @@
package scala
/** The package object <code>scala.math</code> contains methods for performing basic numeric
* operations such as the elementary exponential, logarithm, square root, and
* trigonometric functions.
/** The package object `scala.math` contains methods for performing basic
* numeric operations such as the elementary exponential, logarithm,
* square root, and trigonometric functions.
*/
package object math extends MathCommon {
// These are new in 2.8, so they don't belong in the deprecated scala.Math.
def log10(x: Double): Double = java.lang.Math.log10(x)
def cbrt(x: Double): Double = java.lang.Math.cbrt(x)
def ulp(x: Double): Double = java.lang.Math.ulp(x)
def ulp(x: Float): Float = java.lang.Math.ulp(x)
def sinh(x: Double): Double = java.lang.Math.sinh(x)
@ -27,4 +27,4 @@ package object math extends MathCommon {
def hypot(x: Double, y: Double): Double = java.lang.Math.hypot(x, y)
def expm1(x: Double): Double = java.lang.Math.expm1(x)
def log1p(x: Double): Double = java.lang.Math.log1p(x)
}
}

View File

@ -6,17 +6,16 @@
** |/ **
\* */
package scala.ref
/**
* @see <code>java.lang.ref.Reference</code>
* @see `java.lang.ref.Reference`
* @author Sean McDirmid
*/
trait Reference[+T <: AnyRef] extends Function0[T] {
/** return the underlying value */
def apply(): T
/** return <code>Some</code> underlying if it hasn't been collected, otherwise <code>None</code> */
/** return `Some` underlying if it hasn't been collected, otherwise `None` */
def get: Option[T]
override def toString = get.map(_.toString).getOrElse("<deleted>")
def clear(): Unit

View File

@ -6,8 +6,6 @@
** |/ **
\* */
package scala.reflect
import annotation.target._
@ -23,9 +21,8 @@ import annotation.target._
* def setStatus(s: String) { this.status = s }
* def getStatus: String = this.status
* }}}
* For fields of type `Boolean`, if you need a getter
* named <code>isStatus</code>, use the
* `scala.reflect.BooleanBeanProperty` annotation instead.
* For fields of type `Boolean`, if you need a getter named `isStatus`,
* use the `scala.reflect.BooleanBeanProperty` annotation instead.
*/
@field
class BeanProperty extends annotation.StaticAnnotation

View File

@ -130,10 +130,10 @@ object NameTransformer {
unicode = true
} catch {
case _:NumberFormatException =>
/* <code>hex</code> did not decode to a hexadecimal number, so
/* `hex` did not decode to a hexadecimal number, so
* do nothing. */
}
}
}
}
}
/* If we didn't see an opcode or encoded Unicode glyph, and the

View File

@ -32,23 +32,25 @@ case class SingleType(pre: Type, sym: Symbol) extends Type
* clazz.this */
case class ThisType(clazz: Symbol) extends Type
/** This type is required by the compiler and <b>should not be used in client code</b>.
/** This type is required by the compiler and '''should not be used in client code'''.
* clazz.super[superClazz]
* <code>tpe[args1, ..., argsn]</code> */
* `tpe[args,,1,,, ..., args,,n,,]`
*/
case class AppliedType(tpe: Type, args: List[Type]) extends Type
/** This type is required by the compiler and <b>should not be used in client code</b>.
/** This type is required by the compiler and '''should not be used in client code'''.
* [a &lt;: lo &gt;: hi] */
case class TypeBounds(lo: Type, hi: Type) extends Type
/** This type is required by the compiler and <b>should not be used in client code</b>.
* <code>(formals1 ... formalsn) restpe</code> */
/** This type is required by the compiler and '''should not be used in client code'''.
* `(formals,,1,, ... formals,,n,,) restpe`
*/
case class MethodType(formals: List[Symbol], restpe: Type) extends Type
/** This type is required by the compiler and <b>should not be used in client code</b>. */
/** This type is required by the compiler and '''should not be used in client code'''. */
case class NullaryMethodType(resultType: Type) extends Type
/** This type is required by the compiler and <b>should not be used in client code</b>. */
/** This type is required by the compiler and '''should not be used in client code'''. */
case class PolyType(typeParams: List[Symbol], typeBounds: List[(Type, Type)], resultType: Type) extends Type
/* Standard pattern match:

View File

@ -61,7 +61,7 @@ package generic
writeByte((x & 0x7f).toInt)
}
/** Write a natural number <code>x</code> at position <code>pos</code>.
/** Write a natural number `x` at position `pos`.
* If number is more than one byte, shift rest of array to make space.
*
* @param pos ...
@ -150,9 +150,8 @@ package generic
result.toIndexedSeq
}
/** Perform operation <code>op</code> until the condition
* <code>readIndex == end</code> is satisfied.
* Concatenate results into a list.
/** Perform operation `op` until the condition `readIndex == end` is
* satisfied. Concatenate results into a list.
*
* @param end ...
* @param op ...
@ -161,8 +160,8 @@ package generic
def until[T](end: Int, op: () => T): List[T] =
if (readIndex == end) List() else op() :: until(end, op);
/** Perform operation <code>op</code> the number of
* times specified. Concatenate the results into a list.
/** Perform operation `op` the number of times specified.
* Concatenate the results into a list.
*/
def times[T](n: Int, op: ()=>T): List[T] =
if (n == 0) List() else op() :: times(n-1, op)

View File

@ -1,3 +1,11 @@
/* __ *\
** ________ ___ / / ___ Scala API **
** / __/ __// _ | / / / _ | (c) 2003-2011, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
package scala.reflect
package generic
@ -571,19 +579,19 @@ import Flags._
}
/** A synthetic term holding an arbitrary type. Not to be confused with
* with TypTree, the trait for trees that are only used for type trees.
* TypeTree's are inserted in several places, but most notably in
* <code>RefCheck</code>, where the arbitrary type trees are all replaced by
* `TypTree`, the trait for trees that are only used for type trees.
* `TypeTree`'s are inserted in several places, but most notably in
* `RefCheck`, where the arbitrary type trees are all replaced by
* TypeTree's. */
abstract class AbsTypeTree extends TypTree {
override def symbol = if (tpe == null) null else tpe.typeSymbol
override def isEmpty = (tpe eq null) || tpe == NoType
}
/** A tree that has an annotation attached to it. Only used for annotated types and
* annotation ascriptions, annotations on definitions are stored in the Modifiers.
* Eliminated by typechecker (typedAnnotated), the annotations are then stored in
* an AnnotatedType.
/** A tree that has an annotation attached to it. Only used for annotated
* types and annotation ascriptions, annotations on definitions are stored
* in the Modifiers. Eliminated by typechecker (`typedAnnotated`), the
* annotations are then stored in an `AnnotatedType`.
*/
case class Annotated(annot: Tree, arg: Tree) extends Tree

View File

@ -147,9 +147,9 @@ abstract class UnPickler {
result
}
/** If entry at <code>i</code> is undefined, define it by performing
* operation <code>op</code> with <code>readIndex at start of i'th
* entry. Restore <code>readIndex</code> afterwards.
/** If entry at `i` is undefined, define it by performing operation `op`
* with `readIndex` at start of `i`'th entry. Restore `readIndex`
* afterwards.
*/
protected def at[T <: AnyRef](i: Int, op: () => T): T = {
var r = entries(i)

View File

@ -1,20 +1,16 @@
/* __ *\
** ________ ___ / / ___ Scala API **
** / __/ __// _ | / / / _ | (c) 2003-2011, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | **
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
package scala.runtime
/**
* Dummy class which exist only to satisfy the JVM. It corresponds
* to <code>scala.Nothing</code>. If such type appears in method
* to `scala.Nothing`. If such type appears in method
* signatures, it is erased to this one.
*/
sealed abstract class Nothing$ extends Throwable

View File

@ -1,20 +1,16 @@
/* __ *\
** ________ ___ / / ___ Scala API **
** / __/ __// _ | / / / _ | (c) 2003-2011, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | **
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
package scala.runtime
/**
* Dummy class which exist only to satisfy the JVM. It corresponds
* to <code>scala.Null</code>. If such type appears in method
* signatures, it is erased to this one.
* Dummy class which exist only to satisfy the JVM. It corresponds to
* `scala.Null`. If such type appears in method signatures, it is erased
* to this one.
*/
sealed abstract class Null$

View File

@ -19,7 +19,7 @@ final class RichFloat(val self: Float) extends FractionalProxy[Float] {
* angle measured in radians.
*
* @param x an angle, in degrees
* @return the measurement of the angle <code>x</code> in radians.
* @return the measurement of the angle `x` in radians.
*/
def toRadians: Float = math.toRadians(self).toFloat
@ -27,7 +27,7 @@ final class RichFloat(val self: Float) extends FractionalProxy[Float] {
* angle measured in degrees.
*
* @param x angle, in radians
* @return the measurement of the angle <code>x</code> in degrees.
* @return the measurement of the angle `x` in degrees.
*/
def toDegrees: Float = math.toDegrees(self).toFloat

View File

@ -6,17 +6,14 @@
** **
\* */
package scala.runtime
final class StringAdd(self: Any) {
def +(other: String) = String.valueOf(self) + other
/** Returns string formatted according to given <code>format</code> string.
* Format strings are as for <code>String.format</code>
/** Returns string formatted according to given `format` string.
* Format strings are as for `String.format`
* (@see java.lang.String.format).
*/
def formatted(fmtstr: String): String = fmtstr format self

View File

@ -6,11 +6,8 @@
** |/ **
\* */
package scala.text
import java.io.Writer
case object DocNil extends Document
@ -34,8 +31,8 @@ abstract class Document {
def :/:(hd: String): Document = hd :: DocBreak :: this
/**
* Format this document on <code>writer</code> and try to set line
* breaks so that the result fits in <code>width</code> columns.
* Format this document on `writer` and try to set line
* breaks so that the result fits in `width` columns.
*
* @param width ...
* @param writer ...

View File

@ -6,15 +6,14 @@
** |/ **
\* */
package scala.util.parsing.input
import java.io.BufferedReader
import scala.collection.immutable.PagedSeq
/** An object to create a StreamReader from a <code>java.io.Reader</code>.
/** An object to create a `StreamReader` from a `java.io.Reader`.
*
* @param in the <code>java.io.Reader</code> that provides the underlying
* @param in the `java.io.Reader` that provides the underlying
* stream of characters for this Reader.
*
* @author Miles Sabin
@ -38,7 +37,7 @@ object StreamReader {
* when a StreamReader are used for input.
*
* If you need to match regexes spanning several lines you should consider
* class <code>PagedSeqReader</code> instead.
* class `PagedSeqReader` instead.
*
* @author Miles Sabin
* @author Martin Odersky

View File

@ -6,14 +6,13 @@
** |/ **
\* */
package scala.xml
/** The class <code>Atom</code> provides an XML node for text (PCDATA).
/** The class `Atom` provides an XML node for text (`PCDATA`).
* It is used in both non-bound and bound XML representations.
*
* @author Burak Emir
* @param text the text contained in this node, may not be <code>null</code>.
* @param text the text contained in this node, may not be `'''null'''`.
*/
class Atom[+A](val data: A) extends SpecialNode with Serializable
{

View File

@ -6,12 +6,9 @@
** |/ **
\* */
package scala.xml
/** The class <code>Comment</code> implements an XML node for comments.
/** The class `Comment` implements an XML node for comments.
*
* @author Burak Emir
* @param text the text contained in this node, may not contain "--"

View File

@ -6,14 +6,12 @@
** |/ **
\* */
package scala.xml
/** A document information item (according to InfoSet spec). The comments
* are copied from the Infoset spec, only augmented with some information
* on the Scala types for definitions that might have no value.
* also plays the role of an <code>XMLEvent</code> for pull parsing
* Also plays the role of an `XMLEvent` for pull parsing.
*
* @author Burak Emir
* @version 1.0, 26/04/2005
@ -62,14 +60,14 @@ class Document extends NodeSeq with pull.XMLEvent with Serializable {
/** An indication of the standalone status of the document, either
* true or false. This property is derived from the optional standalone
* document declaration in the XML declaration at the beginning of the
* document entity, and has no value (<code>None</code>) if there is no
* document entity, and has no value (`None`) if there is no
* standalone document declaration.
*/
var standAlone: Option[Boolean] = _
/** A string representing the XML version of the document. This
* property is derived from the XML declaration optionally present at
* the beginning of the document entity, and has no value (<code>None</code>)
* the beginning of the document entity, and has no value (`None`)
* if there is no XML declaration.
*/
var version: Option[String] = _

View File

@ -6,16 +6,16 @@
** |/ **
\* */
package scala.xml
/** This singleton object contains the apply and unapplySeq methods for convenient construction and
* deconstruction. It is possible to deconstruct any Node instance (that is not a SpecialNode or
* a Group) using the syntax
* <code> case Elem(prefix, label, attribs, scope, child @ _*) => ... </code>
/** This singleton object contains the apply and unapplySeq methods for
* convenient construction and deconstruction. It is possible to deconstruct
* any `Node` instance (that is not a `SpecialNode` or a `Group`) using the
* syntax `case Elem(prefix, label, attribs, scope, child @ _*) => ...`
*
* Copyright 2008 Google Inc. All Rights Reserved.
* @author Burak Emir <bqe@google.com>
* Copyright 2008 Google Inc. All Rights Reserved.
*
* @author Burak Emir <bqe@google.com>
*/
object Elem {
def apply(prefix: String,label: String, attributes: MetaData, scope: NamespaceBinding, child: Node*) =
@ -27,7 +27,7 @@ object Elem {
}
}
/** The case class <code>Elem</code> extends the <code>Node</code> class,
/** The case class `Elem` extends the `Node` class,
* providing an immutable data object representing an XML element.
*
* @param prefix namespace prefix (may be null, but not the empty string)
@ -83,8 +83,7 @@ extends Node with Serializable
child: Seq[Node] = this.child.toSeq
): Elem = Elem(prefix, label, attributes, scope, child: _*)
/** Returns concatenation of <code>text(n)</code> for each child
* <code>n</code>.
/** Returns concatenation of `text(n)` for each child `n`.
*/
override def text = child map (_.text) mkString
}

View File

@ -6,14 +6,9 @@
** |/ **
\* */
package scala.xml
/** The class <code>EntityRef</code> implements an XML node for entity
* references.
/** The class `EntityRef` implements an XML node for entity references.
*
* @author Burak Emir
* @version 1.0
@ -33,10 +28,10 @@ case class EntityRef(entityName: String) extends SpecialNode {
case _ => Utility.sbToString(buildString)
}
/** Appends "&amp; entityName;" to this string buffer.
/** Appends `"&amp; entityName;"` to this string buffer.
*
* @param sb the string buffer.
* @return the modified string buffer <code>sb</code>.
* @return the modified string buffer `sb`.
*/
override def buildString(sb: StringBuilder) =
sb.append("&").append(entityName).append(";")

View File

@ -6,7 +6,6 @@
** |/ **
\* */
package scala.xml
import Utility.sbToString
@ -20,10 +19,12 @@ import scala.collection.Iterator
object MetaData {
/**
* appends all attributes from new_tail to attribs, without attempting to detect
* or remove duplicates. The method guarantees that all attributes from attribs come before
* the attributes in new_tail, but does not guarantee to preserve the relative order of attribs.
* Duplicates can be removed with normalize.
* appends all attributes from new_tail to attribs, without attempting to
* detect or remove duplicates. The method guarantees that all attributes
* from attribs come before the attributes in new_tail, but does not
* guarantee to preserve the relative order of attribs.
*
* Duplicates can be removed with `normalize`.
*/
@tailrec
def concatenate(attribs: MetaData, new_tail: MetaData): MetaData =
@ -60,16 +61,17 @@ object MetaData {
}
/** <p>
* This class represents an attribute and at the same time a linked list of attributes.
* Every instance of this class is either an instance of UnprefixedAttribute <code>key,value</code>
* or an instance of PrefixedAttribute <code>namespace_prefix,key,value</code> or Null, the empty
* attribute list. Namespace URIs are obtained by using the namespace scope of the element owning
* this attribute (see <code>getNamespace</code>)
* </p>
/** This class represents an attribute and at the same time a linked list of
* attributes. Every instance of this class is either
* - an instance of `UnprefixedAttribute key,value` or
* - an instance of `PrefixedAttribute namespace_prefix,key,value` or
* - `Null, the empty attribute list.
*
* Copyright 2008 Google Inc. All Rights Reserved.
* @author Burak Emir <bqe@google.com>
* Namespace URIs are obtained by using the namespace scope of the element
* owning this attribute (see `getNamespace`).
*
* Copyright 2008 Google Inc. All Rights Reserved.
* @author Burak Emir <bqe@google.com>
*/
abstract class MetaData extends Iterable[MetaData] with Equality with Serializable {
/** Updates this MetaData with the MetaData given as argument. All attributes that occur in updates
@ -91,7 +93,7 @@ abstract class MetaData extends Iterable[MetaData] with Equality with Serializab
*/
def apply(key: String): Seq[Node]
/** convenience method, same as <code>apply(namespace, owner.scope, key)</code>.
/** convenience method, same as `apply(namespace, owner.scope, key)`.
*
* @param namespace_uri namespace uri of key
* @param owner the element owning this attribute list
@ -207,7 +209,7 @@ abstract class MetaData extends Iterable[MetaData] with Equality with Serializab
/**
* @param scope ...
* @return <code>true</code> iff ...
* @return `'''true'''` iff ...
*/
def wellformed(scope: NamespaceBinding): Boolean

View File

@ -6,14 +6,11 @@
** |/ **
\* */
package scala.xml
import Utility.sbToString
/** The class <code>NamespaceBinding</code> represents namespace bindings
/** The class `NamespaceBinding` represents namespace bindings
* and scopes. The binding for the default namespace is treated as a null
* prefix. the absent namespace is represented with the null uri. Neither
* prefix nor uri may be empty, which is not checked.

View File

@ -6,7 +6,6 @@
** |/ **
\* */
package scala.xml
/**
@ -61,8 +60,8 @@ abstract class Node extends NodeSeq {
def namespace = getNamespace(this.prefix)
/**
* Convenience method, same as <code>scope.getURI(pre)</code> but additionally
* checks if scope is <code>null</code>.
* Convenience method, same as `scope.getURI(pre)` but additionally
* checks if scope is `'''null'''`.
*
* @param pre the prefix whose namespace name we would like to obtain
* @return the namespace if <code>scope != null</code> and prefix was
@ -72,7 +71,7 @@ abstract class Node extends NodeSeq {
/**
* Convenience method, looks up an unprefixed attribute in attributes of this node.
* Same as <code>attributes.getValue(key)</code>
* Same as `attributes.getValue(key)`
*
* @param key of queried attribute.
* @return value of <code>UnprefixedAttribute</code> with given key
@ -82,20 +81,20 @@ abstract class Node extends NodeSeq {
/**
* Convenience method, looks up a prefixed attribute in attributes of this node.
* Same as <code>attributes.getValue(uri, this, key)</code>
* Same as `attributes.getValue(uri, this, key)`-
*
* @param uri namespace of queried attribute (may not be null).
* @param key of queried attribute.
* @return value of <code>PrefixedAttribute</code> with given namespace
* and given key, otherwise <code>null</code>.
* @return value of `PrefixedAttribute` with given namespace
* and given key, otherwise `'''null'''`.
*/
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 <code>Node</code>, this
* defaults to <code>Null</code> (the empty attribute list).
* unprefixed, in no particular order. In class `Node`, this
* defaults to `Null` (the empty attribute list).
*
* @return all attributes of this node
*/
@ -160,28 +159,28 @@ abstract class Node extends NodeSeq {
Utility.toXML(this, stripComments = stripComments).toString
/**
* Same as <code>toString(false)</code>.
* Same as `toString('''false''')`.
*
* @see <code><a href="#toString">toString(Boolean)</a></code>
*/
override def toString(): String = buildString(false)
/**
* Appends qualified name of this node to <code>StringBuilder</code>.
* Appends qualified name of this node to `StringBuilder`.
*
* @param sb ...
* @return ...
*/
def nameToString(sb: StringBuilder): StringBuilder = {
if (null != prefix) {
sb.append(prefix)
sb.append(':')
sb append prefix
sb append ':'
}
sb.append(label)
sb append label
}
/**
* Returns a type symbol (e.g. DTD, XSD), default <code>null</code>.
* Returns a type symbol (e.g. DTD, XSD), default `'''null'''`.
*/
def xmlType(): TypeSymbol = null

View File

@ -98,7 +98,7 @@ object Utility extends AnyRef with parsing.TokenTests {
import Escapes.{ escMap, unescMap }
/**
* Appends escaped string to <code>s</code>.
* Appends escaped string to `s`.
*
* @param text ...
* @param s ...
@ -134,8 +134,7 @@ object Utility extends AnyRef with parsing.TokenTests {
*
* @param ref ...
* @param s ...
* @return <code>null</code> if <code>ref</code> was not a predefined
* entity.
* @return `'''null'''` if `ref` was not a predefined entity.
*/
final def unescape(ref: String, s: StringBuilder): StringBuilder =
(unescMap get ref) map (s append _) orNull
@ -271,7 +270,7 @@ object Utility extends AnyRef with parsing.TokenTests {
def appendQuoted(s: String): String = sbToString(appendQuoted(s, _))
/**
* Appends &quot;s&quot; if string <code>s</code> does not contain &quot;,
* Appends &quot;s&quot; if string `s` does not contain &quot;,
* &apos;s&apos; otherwise.
*
* @param s ...

View File

@ -6,8 +6,6 @@
** |/ **
\* */
package scala.xml
import parsing.NoBindingFactoryAdapter
@ -30,9 +28,9 @@ object Source
}
import Source._
/** The object <code>XML</code> provides constants, and functions to load
/** The object `XML` provides constants, and functions to load
* and save XML elements. Use this when data binding is not desired, i.e.
* when XML is handled using <code>Symbol</code> nodes.
* when XML is handled using `Symbol` nodes.
*
* @author Burak Emir
* @version 1.0, 25/04/2005
@ -89,7 +87,7 @@ object XML extends XMLLoader[Elem]
*
* @param w the writer
* @param node the xml node we want to write
* @param enc the string to be used in <code>xmlDecl</code>
* @param enc the string to be used in `xmlDecl`
* @param xmlDecl if true, write xml declaration
* @param doctype if not null, write doctype declaration
*/

View File

@ -6,39 +6,33 @@
** |/ **
\* */
package scala.xml
package include
/**
* <p>
* <code>XIncludeException</code> is the generic superclass
* for all checked exceptions that may be thrown as a result
* of a violation of XInclude's rules.
* </p>
* <p>
* Constructs an <code>XIncludeException</code> with the specified detail
* message. The error message string <code>message</code> can later be
* retrieved by the <code>{@link java.lang.Throwable#getMessage}</code>
* method of class <code>java.lang.Throwable</code>.
* </p>
* `XIncludeException` is the generic superclass for all checked exceptions
* that may be thrown as a result of a violation of XInclude's rules.
*
* Constructs an `XIncludeException` with the specified detail message.
* The error message string `message` can later be retrieved by the
* `{@link java.lang.Throwable#getMessage}`
* method of class `java.lang.Throwable`.
*
* @param message the detail message.
*/
class XIncludeException(message: String) extends Exception(message) {
/**
* uses <code>null</code> as its error detail message.
* uses `'''null'''` as its error detail message.
*/
def this() = this(null)
private var rootCause: Throwable = null
/**
* When an <code>IOException</code>, <code>MalformedURLException</code>
* or other generic exception is thrown while processing an XML document
* for XIncludes, it is customarily replaced
* by some form of <code>XIncludeException</code>.
* When an `IOException`, `MalformedURLException` or other generic
* exception is thrown while processing an XML document for XIncludes,
* it is customarily replaced by some form of `XIncludeException`.
* This method allows you to store the original exception.
*
* @param nestedException the underlying exception which
@ -49,15 +43,14 @@ class XIncludeException(message: String) extends Exception(message) {
}
/**
* When an <code>IOException</code>, <code>MalformedURLException</code>
* or other generic exception is thrown while processing an XML document
* for XIncludes, it is customarily replaced
* by some form of <code>XIncludeException</code>.
* When an `IOException`, `MalformedURLException` or other generic
* exception is thrown while processing an XML document for XIncludes,
* it is customarily replaced by some form of `XIncludeException`.
* This method allows you to retrieve the original exception.
* It returns null if no such exception caused this <code>XIncludeException</code>.
* It returns null if no such exception caused this `XIncludeException`.
*
* @return Throwable the underlying exception which caused the
* <code>XIncludeException</code> to be thrown
* `XIncludeException` to be thrown
*/
def getRootCause(): Throwable = this.rootCause

View File

@ -6,7 +6,6 @@
** |/ **
\* */
package scala.xml
package include.sax
@ -19,57 +18,40 @@ import java.io.{ InputStream, BufferedInputStream, InputStreamReader, IOExceptio
import java.util.Stack
import java.net.{ URL, MalformedURLException }
/**
* <p>
* This is a SAX filter which resolves all XInclude include elements
* before passing them on to the client application. Currently this
* class has the following known deviation from the XInclude specification:
* </p>
* <ol>
* <li>XPointer is not supported.</li>
* </ol>
/** This is a SAX filter which resolves all XInclude include elements before
* passing them on to the client application. Currently this class has the
* following known deviation from the XInclude specification:
*
* 1. XPointer is not supported.
*
* Furthermore, I would definitely use a new instance of this class for each
* document you want to process. I doubt it can be used successfully on
* multiple documents. Furthermore, I can virtually guarantee that this
* class is not thread safe. You have been warned.
*
* <p>
* Furthermore, I would definitely use a new instance of this class
* for each document you want to process. I doubt it can be used
* successfully on multiple documents. Furthermore, I can virtually
* guarantee that this class is not thread safe. You have been
* warned.
* </p>
* Since this class is not designed to be subclassed, and since I have not
* yet considered how that might affect the methods herein or what other
* protected methods might be needed to support subclasses, I have declared
* this class final. I may remove this restriction later, though the use-case
* for subclassing is weak. This class is designed to have its functionality
* extended via a horizontal chain of filters, not a vertical hierarchy of
* sub and superclasses.
*
* <p>
* Since this class is not designed to be subclassed, and since
* I have not yet considered how that might affect the methods
* herein or what other protected methods might be needed to support
* subclasses, I have declared this class final. I may remove this
* restriction later, though the use-case for subclassing is weak.
* This class is designed to have its functionality extended via a
* a horizontal chain of filters, not a
* vertical hierarchy of sub and superclasses.
* </p>
*
* <p>
* To use this class:
* </p>
* <ol>
* <li>Construct an <code>XIncludeFilter</code> object with a known base URL</li>
* <li>Pass the <code>XMLReader</code> object from which the raw document will
* be read to the <code>setParent()</code> method of this object. </li>
* <li>Pass your own <code>ContentHandler</code> object to the
* <code>setContentHandler()</code> method of this object. This is the
* object which will receive events from the parsed and included
* document.
* </li>
* <li>Optional: if you wish to receive comments, set your own
* <code>LexicalHandler</code> object as the value of this object's
* http://xml.org/sax/properties/lexical-handler property.
* Also make sure your <code>LexicalHandler</code> asks this object
* for the status of each comment using <code>insideIncludeElement</code>
* before doing anything with the comment.
* </li>
* <li>Pass the URL of the document to read to this object's
* <code>parse()</code> method</li>
* </ol>
* To use this class:
*
* - Construct an `XIncludeFilter` object with a known base URL
* - Pass the `XMLReader` object from which the raw document will be read to
* the `setParent()` method of this object.
* - Pass your own `ContentHandler` object to the `setContentHandler()`
* method of this object. This is the object which will receive events
* from the parsed and included document.
* - Optional: if you wish to receive comments, set your own `LexicalHandler`
* object as the value of this object's
* `http://xml.org/sax/properties/lexical-handler` property.
* Also make sure your `LexicalHandler` asks this object for the status of
* each comment using `insideIncludeElement` before doing anything with the
* comment.
* - Pass the URL of the document to read to this object's `parse()` method
*
* e.g.
* {{{
@ -79,6 +61,7 @@ import java.net.{ URL, MalformedURLException }
* includer parse args(i)
* }}}
* translated from Elliotte Rusty Harold's Java source.
*
* @author Burak Emir
*/
class XIncludeFilter extends XMLFilterImpl {
@ -119,15 +102,12 @@ class XIncludeFilter extends XMLFilterImpl {
// necessary to throw away contents of non-empty XInclude elements
private var level = 0
/**
* <p>
* This utility method returns true if and only if this reader is
* currently inside a non-empty include element. (This is <strong>
* not</strong> the same as being inside the node set which replaces
* the include element.) This is primarily needed for comments
* inside include elements. It must be checked by the actual
* LexicalHandler to see whether a comment is passed or not.
* </p>
/** This utility method returns true if and only if this reader is
* currently inside a non-empty include element. (This is '''not''' the
* same as being inside the node set which replaces the include element.)
* This is primarily needed for comments inside include elements.
* It must be checked by the actual `LexicalHandler` to see whether
* a comment is passed or not.
*
* @return boolean
*/

View File

@ -6,8 +6,6 @@
** |/ **
\* */
package scala.swing
import java.io.File
@ -16,16 +14,16 @@ import javax.swing.filechooser._
object FileChooser {
/**
* The result of a file dialog. The precise meaning of the <code>Approve</code>
* result depends on the specific dialog type. Could be "save" or "open" for
* example.
* The result of a file dialog. The precise meaning of the `Approve`
* result depends on the specific dialog type. Could be `"save"` or
* `"open"` for instance.
*/
object Result extends Enumeration {
val Cancel = Value(JFileChooser.CANCEL_OPTION)
val Approve = Value(JFileChooser.APPROVE_OPTION)
val Error = Value(JFileChooser.ERROR_OPTION)
}
/**
* The kind of elements a user can select in a file dialog.
*/
@ -39,51 +37,51 @@ object FileChooser {
/**
* Used to open file dialogs.
*
* @see javax.swing.JFileChooser
* @see [[javax.swing.JFileChooser]]
*/
class FileChooser(dir: File) {
import FileChooser._
lazy val peer: JFileChooser = new JFileChooser(dir)
def this() = this(null)
import Swing._
def showOpenDialog(over: Component): Result.Value = Result(peer.showOpenDialog(nullPeer(over)))
def showSaveDialog(over: Component): Result.Value = Result(peer.showSaveDialog(nullPeer(over)))
def showDialog(over: Component, approveText: String): Result.Value = Result(peer.showDialog(nullPeer(over), approveText))
def controlButtonsAreShown: Boolean = peer.getControlButtonsAreShown
def controlButtonsAreShown_=(b: Boolean) { peer.setControlButtonsAreShown(b) }
def title: String = peer.getDialogTitle
def title_=(t: String) { peer.setDialogTitle(t) }
def accessory: Component = UIElement.cachedWrapper[Component](peer.getAccessory)
def accessory_=(c: Component) { peer.setAccessory(c.peer) }
def fileHidingEnabled: Boolean = peer.isFileHidingEnabled
def fileHidingEnabled_=(b: Boolean) { peer.setFileHidingEnabled(b) }
def fileSelectionMode: SelectionMode.Value = SelectionMode(peer.getFileSelectionMode)
def fileSelectionMode_=(s: SelectionMode.Value) { peer.setFileSelectionMode(s.id) }
def fileFilter: FileFilter = peer.getFileFilter
def fileFilter_=(f: FileFilter) { peer.setFileFilter(f) }
def fileFilter_=(f: FileFilter) { peer setFileFilter f }
def selectedFile: File = peer.getSelectedFile
def selectedFile_=(file: File) { peer.setSelectedFile(file) }
def selectedFiles: Seq[File] = peer.getSelectedFiles
def selectedFiles_=(files: File*) { peer.setSelectedFiles(files.toArray) }
def multiSelectionEnabled: Boolean = peer.isMultiSelectionEnabled
def multiSelectionEnabled_=(b: Boolean) { peer.setMultiSelectionEnabled(b) }
def iconFor(f: File) = peer.getIcon(f)
def descriptionFor(f: File) = peer.getDescription(f)
def nameFor(f: File) = peer.getName(f)
def typeDescriptionFor(f: File) = peer.getTypeDescription(f)
def traversable(f: File) = peer.isTraversable(f)
def acceptAllFileFilter = peer.getAcceptAllFileFilter
/*peer.addPropertyChangeListener(new java.beans.PropertyChangeListener {
def propertyChange(e: java.beans.PropertyChangeEvent) {
import JFileChooser._

View File

@ -6,22 +6,19 @@
** |/ **
\* */
package scala.swing
import javax.swing.JComponent
import scala.collection.mutable
/** <p>
* A container that associates layout constraints of member type
* <code>Constraints</code> with its children. See <code>GridBagPanel</code>
* for an example container with custom constraints.
* </p>
/** A container that associates layout constraints of member type
* `Constraints` with its children.
*
* See `GridBagPanel` for an example container with custom constraints.
*
* @note [Java Swing] In scala.swing, panels and layout managers are
* combined into subclasses of this base class. This approach allows for typed
* component constraints.
* combined into subclasses of this base class. This approach allows for
* typed component constraints.
*/
trait LayoutContainer extends Container.Wrapper {
/**

View File

@ -6,23 +6,22 @@
** |/ **
\* */
package scala.swing
import javax.swing._
/**
* Extend this class for most simple UI applications. Clients need to implement the
* <code>top</code> method. Framework initialization is done by this class.
* Extend this class for most simple UI applications. Clients need to
* implement the `top` method. Framework initialization is done by this class.
*
* In order to conform to Swing's threading policy, never implement top or any additional
* member that created Swing components as a value unless component creation happens on
* the EDT (see Swing.onEDT and Swing.onEDTWait). Lazy values are okay for the same reason
* if they are initialized on the EDT always.
* In order to conform to Swing's threading policy, never implement top or any
* additional member that created Swing components as a value unless component
* creation happens on the EDT (see `Swing.onEDT` and `Swing.onEDTWait`).
* Lazy values are okay for the same reason if they are initialized on the EDT
* always.
*/
@deprecated("Use SimpleSwingApplication instead", "2.8.0") abstract class SimpleGUIApplication extends GUIApplication {
/**
* A GUI application's version of the main method. Called by the default
* main method implementation provided by this class.
@ -38,10 +37,10 @@ import javax.swing._
t.pack()
t.visible = true
}
def resourceFromClassloader(path: String): java.net.URL =
this.getClass.getResource(path)
def resourceFromUserDirectory(path: String): java.io.File =
new java.io.File(util.Properties.userDir, path)
}

View File

@ -21,7 +21,7 @@ object UIElement {
case p: javax.swing.JComponent => p.putClientProperty(ClientKey, e)
case _ => wrapperCache.put(e.peer, new WeakReference(e))
}
/**
* Looks up the internal component cache for a wrapper of the given
* Java Swing peer. If this method finds one of the given type `C`,
@ -39,13 +39,13 @@ object UIElement {
}
try { w.asInstanceOf[C] } catch { case _ => null }
}
/**
* Returns a wrapper for a given Java Swing peer. If there is a
* compatible wrapper in use, this method will return it.
*
* `wrap` methods in companion objects of subclasses of UIElement have the
* same behavior, except that they return more specific wrappers.
* `wrap` methods in companion objects of subclasses of `UIElement` have
* the same behavior, except that they return more specific wrappers.
*/
def wrap(c: java.awt.Component): UIElement = {
val w = cachedWrapper[UIElement](c)
@ -57,7 +57,7 @@ object UIElement {
/**
* The base trait of all user interface elements. Subclasses belong to one
* of two groups: top-level elements such as windows and dialogs, or
* <code>Component</code>s.
* `Component`s.
*
* @note [Java Swing] This trait does not have an exact counterpart in
* Java Swing. The peer is of type java.awt.Component since this is the
@ -74,24 +74,24 @@ trait UIElement extends Proxy with LazyPublisher {
*/
def peer: java.awt.Component
def self = peer
UIElement.cache(this)
def foreground: Color = peer.getForeground
def foreground_=(c: Color) = peer.setForeground(c)
def foreground_=(c: Color) = peer setForeground c
def background: Color = peer.getBackground
def background_=(c: Color) = peer.setBackground(c)
def background_=(c: Color) = peer setBackground c
def minimumSize = peer.getMinimumSize
def minimumSize_=(x: Dimension) = peer.setMinimumSize(x)
def minimumSize_=(x: Dimension) = peer setMinimumSize x
def maximumSize = peer.getMaximumSize
def maximumSize_=(x: Dimension) = peer.setMaximumSize(x)
def maximumSize_=(x: Dimension) = peer setMaximumSize x
def preferredSize = peer.getPreferredSize
def preferredSize_=(x: Dimension) = peer.setPreferredSize(x)
def preferredSize_=(x: Dimension) = peer setPreferredSize x
def font: Font = peer.getFont
def font_=(f: Font) = peer.setFont(f)
def font_=(f: Font) = peer setFont f
def locationOnScreen = peer.getLocationOnScreen
def location = peer.getLocation
def bounds = peer.getBounds
@ -102,20 +102,20 @@ trait UIElement extends Proxy with LazyPublisher {
def locale = peer.getLocale
def toolkit = peer.getToolkit
def cursor: Cursor = peer.getCursor
def cursor_=(c: Cursor) { peer.setCursor(c) }
def visible: Boolean = peer.isVisible
def visible_=(b: Boolean) { peer.setVisible(b) }
def showing: Boolean = peer.isShowing
def displayable: Boolean = peer.isDisplayable
def repaint() { peer.repaint }
def repaint(rect: Rectangle) { peer.repaint(rect.x, rect.y, rect.width, rect.height) }
def ignoreRepaint: Boolean = peer.getIgnoreRepaint
def ignoreRepaint_=(b: Boolean) { peer.setIgnoreRepaint(b) }
protected def onFirstSubscribe() {
peer.addComponentListener(new java.awt.event.ComponentListener {
def componentHidden(e: java.awt.event.ComponentEvent) {

View File

@ -11,13 +11,12 @@
package scala.swing
package event
/** <p>
* An event that indicates some editing operation that can be still in
* progress.<br/>
* Example: dragging a slider creates a number of <code>AdjustmentEvents</code>
* with <code>adjusting == true</code> until the user finally releases the
* mouse button.
* </p>
/** An event that indicates some editing operation that can be still
* in progress.
*
* Example: dragging a slider creates a number of `AdjustmentEvents`
* with `adjusting == '''true'''` until the user finally releases the
* mouse button.
*/
trait AdjustingEvent extends ComponentEvent {
def adjusting: Boolean