summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormichelou <michelou@epfl.ch>2006-11-15 12:46:18 +0000
committermichelou <michelou@epfl.ch>2006-11-15 12:46:18 +0000
commit821551dd7f72b70b786919efcb58c88a236685ce (patch)
treea94e98e5792898523c67b93323886bc05cfda9ed
parentd26dfbdf59f03da6adc2eb87754ba56f142dc06e (diff)
downloadscala-821551dd7f72b70b786919efcb58c88a236685ce.tar.gz
scala-821551dd7f72b70b786919efcb58c88a236685ce.tar.bz2
scala-821551dd7f72b70b786919efcb58c88a236685ce.zip
improved output of inherited members in DocGene...
improved output of inherited members in DocGenerator
-rw-r--r--src/compiler/scala/tools/nsc/doc/DocGenerator.scala59
-rw-r--r--src/compiler/scala/tools/nsc/models/Models.scala8
-rw-r--r--src/library/scala/collection/immutable/ListMap.scala38
-rw-r--r--src/library/scala/collection/mutable/BitSet.scala22
4 files changed, 67 insertions, 60 deletions
diff --git a/src/compiler/scala/tools/nsc/doc/DocGenerator.scala b/src/compiler/scala/tools/nsc/doc/DocGenerator.scala
index b3238cd619..cdf5bc218a 100644
--- a/src/compiler/scala/tools/nsc/doc/DocGenerator.scala
+++ b/src/compiler/scala/tools/nsc/doc/DocGenerator.scala
@@ -151,15 +151,15 @@ abstract class DocGenerator extends Models {
})
}
- private val pat = Pattern.compile(
+ private val patVal = Pattern.compile(
"scala\\.(Byte|Boolean|Char|Double|Float|Int|Long|Short)")
def docName(sym: Symbol): String = {
def javaParams(paramTypes: List[Type]): String = {
def javaName(pt: Type): String = {
val s = pt.toString
- val mat = pat.matcher(s)
- if (mat.matches) mat.group(1).toLowerCase
+ val matVal = patVal.matcher(s)
+ if (matVal.matches) matVal.group(1).toLowerCase
else s.replaceAll("\\$", ".")
}
paramTypes.map(pt => javaName(pt)).mkString("(", ",", ")")
@@ -385,7 +385,6 @@ abstract class DocGenerator extends Models {
case cmod: ImplMod =>
<span>
{ listMembersShort(mmbr) }
- <!--{ listInheritedMembers(mmbr) }-->
{ listMembersFull(mmbr) }
</span>
case _ =>
@@ -424,13 +423,13 @@ abstract class DocGenerator extends Models {
*/
def listInheritedMembers(sym: Symbol, kind: Kind): NodeSeq = {
val ignored = List(definitions.ObjectClass, definitions.ScalaObjectClass)
- def hasKind(sym: Symbol) =
- (kind == DEF && sym.isMethod && !sym.isConstructor)
- (kind == VAR && sym.isVariable)
- (kind == VAL && sym.isValue && !sym.isVariable)
+ def isVisible(sym: Symbol) =
+ (kind == DEF && sym.isMethod && !sym.isConstructor && !sym.hasFlag(Flags.ACCESSOR)) ||
+ (kind == VAR && sym.isVariable) ||
+ (kind == VAL && sym.isValue && !sym.isVariable && sym.hasGetter)
val parents = sym.info.parents
for (val p <- parents; !ignored.contains(p.symbol);
- val decls = p.decls.toList filter(member => hasKind(member));
+ val decls = p.decls.toList filter(member => isVisible(member));
!decls.isEmpty) yield Group(
<table cellpadding="3" class="inherited" summary="">
<tr>
@@ -438,30 +437,24 @@ abstract class DocGenerator extends Models {
{Text(kind.toString + " inherited from ").concat(urlFor(p, contentFrame))}
</td>
</tr>
- <tr>
- { {
- //val decls = p.decls.toList filter(member => hasKind(member))
- //if (decls.isEmpty) NodeSeq.Empty // scope empty
- /*else*/ {
- def aref1(sym: Symbol): NodeSeq = {
- val isJava = sym hasFlag Flags.JAVA
- if (isJava || (sym.sourceFile eq null)) {
- <a class={sym.owner.fullNameString.replace('.', '_')}
- href={"#" + docName(sym)}
- target={contentFrame}>{sym.nameString}</a>
- }
- else
- aref(urlFor(sym), contentFrame, sym.nameString)
+ <tr> {
+ def aref1(sym: Symbol): NodeSeq = {
+ val isJava = sym hasFlag Flags.JAVA
+ if (isJava || (sym.sourceFile eq null)) {
+ <a class={sym.owner.fullNameString.replace('.', '_')}
+ href={"#" + docName(sym)}
+ target={contentFrame}>{sym.nameString}</a>
}
- val members = decls.sort(
- (x, y) => (x.nameString compareTo y.nameString) < 0)
- <td colspan="2" class="signature">
- {aref1(members.head)}
- {for (val m <- members.tail) yield Text(", ").concat(aref1(m))}
- </td>
+ else
+ aref(urlFor(sym), contentFrame, sym.nameString)
}
- } }
- </tr>
+ val members = decls.sort(
+ (x, y) => (x.nameString compareTo y.nameString) < 0)
+ <td colspan="2" class="signature">
+ {aref1(members.head)}
+ {for (val m <- members.tail) yield Text(", ").concat(aref1(m))}
+ </td>
+ } </tr>
</table>)
}
@@ -502,7 +495,7 @@ abstract class DocGenerator extends Models {
def shortHeader(mmbr: HasTree): NodeSeq =
<tr>
<td valign="top" class="modifiers">
- { { for (val str <- stringsFor(mmbr.mods)) yield <code>{(Text(str + " "))}</code>; } }
+ { for (val str <- stringsFor(mmbr.mods)) yield <code>{(Text(str + " "))}</code> }
</td>
<td class="signature">
<code>{Text(codeFor(mmbr.kind))}</code>
@@ -743,7 +736,7 @@ abstract class DocGenerator extends Models {
val tables = for (val k <- kinds.keys.toList)
yield Pair(k, decls filter kinds(k))
for (val Pair(k, members) <- tables; !members.isEmpty) yield
- <table cellpadding="3" class="member" summary="" style="margin:0 0 1.2em 0;">
+ <table cellpadding="3" class="member" summary="">
<tr>
<td colspan="2" class="title">{k} Summary</td>
</tr>
diff --git a/src/compiler/scala/tools/nsc/models/Models.scala b/src/compiler/scala/tools/nsc/models/Models.scala
index 9a9284d321..a353ba83ec 100644
--- a/src/compiler/scala/tools/nsc/models/Models.scala
+++ b/src/compiler/scala/tools/nsc/models/Models.scala
@@ -52,12 +52,12 @@ abstract class Models {
modString
}
- def codeFor(kind: Kind) : String = kind match {
+ def codeFor(kind: Kind): String = kind match {
case CONSTRUCTOR => codeFor(DEF)
case _ => labelFor(kind).toLowerCase()
}
- def pluralFor(kind: Kind) : String = kind match {
+ def pluralFor(kind: Kind): String = kind match {
case CLASS => "Classes"
case _ => labelFor(kind) + "s"
}
@@ -313,8 +313,8 @@ abstract class Models {
assert(sym0.isGetter);
val sym = sym0.accessed
val ret = if (sym == NoSymbol) {
- val sym = analyzer.underlying(sym0);
- //val name = nme.getterToSetter(sym0.name)
+ val sym = analyzer.underlying(sym0)
+ //val name = nme.getterToSetter(sym0.name)
//val setter = sym0.owner.info.decl(name);
val isVar = sym.isVariable;
val mods = (ddef.mods |
diff --git a/src/library/scala/collection/immutable/ListMap.scala b/src/library/scala/collection/immutable/ListMap.scala
index 6979c973c5..d7e2df5329 100644
--- a/src/library/scala/collection/immutable/ListMap.scala
+++ b/src/library/scala/collection/immutable/ListMap.scala
@@ -1,6 +1,6 @@
/* __ *\
** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2003-2006, LAMP/EPFL **
+** / __/ __// _ | / / / _ | (c) 2003-2007, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
@@ -12,8 +12,6 @@
package scala.collection.immutable
-//import Predef.NoSuchElementException
-
object ListMap {
def Empty[A, B] = new ListMap[A, B]
}
@@ -29,22 +27,22 @@ object ListMap {
[serializable]
class ListMap[A, B] extends AnyRef with Map[A, B] {
- /** This method returns a new ListMap instance mapping keys of the
+ /** Returns a <code>new ListMap</code> instance mapping keys of the
* same type to values of type <code>C</code>.
*/
def empty[C] = ListMap.Empty[A, C]
/** Returns the number of mappings in this map.
*
- * @return number of mappings.
+ * @return number of mappings in this map.
*/
def size: Int = 0
- /** Check if this map maps <code>key</code> to a value and return the
+ /** Checks if this map maps <code>key</code> to a value and return the
* value if it exists.
*
- * @param key the key of the mapping of interest
- * @return the value of the mapping, if it exists
+ * @param key the key of the mapping of interest
+ * @return the value of the mapping, if it exists
*/
def get(key: A): Option[B] = None
@@ -53,16 +51,21 @@ class ListMap[A, B] extends AnyRef with Map[A, B] {
* to <code>value</code>. If the map contains already a
* mapping for <code>key</code>, 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.
*/
def update(key: A, value: B): ListMap[A, B] = new Node(key, value)
/** This creates a new mapping without the given <code>key</code>.
* If the map does not contain a mapping for the given key, the
* method returns the same map.
+ *
+ * @param key a map without a mapping for the given key.
*/
def -(key: A): ListMap[A, B] = this
- /** This returns an iterator over key-value pairs.
+ /** Returns an iterator over key-value pairs.
*/
def elements: Iterator[Pair[A,B]] = new Iterator[Pair[A,B]] {
var that: ListMap[A,B] = ListMap.this;
@@ -110,20 +113,20 @@ class ListMap[A, B] extends AnyRef with Map[A, B] {
*/
override def isEmpty: Boolean = false
- /** Retrieve the value which is associated with the given key. This
+ /** Retrieves the value which is associated with the given key. This
* method throws an exception if there is no mapping from the given
* key to a value.
*
- * @param key the key
- * @return the value associated with the given key.
+ * @param key the key
+ * @return the value associated with the given key.
*/
override def apply(k: A): B = if (k == key) value else ListMap.this(k)
- /** Check if this map maps <code>key</code> to a value and return the
+ /** Checks if this map maps <code>key</code> to a value and return the
* value if it exists.
*
- * @param key the key of the mapping of interest
- * @return the value of the mapping, if it exists
+ * @param key the key of the mapping of interest
+ * @return the value of the mapping, if it exists
*/
override def get(k: A): Option[B] =
if (k == key) Some(value) else ListMap.this.get(k)
@@ -144,9 +147,12 @@ class ListMap[A, B] extends AnyRef with Map[A, B] {
val tail = ListMap.this.update(k,v); new tail.Node(key, value)
}
- /** This creates a new mapping without the given <code>key</code>.
+ /** Creates a new mapping without the given <code>key</code>.
* If the map does not contain a mapping for the given key, the
* method returns the same map.
+ *
+ * @param k ...
+ * @return ...
*/
override def -(k: A): ListMap[A, B] =
if (k == key)
diff --git a/src/library/scala/collection/mutable/BitSet.scala b/src/library/scala/collection/mutable/BitSet.scala
index 7a518cfc0d..02e876ba80 100644
--- a/src/library/scala/collection/mutable/BitSet.scala
+++ b/src/library/scala/collection/mutable/BitSet.scala
@@ -1,6 +1,6 @@
/* __ *\
** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2003-2006, LAMP/EPFL **
+** / __/ __// _ | / / / _ | (c) 2003-2007, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
@@ -13,7 +13,7 @@ package scala.collection.mutable
/**
- * This class implements mutable, resizable Bit sets
+ * The class <code>BitSet</code> implements mutable, resizable Bit sets
*
* @author Burak Emir, Nikolay Mihaylov
* @version 1.1
@@ -26,10 +26,13 @@ class BitSet(initSize: Int) extends collection.BitSet with Set[Int] {
import compat.Platform.arraycopy
- /** default constructor, initial size of 512 bits */
- def this() = this(0);
+ /** default constructor, initial size of 512 bits. */
+ def this() = this(0)
- /** ensure that this bitset can store at least <pre>n</pre> bits */
+ /** Ensures that this bitset can store at least <code>n</code> bits.
+ *
+ * @param n ...
+ */
def ensureCapacity(n: Int): Unit =
if (capacity < n) {
if (nbits(arr.length) < n) {
@@ -45,7 +48,7 @@ class BitSet(initSize: Int) extends collection.BitSet with Set[Int] {
}
/**
- * Sets <code>i<sup>th</sup></code> bit to true.
+ * Sets <code>i-th</code> bit to true.
* No restriction on <code>i</code>
*/
def +=(i: Int): Unit = {
@@ -58,7 +61,10 @@ class BitSet(initSize: Int) extends collection.BitSet with Set[Int] {
}
}
- /** Clears <code>i<sup>th</sup></code> bit */
+ /** Clears the <code>i</code>-th bit.
+ *
+ * @param i the <code>i</code>-th element of the bit set.
+ */
def -=(i: Int): Unit = {
if (i >= capacity) return;
val oldInt = arr(offset(i))
@@ -69,6 +75,8 @@ class BitSet(initSize: Int) extends collection.BitSet with Set[Int] {
}
}
+ /** Clears all bits of the set.
+ */
def clear: Unit = {
java.util.Arrays.fill(arr, 0)
size = 0