diff options
author | michelou <michelou@epfl.ch> | 2009-07-15 14:04:33 +0000 |
---|---|---|
committer | michelou <michelou@epfl.ch> | 2009-07-15 14:04:33 +0000 |
commit | 8dee86d734a85ccbc809c098e5fd7b3ea9358e74 (patch) | |
tree | 898fab6455683ed82ed48f1d7aa8c3f59b55894e /src | |
parent | 69e1ddb55a7f122715dbed337de73f595ae00dc3 (diff) | |
download | scala-8dee86d734a85ccbc809c098e5fd7b3ea9358e74.tar.gz scala-8dee86d734a85ccbc809c098e5fd7b3ea9358e74.tar.bz2 scala-8dee86d734a85ccbc809c098e5fd7b3ea9358e74.zip |
minor changes (Scala comments)
Diffstat (limited to 'src')
-rw-r--r-- | src/library/scala/Unhashable.scala | 23 | ||||
-rw-r--r-- | src/library/scala/util/Hashable.scala | 29 | ||||
-rw-r--r-- | src/library/scala/xml/parsing/XhtmlEntities.scala | 14 | ||||
-rw-r--r-- | src/library/scala/xml/parsing/XhtmlParser.scala | 40 |
4 files changed, 78 insertions, 28 deletions
diff --git a/src/library/scala/Unhashable.scala b/src/library/scala/Unhashable.scala index a89d331875..457d0996eb 100644 --- a/src/library/scala/Unhashable.scala +++ b/src/library/scala/Unhashable.scala @@ -5,13 +5,26 @@ ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** \* */ + +// $Id$ + + package scala -/** A marker trait for data structures that cannot be hashed, for instance - * because they are mutable and at the same time support structural equaality, so hashing them - * would lead to unpredictable results. - * Such data structures have `hashCode` throw an UnsupportedOperationException. They retain - * the original object hashcode with `identityHashCode`. +/** <p> + * A marker trait for data structures that cannot be hashed, for instance + * because they are mutable and at the same time support structural + * equality, so hashing them would lead to unpredictable results. + * </p> + * <p> + * Such data structures have <code>hashCode</code> throw an <a href="" + * target="contentFrame" class="java/lang/UnsupportedOperationException"> + * <code>java.lang.UnsupportedOperationException</code></a>. They retain + * the original object hashcode with <code>identityHashCode</code>. + * </p> + * + * @author Martin Odersky + * @version 1.0 */ trait Unhashable extends Object { diff --git a/src/library/scala/util/Hashable.scala b/src/library/scala/util/Hashable.scala index b24b5c5089..1ed1da30d8 100644 --- a/src/library/scala/util/Hashable.scala +++ b/src/library/scala/util/Hashable.scala @@ -5,18 +5,24 @@ ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** \* */ + +// $Id: $ + + package scala.util -/** A convenience trait for simplifying hashCode creation. - * Mix this into a class and define val hashValues = Seq(x1, x2, ...) - * and your hashCode will be derived from those values. If you define - * equals in terms of equalHashValues then your hashCode and equals - * methods will never be out of sync. Something like: - * - * override def equals(other: Any) = other match { - * case x: YourClass => this equalHashValues x - * case _ => false - * } +/** <p> + * A convenience trait for simplifying hashCode creation. + * Mix this into a class and define <code>val hashValues = Seq(x1, x2, ...)</code> + * and your <code>hashCode</code> will be derived from those values. + * If you define <code>equals</code> in terms of <code>equalHashValues</code> + * then your <code>hashCode</code> and <code>equals</code> methods will + * never be out of sync. Something like: + * </p><pre> + * <b>override def</b> equals(other: Any) = other <b>match</b> { + * <b>case</b> x: YourClass => <b>this</b> equalHashValues x + * <b>case</b> _ => <b>false</b> + * }</pre> * * @author Paul Phillips */ @@ -52,4 +58,5 @@ object Hashable case x: AnyRef => x.hashCode case x => x.asInstanceOf[AnyRef].hashCode } -}
\ No newline at end of file +} + diff --git a/src/library/scala/xml/parsing/XhtmlEntities.scala b/src/library/scala/xml/parsing/XhtmlEntities.scala index 0b12a47162..53dd24c140 100644 --- a/src/library/scala/xml/parsing/XhtmlEntities.scala +++ b/src/library/scala/xml/parsing/XhtmlEntities.scala @@ -1,10 +1,22 @@ +/* __ *\ +** ________ ___ / / ___ Scala API ** +** / __/ __// _ | / / / _ | (c) 2003-2009, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ + // $Id$ + package scala.xml.parsing import scala.xml.dtd.{IntDef, ParsedEntityDecl} -/* (c) David Pollak 2007 WorldWide Conferencing, LLC */ +/** <p> + * (c) David Pollak 2007 WorldWide Conferencing, LLC. + * </p> + */ object XhtmlEntities { val entList = List(("quot",34), ("amp",38), ("lt",60), ("gt",62), ("nbsp",160), ("iexcl",161), ("cent",162), ("pound",163), ("curren",164), ("yen",165), ("euro",8364), ("brvbar",166), ("sect",167), ("uml",168), ("copy",169), ("ordf",170), ("laquo",171), ("shy",173), ("reg",174), ("trade",8482), diff --git a/src/library/scala/xml/parsing/XhtmlParser.scala b/src/library/scala/xml/parsing/XhtmlParser.scala index f644f5fb77..67482beb58 100644 --- a/src/library/scala/xml/parsing/XhtmlParser.scala +++ b/src/library/scala/xml/parsing/XhtmlParser.scala @@ -1,12 +1,24 @@ +/* __ *\ +** ________ ___ / / ___ Scala API ** +** / __/ __// _ | / / / _ | (c) 2003-2009, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ + // $Id$ + package scala.xml.parsing -import scala.io.{Source} +import scala.io.Source -/** - * Extends the Markup Parser to do the right thing (tm) with PCData blocks. - * (c) David Pollak, 2007 WorldWide Conferencing, LLC +/** <p> + * Extends the Markup Parser to do the right thing (tm) with PCData blocks. + * </p> + * <p> + * (c) David Pollak, 2007 WorldWide Conferencing, LLC. + * </p> */ trait PCDataMarkupParser[PCM <: MarkupParser with MarkupHandler] extends MarkupParser { self: PCM => @@ -19,7 +31,7 @@ trait PCDataMarkupParser[PCM <: MarkupParser with MarkupHandler] extends MarkupP val pos1 = pos val sb: StringBuilder = new StringBuilder() while (true) { - if (ch==']' && + if (ch==']' && { sb.append(ch); nextch; ch == ']' } && { sb.append(ch); nextch; ch == '>' } ) { sb.setLength(sb.length - 2); @@ -33,18 +45,24 @@ trait PCDataMarkupParser[PCM <: MarkupParser with MarkupHandler] extends MarkupP } } -/** - * An XML Parser that preserves CDATA blocks and knows about HtmlEntities. - * (c) David Pollak, 2007 WorldWide Conferencing, LLC +/** <p> + * An XML Parser that preserves CDATA blocks and knows about HtmlEntities. + * </p> + * <p> + * (c) David Pollak, 2007 WorldWide Conferencing, LLC. + * </p> */ class XhtmlParser(val input: Source) extends ConstructingHandler with PCDataMarkupParser[XhtmlParser] with ExternalSources { val preserveWS = true ent ++= XhtmlEntities() } -/** - * Convenience method that instantiates, initializes and runs an XhtmlParser - * (c) Burak Emir +/** <p> + * Convenience method that instantiates, initializes and runs an XhtmlParser. + * </p> + * <p> + * (c) Burak Emir + * </p> */ object XhtmlParser { def apply(source: Source): NodeSeq = { |