diff options
author | michelou <michelou@epfl.ch> | 2006-09-27 15:00:05 +0000 |
---|---|---|
committer | michelou <michelou@epfl.ch> | 2006-09-27 15:00:05 +0000 |
commit | c6d2de5a15bfb464b7b1e6d2a7633b18ecf8a626 (patch) | |
tree | eb790ec6b95530f7bb7524a81055896fa00a42e6 | |
parent | 8d98363504373fbb30360cdf734e8f8f001b8def (diff) | |
download | scala-c6d2de5a15bfb464b7b1e6d2a7633b18ecf8a626.tar.gz scala-c6d2de5a15bfb464b7b1e6d2a7633b18ecf8a626.tar.bz2 scala-c6d2de5a15bfb464b7b1e6d2a7633b18ecf8a626.zip |
improved Scala comments in runtime/*.scala
-rw-r--r-- | src/library/scala/Attribute.scala | 13 | ||||
-rw-r--r-- | src/library/scala/collection/immutable/Tree.scala | 78 | ||||
-rw-r--r-- | src/library/scala/io/BytePickle.scala | 5 | ||||
-rw-r--r-- | src/library/scala/reflect/Tree.scala | 19 | ||||
-rw-r--r-- | src/library/scala/reflect/Type.scala | 18 | ||||
-rw-r--r-- | src/library/scala/runtime/BoxedAnyArray.scala | 75 | ||||
-rw-r--r-- | src/library/scala/runtime/BoxedArray.scala | 19 | ||||
-rw-r--r-- | src/library/scala/runtime/BoxedBooleanArray.scala | 29 | ||||
-rw-r--r-- | src/library/scala/runtime/BoxedByteArray.scala | 27 | ||||
-rw-r--r-- | src/library/scala/runtime/BoxedDoubleArray.scala | 29 | ||||
-rw-r--r-- | src/library/scala/runtime/BoxedFloatArray.scala | 29 | ||||
-rw-r--r-- | src/library/scala/runtime/BoxedIntArray.scala | 29 | ||||
-rw-r--r-- | src/library/scala/runtime/BoxedLongArray.scala | 29 | ||||
-rw-r--r-- | src/library/scala/runtime/BoxedObjectArray.scala | 27 | ||||
-rw-r--r-- | src/library/scala/runtime/BoxedShortArray.scala | 27 |
15 files changed, 254 insertions, 199 deletions
diff --git a/src/library/scala/Attribute.scala b/src/library/scala/Attribute.scala index 5cce5c2ec1..192e6d6bec 100644 --- a/src/library/scala/Attribute.scala +++ b/src/library/scala/Attribute.scala @@ -11,7 +11,18 @@ package scala -/** A base class for attributes +/** <p>A base class for attributes</p> + * <dl> + * <dt><b>Direct Known Subclasses:</b></dt> + * <dd> + * <a href="cloneable.html" target="contentFrame">cloneable</a>, + * <a href="remote.html" target="contentFrame">remote</a>, + * <a href="serializable.html" target="contentFrame">serializable</a>, + * <a href="throws.html" target="contentFrame">throws</a>, + * <a href="transient.html" target="contentFrame">transient</a>, + * <a href="volatile.html" target="contentFrame">volatile</a> + * </dd> + * </dl> * * @author Martin Odersky * @version 1.0, 15/07/2004 diff --git a/src/library/scala/collection/immutable/Tree.scala b/src/library/scala/collection/immutable/Tree.scala index 5fd419806e..81a7fa61fb 100644 --- a/src/library/scala/collection/immutable/Tree.scala +++ b/src/library/scala/collection/immutable/Tree.scala @@ -76,18 +76,18 @@ abstract class Tree[A <% Ordered[A], B]() extends AnyRef { */ /** The type returned when creating a new tree. - * This type should be defined by concrete implementations - * e.g. <pre> - * class C[T](...) extends Tree[A,B](...) { - * type This = C[T]; - * </pre> - */ + * This type should be defined by concrete implementations + * e.g. <pre> + * class C[T](...) extends Tree[A,B](...) { + * type This = C[T]; + * </pre> + */ protected type This <: Tree[A,B] protected def getThis: This /** - * The type of nodes that the tree is build from. - */ + * The type of nodes that the tree is build from. + */ protected type aNode = GBTree[A,B] /** The nodes in the tree. @@ -123,11 +123,10 @@ abstract class Tree[A <% Ordered[A], B]() extends AnyRef { New(newSize, tree.insert(key, entry, newSize * newSize).node) } - /** - * A new tree with the entry added is returned, - * if key is <em>not</em> in the tree, otherwise - * the key is updated with the new entry. - */ + /** A new tree with the entry added is returned, + * if key is <em>not</em> in the tree, otherwise + * the key is updated with the new entry. + */ protected def updateOrAdd(key: A, entry: B): This = if (tree.isDefinedAt(key)) New(size,tree.update(key,entry)) @@ -139,45 +138,42 @@ abstract class Tree[A <% Ordered[A], B]() extends AnyRef { if (tree.isDefinedAt(key)) delete(key) else - getThis; + getThis /** Removes the key from the tree, assumimg that key is present. */ private def delete(key: A): This = New(size - 1, tree.delete(key)) /** Check 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 - */ + * value if it exists. + * + * @param key the key of the mapping of interest + * @return the value of the mapping, if it exists + */ protected def findValue(key: A): Option[B] = tree.get(key) - /** - * Gives you an iterator over all elements in the tree. - * The iterator structure corresponds to - * the call stack of an in-order traversal. - * - * Note: The iterator itself has a state, i.e., it is not functional. - */ + /** Gives you an iterator over all elements in the tree. + * The iterator structure corresponds to + * the call stack of an in-order traversal. + * + * Note: The iterator itself has a state, i.e., it is not functional. + */ protected def entries: Iterator[B] = new Iterator[B] { var iter = tree.mk_iter(scala.Nil) def hasNext = !iter.isEmpty def next = iter match { - case (GBNode(_,v,_,t)::iter_tail) => { - iter= t.mk_iter(iter_tail) + case GBNode(_,v,_,t)::iter_tail => + iter = t.mk_iter(iter_tail) v - } case scala.Nil => error("next on empty iterator") } } - /** - * Create a new balanced tree from the tree. Might be useful to call - * after many deletions, since deletion does not rebalance the tree. + /** Create a new balanced tree from the tree. Might be useful to call + * after many deletions, since deletion does not rebalance the tree. */ def balance: This = New(size, tree.balance(size)) @@ -218,8 +214,12 @@ private case class INode[A <% Ordered[A],B](t1: GBTree[A,B], } /** -* GBTree is an internal class used by Tree. -*/ + * <code>GBTree</code> is an internal class used by + * <a href="Tree.html" target="contentFrame"><code>Tree</code></a>. + * + * @author Erik Stenman + * @version 1.0, 2005-01-20 + */ [serializable] protected abstract class GBTree[A <% Ordered[A],B] extends AnyRef { type aNode = GBTree[A,B] @@ -233,7 +233,7 @@ protected abstract class GBTree[A <% Ordered[A],B] extends AnyRef { def get(key: A): Option[B] def apply(key: A): B def update(key: A, value: B): aNode - def insert(key: A, value: B, size: int): anInsertTree + def insert(key: A, value: B, size: Int): anInsertTree def toList(acc: List[Pair[A,B]]): List[Pair[A,B]] def mk_iter(iter_tail: List[aNode]): List[aNode] def delete(key: A): aNode @@ -244,11 +244,11 @@ protected abstract class GBTree[A <% Ordered[A],B] extends AnyRef { private case class GBLeaf[A <% Ordered[A],B]() extends GBTree[A,B] { def count = Pair(1, 0) - def isDefinedAt(key:A) = false + def isDefinedAt(key: A) = false def get(_key: A) = None def apply(key: A) = error("key " + key + " not found") def update(key: A, value: B) = error("key " + key + " not found") - def insert(key: A, value: B, s:int): anInsertTree = { + def insert(key: A, value: B, s: Int): anInsertTree = { if (s == 0) INode(GBNode(key, value, this, this), 1, 1) else @@ -345,9 +345,9 @@ private case class GBNode[A <% Ordered[A],B](key: A, def balance(s:int): GBTree[A,B] = balance_list(toList(scala.Nil), s) - protected def balance_list(list: List[Pair[A,B]], s:int): GBTree[A,B] = { + protected def balance_list(list: List[Pair[A,B]], s: int): GBTree[A,B] = { val empty = GBLeaf[A,B](); - def bal(list: List[Pair[A,B]], s:int): Pair[aNode,List[Pair[A,B]]] = { + def bal(list: List[Pair[A,B]], s: Int): Pair[aNode, List[Pair[A,B]]] = { if (s > 1) { val sm = s - 1 val s2 = sm / 2 diff --git a/src/library/scala/io/BytePickle.scala b/src/library/scala/io/BytePickle.scala index aa4f810f40..ded1bbafcc 100644 --- a/src/library/scala/io/BytePickle.scala +++ b/src/library/scala/io/BytePickle.scala @@ -16,9 +16,10 @@ import scala.collection.mutable.{HashMap,ArrayBuffer} /** * Pickler combinators. * Based on a Haskell library by Andrew Kennedy, - * see http://research.microsoft.com/~akenn/fun/index.html. + * see <a href="http://research.microsoft.com/~akenn/fun/" + * target="_top">http://research.microsoft.com/~akenn/fun/</a>. * - * @author Philipp Haller <philipp.haller@epfl.ch> + * @author Philipp Haller (philipp.haller<at>epfl.ch) * @version 1.0 */ object BytePickle { diff --git a/src/library/scala/reflect/Tree.scala b/src/library/scala/reflect/Tree.scala index 971df24c83..0effe46fc3 100644 --- a/src/library/scala/reflect/Tree.scala +++ b/src/library/scala/reflect/Tree.scala @@ -11,6 +11,25 @@ package scala.reflect +/** + * <dl> + * <dt><b>Direct Known Subclasses:</b></dt> + * <dd> + * <a href="Apply.html" target="contentFrame">Apply</a>, + * <a href="Assign.html" target="contentFrame">Assign</a>, + * <a href="Block.html" target="contentFrame">Block</a>, + * <a href="ClassDef.html" target="contentFrame">ClassDef</a>, + * <a href="DefDef.html" target="contentFrame">DefDef</a>, + * <a href="Function.html" target="contentFrame">Function</a>, + * <a href="Goto.html" target="contentFrame">Goto</a>, + * <a href="Ident.html" target="contentFrame">Ident</a>, + * <a href="If.html" target="contentFrame">If</a>, + * <a href="Literal.html" target="contentFrame">Literal</a>, + * <a href="Super.html" target="contentFrame">Super</a>, + * <a href="ValDef.html" target="contentFrame">ValDef</a> + * </dd> + * </dl> + */ abstract class Tree case class Ident(sym: Symbol) extends Tree diff --git a/src/library/scala/reflect/Type.scala b/src/library/scala/reflect/Type.scala index 03ed510ec5..07646884bc 100644 --- a/src/library/scala/reflect/Type.scala +++ b/src/library/scala/reflect/Type.scala @@ -13,6 +13,20 @@ package scala.reflect import Predef.Pair +/** + * <dl> + * <dt><b>Direct Known Subclasses:</b></dt> + * <dd> + * <a href="AppliedType.html" target="contentFrame">AppliedType</a>, + * <a href="MethodType.html" target="contentFrame">MethodType</a>, + * <a href="NamedType.html" target="contentFrame">NamedType</a>, + * <a href="PolyType.html" target="contentFrame">PolyType</a>, + * <a href="PrefixedType.html" target="contentFrame">PrefixedType</a>, + * <a href="SingleType.html" target="contentFrame">SingleType</a>, + * <a href="ThisType.html" target="contentFrame">ThisType</a> + * </dd> + * </dl> + */ abstract class Type case object NoPrefix extends Type @@ -31,13 +45,13 @@ case class SingleType(pre: Type, sym: Symbol) extends Type case class ThisType(clazz: Symbol) extends Type /** clazz.super[superClazz] */ -/** tpe[args1, ..., argsn] */ +/** <code>tpe[args1, ..., argsn]</code> */ case class AppliedType(tpe: Type, args: List[Type]) extends Type /** [a <: lo >: hi] */ case class TypeBounds(lo: Type, hi: Type) extends Type -/** (formals1 ... formalsn) restpe */ +/** <code>(formals1 ... formalsn) restpe</code> */ case class MethodType(formals: List[Type], restpe: Type) extends Type /** */ diff --git a/src/library/scala/runtime/BoxedAnyArray.scala b/src/library/scala/runtime/BoxedAnyArray.scala index 1b647b62c7..e18ba86cca 100644 --- a/src/library/scala/runtime/BoxedAnyArray.scala +++ b/src/library/scala/runtime/BoxedAnyArray.scala @@ -9,19 +9,20 @@ // $Id$ -package scala.runtime; +package scala.runtime /** - * Arrays created by new Array[T](length) where T is a type variable + * Arrays created by <code>new Array[T](length)</code> where <code>T</code> + * is a type variable. */ [serializable] final class BoxedAnyArray(val length: Int) extends BoxedArray { - private var boxed = new Array[Object](length); - private val hash = boxed.hashCode(); - private var unboxed: Object = null; - private var elemClass: Class = null; + private var boxed = new Array[Object](length) + private val hash = boxed.hashCode() + private var unboxed: Object = null + private var elemClass: Class = null def apply(index: Int): Object = synchronized { if (unboxed == null) @@ -48,7 +49,7 @@ final class BoxedAnyArray(val length: Int) extends BoxedArray { def update(index: Int, elem: Object): Unit = synchronized { if (unboxed == null) - boxed(index) = elem; + boxed(index) = elem else if (elemClass eq ScalaRunTime.IntTYPE) unboxed.asInstanceOf[Array[Int]](index) = elem.asInstanceOf[BoxedNumber].intValue() else if (elemClass eq ScalaRunTime.DoubleTYPE) @@ -84,17 +85,17 @@ final class BoxedAnyArray(val length: Int) extends BoxedArray { if (unboxed == null) { this.elemClass = elemClass; if (elemClass eq ScalaRunTime.IntTYPE) { - val newvalue = new Array[Int](length); - var i = 0; + val newvalue = new Array[Int](length) + var i = 0 while (i < length) { - val x = boxed(i).asInstanceOf[BoxedNumber]; + val x = boxed(i).asInstanceOf[BoxedNumber] if (x ne null) newvalue(i) = x.intValue(); i = i + 1 } - unboxed = newvalue; + unboxed = newvalue } else if (elemClass eq ScalaRunTime.DoubleTYPE) { - val newvalue = new Array[Double](length); - var i = 0; + val newvalue = new Array[Double](length) + var i = 0 while (i < length) { val x = boxed(i).asInstanceOf[BoxedNumber]; if (x ne null) newvalue(i) = x.doubleValue(); @@ -102,8 +103,8 @@ final class BoxedAnyArray(val length: Int) extends BoxedArray { } unboxed = newvalue; } else if (elemClass eq ScalaRunTime.FloatTYPE) { - val newvalue = new Array[Float](length); - var i = 0; + val newvalue = new Array[Float](length) + var i = 0 while (i < length) { val x = boxed(i).asInstanceOf[BoxedNumber]; if (x ne null) newvalue(i) = x.floatValue(); @@ -111,44 +112,44 @@ final class BoxedAnyArray(val length: Int) extends BoxedArray { } unboxed = newvalue; } else if (elemClass eq ScalaRunTime.LongTYPE) { - val newvalue = new Array[Long](length); - var i = 0; + val newvalue = new Array[Long](length) + var i = 0 while (i < length) { - val x = boxed(i).asInstanceOf[BoxedNumber]; + val x = boxed(i).asInstanceOf[BoxedNumber] if (x ne null) newvalue(i) = x.longValue(); i = i + 1 } unboxed = newvalue; } else if (elemClass eq ScalaRunTime.CharTYPE) { - val newvalue = new Array[Char](length); - var i = 0; + val newvalue = new Array[Char](length) + var i = 0 while (i < length) { - val x = boxed(i).asInstanceOf[BoxedNumber]; + val x = boxed(i).asInstanceOf[BoxedNumber] if (x ne null) newvalue(i) = x.charValue(); i = i + 1 } - unboxed = newvalue; + unboxed = newvalue } else if (elemClass eq ScalaRunTime.ByteTYPE) { - val newvalue = new Array[Byte](length); - var i = 0; + val newvalue = new Array[Byte](length) + var i = 0 while (i < length) { - val x = boxed(i).asInstanceOf[BoxedNumber]; + val x = boxed(i).asInstanceOf[BoxedNumber] if (x ne null) newvalue(i) = x.byteValue(); i = i + 1 } unboxed = newvalue; } else if (elemClass eq ScalaRunTime.ShortTYPE) { - val newvalue = new Array[Short](length); - var i = 0; + val newvalue = new Array[Short](length) + var i = 0 while (i < length) { - val x = boxed(i).asInstanceOf[BoxedNumber]; + val x = boxed(i).asInstanceOf[BoxedNumber] if (x ne null) newvalue(i) = x.shortValue(); i = i + 1 } unboxed = newvalue; } else if (elemClass eq ScalaRunTime.BooleanTYPE) { - val newvalue = new Array[Boolean](length); - var i = 0; + val newvalue = new Array[Boolean](length) + var i = 0 while (i < length) { val x = boxed(i).asInstanceOf[BoxedBoolean]; if (x ne null) newvalue(i) = x.value; @@ -157,7 +158,7 @@ final class BoxedAnyArray(val length: Int) extends BoxedArray { unboxed = newvalue; } else if (elemClass == boxed.getClass().getComponentType()) { // todo: replace with ScalaRunTime.Object.class - unboxed = boxed; + unboxed = boxed } else { unboxed = java.lang.reflect.Array.newInstance(elemClass, length); System.arraycopy(boxed, 0, unboxed, 0, length); @@ -239,16 +240,16 @@ final class BoxedAnyArray(val length: Int) extends BoxedArray { } override def filter(p: Any => Boolean): Object = { - val include = new Array[Boolean](length); - var len = 0; - var i = 0; + val include = new Array[Boolean](length) + var len = 0 + var i = 0 while (i < length) { if (p(this(i))) { include(i) = true; len = len + 1 } i = i + 1 } - val result = new BoxedAnyArray(len); - len = 0; - i = 0; + val result = new BoxedAnyArray(len) + len = 0 + i = 0 while (len < result.length) { if (include(i)) { result(len) = this(i); len = len + 1 } i = i + 1 diff --git a/src/library/scala/runtime/BoxedArray.scala b/src/library/scala/runtime/BoxedArray.scala index b55fe83de2..b26e03c4c6 100644 --- a/src/library/scala/runtime/BoxedArray.scala +++ b/src/library/scala/runtime/BoxedArray.scala @@ -5,11 +5,28 @@ ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** \* */ + // $Id$ + + package scala.runtime /** - * A class representing Array[T] + * <p>A class representing <code>Array[T]</code></p> + * <dl> + * <dt><b>Direct Known Subclasses:</b></dt> + * <dd> + * <a href="BoxedAnyArray.html" target="contentFrame">BoxedAnyArray</a>, + * <a href="BoxedBooleanArray.html" target="contentFrame">BoxedBooleanArray</a>, + * <a href="BoxedByteArray.html" target="contentFrame">BoxedByteArray</a>, + * <a href="BoxedDoubleArray.html" target="contentFrame">BoxedDoubleArray</a>, + * <a href="BoxedFloatArray.html" target="contentFrame">BoxedFloatArray</a>, + * <a href="BoxedIntArray.html" target="contentFrame">BoxedIntArray</a>, + * <a href="BoxedLongArray.html" target="contentFrame">BoxedLongArray</a>, + * <a href="BoxedObjectArray.html" target="contentFrame">BoxedObjectArray</a>, + * <a href="BoxedShortArray.html" target="contentFrame">BoxedShortArray</a> + * </dd> + * </dl> */ abstract class BoxedArray extends PartialFunction[Int, Object] with Seq[Object] { /** The length of the array */ diff --git a/src/library/scala/runtime/BoxedBooleanArray.scala b/src/library/scala/runtime/BoxedBooleanArray.scala index 066e9d14a0..a11574653d 100644 --- a/src/library/scala/runtime/BoxedBooleanArray.scala +++ b/src/library/scala/runtime/BoxedBooleanArray.scala @@ -9,47 +9,46 @@ // $Id$ -package scala.runtime; +package scala.runtime [serializable] final class BoxedBooleanArray(val value: Array[Boolean]) extends BoxedArray { - def length: Int = value.length; + def length: Int = value.length - def apply(index: Int): Object = BoxedBoolean.box(value(index)); + def apply(index: Int): Object = BoxedBoolean.box(value(index)) def update(index: Int, elem: Object): Unit = { value(index) = elem.asInstanceOf[BoxedBoolean].value } - def unbox(elemTag: String): Object = value; - def unbox(elemClass: Class): Object = value; + def unbox(elemTag: String): Object = value + def unbox(elemClass: Class): Object = value - override def equals(other: Any) = ( + override def equals(other: Any) = value == other || other.isInstanceOf[BoxedBooleanArray] && value == other.asInstanceOf[BoxedBooleanArray].value - ); - override def hashCode(): Int = value.hashCode(); + override def hashCode(): Int = value.hashCode() def subArray(start: Int, end: Int): Array[Boolean] = { - val result = new Array[Boolean](end - start); + val result = new Array[Boolean](end - start) Array.copy(value, start, result, 0, end - start) result } def filter(p: Any => Boolean): Array[Boolean] = { - val include = new Array[Boolean](value.length); - var len = 0; - var i = 0; + val include = new Array[Boolean](value.length) + var len = 0 + var i = 0 while (i < value.length) { if (p(value(i))) { include(i) = true; len = len + 1 } i = i + 1 } - val result = new Array[Boolean](len); - len = 0; - i = 0; + val result = new Array[Boolean](len) + len = 0 + i = 0 while (len < result.length) { if (include(i)) { result(len) = value(i); len = len + 1 } i = i + 1 diff --git a/src/library/scala/runtime/BoxedByteArray.scala b/src/library/scala/runtime/BoxedByteArray.scala index ba8ccb2c77..a7f5a536e3 100644 --- a/src/library/scala/runtime/BoxedByteArray.scala +++ b/src/library/scala/runtime/BoxedByteArray.scala @@ -9,47 +9,46 @@ // $Id$ -package scala.runtime; +package scala.runtime [serializable] final class BoxedByteArray(val value: Array[Byte]) extends BoxedArray { - def length: Int = value.length; + def length: Int = value.length - def apply(index: Int): Object = BoxedByte.box(value(index)); + def apply(index: Int): Object = BoxedByte.box(value(index)) def update(index: Int, elem: Object): Unit = { value(index) = elem.asInstanceOf[BoxedNumber].byteValue() } - def unbox(elemTag: String): Object = value; - def unbox(elemClass: Class): Object = value; + def unbox(elemTag: String): Object = value + def unbox(elemClass: Class): Object = value - override def equals(other: Any) = ( + override def equals(other: Any) = value == other || other.isInstanceOf[BoxedByteArray] && value == other.asInstanceOf[BoxedByteArray].value - ); override def hashCode(): Int = value.hashCode(); def subArray(start: Int, end: Int): Array[Byte] = { - val result = new Array[Byte](end - start); + val result = new Array[Byte](end - start) Array.copy(value, start, result, 0, end - start) result } def filter(p: Any => Boolean): Array[Byte] = { - val include = new Array[Boolean](value.length); - var len = 0; - var i = 0; + val include = new Array[Boolean](value.length) + var len = 0 + var i = 0 while (i < value.length) { if (p(value(i))) { include(i) = true; len = len + 1 } i = i + 1 } - val result = new Array[Byte](len); - len = 0; - i = 0; + val result = new Array[Byte](len) + len = 0 + i = 0 while (len < result.length) { if (include(i)) { result(len) = value(i); len = len + 1 } i = i + 1 diff --git a/src/library/scala/runtime/BoxedDoubleArray.scala b/src/library/scala/runtime/BoxedDoubleArray.scala index 8a3c283f7c..6b22bf846b 100644 --- a/src/library/scala/runtime/BoxedDoubleArray.scala +++ b/src/library/scala/runtime/BoxedDoubleArray.scala @@ -9,47 +9,46 @@ // $Id$ -package scala.runtime; +package scala.runtime [serializable] final class BoxedDoubleArray(val value: Array[Double]) extends BoxedArray { - def length: Int = value.length; + def length: Int = value.length - def apply(index: Int): Object = BoxedDouble.box(value(index)); + def apply(index: Int): Object = BoxedDouble.box(value(index)) def update(index: Int, elem: Object): Unit = { value(index) = elem.asInstanceOf[BoxedNumber].doubleValue() } - def unbox(elemTag: String): Object = value; - def unbox(elemClass: Class): Object = value; + def unbox(elemTag: String): Object = value + def unbox(elemClass: Class): Object = value - override def equals(other: Any) = ( + override def equals(other: Any) = value == other || other.isInstanceOf[BoxedDoubleArray] && value == other.asInstanceOf[BoxedDoubleArray].value - ); - override def hashCode(): Int = value.hashCode(); + override def hashCode(): Int = value.hashCode() def subArray(start: Int, end: Int): Array[Double] = { - val result = new Array[Double](end - start); + val result = new Array[Double](end - start) Array.copy(value, start, result, 0, end - start) result } def filter(p: Any => Boolean): Array[Double] = { - val include = new Array[Boolean](value.length); - var len = 0; - var i = 0; + val include = new Array[Boolean](value.length) + var len = 0 + var i = 0 while (i < value.length) { if (p(value(i))) { include(i) = true; len = len + 1 } i = i + 1 } - val result = new Array[Double](len); - len = 0; - i = 0; + val result = new Array[Double](len) + len = 0 + i = 0 while (len < result.length) { if (include(i)) { result(len) = value(i); len = len + 1 } i = i + 1 diff --git a/src/library/scala/runtime/BoxedFloatArray.scala b/src/library/scala/runtime/BoxedFloatArray.scala index a7f30c2198..1ef4ade45e 100644 --- a/src/library/scala/runtime/BoxedFloatArray.scala +++ b/src/library/scala/runtime/BoxedFloatArray.scala @@ -9,47 +9,46 @@ // $Id$ -package scala.runtime; +package scala.runtime [serializable] final class BoxedFloatArray(val value: Array[Float]) extends BoxedArray { - def length: Int = value.length; + def length: Int = value.length - def apply(index: Int): Object = BoxedFloat.box(value(index)); + def apply(index: Int): Object = BoxedFloat.box(value(index)) def update(index: Int, elem: Object): Unit = { value(index) = elem.asInstanceOf[BoxedNumber].floatValue() } - def unbox(elemTag: String): Object = value; - def unbox(elemClass: Class): Object = value; + def unbox(elemTag: String): Object = value + def unbox(elemClass: Class): Object = value - override def equals(other: Any) = ( + override def equals(other: Any) = value == other || other.isInstanceOf[BoxedFloatArray] && value == other.asInstanceOf[BoxedFloatArray].value - ); - override def hashCode(): Int = value.hashCode(); + override def hashCode(): Int = value.hashCode() def subArray(start: Int, end: Int): Array[Float] = { - val result = new Array[Float](end - start); + val result = new Array[Float](end - start) Array.copy(value, start, result, 0, end - start) result } def filter(p: Any => Boolean): Array[Float] = { - val include = new Array[Boolean](value.length); - var len = 0; - var i = 0; + val include = new Array[Boolean](value.length) + var len = 0 + var i = 0 while (i < value.length) { if (p(value(i))) { include(i) = true; len = len + 1 } i = i + 1 } - val result = new Array[Float](len); - len = 0; - i = 0; + val result = new Array[Float](len) + len = 0 + i = 0 while (len < result.length) { if (include(i)) { result(len) = value(i); len = len + 1 } i = i + 1 diff --git a/src/library/scala/runtime/BoxedIntArray.scala b/src/library/scala/runtime/BoxedIntArray.scala index 11a6b73c07..7cf7f48521 100644 --- a/src/library/scala/runtime/BoxedIntArray.scala +++ b/src/library/scala/runtime/BoxedIntArray.scala @@ -9,47 +9,46 @@ // $Id$ -package scala.runtime; +package scala.runtime [serializable] final class BoxedIntArray(val value: Array[Int]) extends BoxedArray { - def length: Int = value.length; + def length: Int = value.length - def apply(index: Int): Object = BoxedInt.box(value(index)); + def apply(index: Int): Object = BoxedInt.box(value(index)) def update(index: Int, elem: Object): Unit = { value(index) = elem.asInstanceOf[BoxedNumber].intValue() } - def unbox(elemTag: String): Object = value; - def unbox(elemClass: Class): Object = value; + def unbox(elemTag: String): Object = value + def unbox(elemClass: Class): Object = value - override def equals(other: Any) = ( + override def equals(other: Any) = value == other || other.isInstanceOf[BoxedIntArray] && value == other.asInstanceOf[BoxedIntArray].value - ); - override def hashCode(): Int = value.hashCode(); + override def hashCode(): Int = value.hashCode() def subArray(start: Int, end: Int): Array[Int] = { - val result = new Array[Int](end - start); + val result = new Array[Int](end - start) Array.copy(value, start, result, 0, end - start) result } def filter(p: Any => Boolean): Array[Int] = { - val include = new Array[Boolean](value.length); - var len = 0; - var i = 0; + val include = new Array[Boolean](value.length) + var len = 0 + var i = 0 while (i < value.length) { if (p(value(i))) { include(i) = true; len = len + 1 } i = i + 1 } - val result = new Array[Int](len); - len = 0; - i = 0; + val result = new Array[Int](len) + len = 0 + i = 0 while (len < result.length) { if (include(i)) { result(len) = value(i); len = len + 1 } i = i + 1 diff --git a/src/library/scala/runtime/BoxedLongArray.scala b/src/library/scala/runtime/BoxedLongArray.scala index ce4dfcd82f..755fec8f9f 100644 --- a/src/library/scala/runtime/BoxedLongArray.scala +++ b/src/library/scala/runtime/BoxedLongArray.scala @@ -9,47 +9,46 @@ // $Id$ -package scala.runtime; +package scala.runtime [serializable] final class BoxedLongArray(val value: Array[Long]) extends BoxedArray { - def length: Int = value.length; + def length: Int = value.length - def apply(index: Int): Object = BoxedLong.box(value(index)); + def apply(index: Int): Object = BoxedLong.box(value(index)) def update(index: Int, elem: Object): Unit = { value(index) = elem.asInstanceOf[BoxedNumber].longValue() } - def unbox(elemTag: String): Object = value; - def unbox(elemClass: Class): Object = value; + def unbox(elemTag: String): Object = value + def unbox(elemClass: Class): Object = value - override def equals(other: Any) = ( + override def equals(other: Any) = value == other || other.isInstanceOf[BoxedLongArray] && value == other.asInstanceOf[BoxedLongArray].value - ); - override def hashCode(): Int = value.hashCode(); + override def hashCode(): Int = value.hashCode() def subArray(start: Int, end: Int): Array[Long] = { - val result = new Array[Long](end - start); + val result = new Array[Long](end - start) Array.copy(value, start, result, 0, end - start) result } def filter(p: Any => Boolean): Array[Long] = { - val include = new Array[Boolean](value.length); - var len = 0; - var i = 0; + val include = new Array[Boolean](value.length) + var len = 0 + var i = 0 while (i < value.length) { if (p(value(i))) { include(i) = true; len = len + 1 } i = i + 1 } - val result = new Array[Long](len); - len = 0; - i = 0; + val result = new Array[Long](len) + len = 0 + i = 0 while (len < result.length) { if (include(i)) { result(len) = value(i); len = len + 1 } i = i + 1 diff --git a/src/library/scala/runtime/BoxedObjectArray.scala b/src/library/scala/runtime/BoxedObjectArray.scala index c393fcfdd2..7aeed09975 100644 --- a/src/library/scala/runtime/BoxedObjectArray.scala +++ b/src/library/scala/runtime/BoxedObjectArray.scala @@ -9,27 +9,26 @@ // $Id$ -package scala.runtime; +package scala.runtime [serializable] final class BoxedObjectArray(val value: Array[Object]) extends BoxedArray { - def length: Int = value.length; + def length: Int = value.length - def apply(index: Int): Object = value(index); + def apply(index: Int): Object = value(index) def update(index: Int, elem: Object): Unit = { value(index) = elem } - def unbox(elemTag: String): Object = value; - def unbox(elemClass: Class): Object = value; + def unbox(elemTag: String): Object = value + def unbox(elemClass: Class): Object = value - override def equals(other: Any): Boolean = ( + override def equals(other: Any): Boolean = value == other || other.isInstanceOf[BoxedObjectArray] && value == other.asInstanceOf[BoxedObjectArray].value - ); - override def hashCode(): Int = value.hashCode(); + override def hashCode(): Int = value.hashCode() private def create(length: Int): Array[Object] = { val elemClass = value.getClass().getComponentType() @@ -43,16 +42,16 @@ final class BoxedObjectArray(val value: Array[Object]) extends BoxedArray { } override def filter(p: Any => Boolean): Array[Object] = { - val include = new Array[Boolean](value.length); - var len = 0; - var i = 0; + val include = new Array[Boolean](value.length) + var len = 0 + var i = 0 while (i < value.length) { if (p(value(i))) { include(i) = true; len = len + 1 } i = i + 1 } - val result = create(len); - len = 0; - i = 0; + val result = create(len) + len = 0 + i = 0 while (len < result.length) { if (include(i)) { result(len) = value(i); len = len + 1 } i = i + 1 diff --git a/src/library/scala/runtime/BoxedShortArray.scala b/src/library/scala/runtime/BoxedShortArray.scala index 67c65e62ff..9179178a32 100644 --- a/src/library/scala/runtime/BoxedShortArray.scala +++ b/src/library/scala/runtime/BoxedShortArray.scala @@ -15,41 +15,40 @@ package scala.runtime; [serializable] final class BoxedShortArray(val value: Array[Short]) extends BoxedArray { - def length: Int = value.length; + def length: Int = value.length - def apply(index: Int): Object = BoxedShort.box(value(index)); + def apply(index: Int): Object = BoxedShort.box(value(index)) def update(index: Int, elem: Object): Unit = { value(index) = elem.asInstanceOf[BoxedNumber].shortValue() } - def unbox(elemTag: String): Object = value; - def unbox(elemClass: Class): Object = value; + def unbox(elemTag: String): Object = value + def unbox(elemClass: Class): Object = value - override def equals(other: Any) = ( + override def equals(other: Any) = value == other || other.isInstanceOf[BoxedShortArray] && value == other.asInstanceOf[BoxedShortArray].value - ); - override def hashCode(): Int = value.hashCode(); + override def hashCode(): Int = value.hashCode() def subArray(start: Int, end: Int): Array[Short] = { - val result = new Array[Short](end - start); + val result = new Array[Short](end - start) Array.copy(value, start, result, 0, end - start) result } def filter(p: Any => Boolean): Array[Short] = { - val include = new Array[Boolean](value.length); - var len = 0; - var i = 0; + val include = new Array[Boolean](value.length) + var len = 0 + var i = 0 while (i < value.length) { if (p(value(i))) { include(i) = true; len = len + 1 } i = i + 1 } - val result = new Array[Short](len); - len = 0; - i = 0; + val result = new Array[Short](len) + len = 0 + i = 0 while (len < result.length) { if (include(i)) { result(len) = value(i); len = len + 1 } i = i + 1 |