From 8dee86d734a85ccbc809c098e5fd7b3ea9358e74 Mon Sep 17 00:00:00 2001 From: michelou Date: Wed, 15 Jul 2009 14:04:33 +0000 Subject: minor changes (Scala comments) --- src/library/scala/Unhashable.scala | 23 ++++++++++--- src/library/scala/util/Hashable.scala | 29 +++++++++------- src/library/scala/xml/parsing/XhtmlEntities.scala | 14 +++++++- src/library/scala/xml/parsing/XhtmlParser.scala | 40 ++++++++++++++++------- 4 files changed, 78 insertions(+), 28 deletions(-) (limited to 'src') 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`. +/**

+ * 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. + *

+ *

+ * Such data structures have hashCode throw an + * java.lang.UnsupportedOperationException. They retain + * the original object hashcode with identityHashCode. + *

+ * + * @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 - * } +/**

+ * 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
+ *    }
* * @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 */ +/**

+ * (c) David Pollak 2007 WorldWide Conferencing, LLC. + *

+ */ 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 +/**

+ * Extends the Markup Parser to do the right thing (tm) with PCData blocks. + *

+ *

+ * (c) David Pollak, 2007 WorldWide Conferencing, LLC. + *

*/ 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 +/**

+ * An XML Parser that preserves CDATA blocks and knows about HtmlEntities. + *

+ *

+ * (c) David Pollak, 2007 WorldWide Conferencing, LLC. + *

*/ 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 +/**

+ * Convenience method that instantiates, initializes and runs an XhtmlParser. + *

+ *

+ * (c) Burak Emir + *

*/ object XhtmlParser { def apply(source: Source): NodeSeq = { -- cgit v1.2.3