diff options
author | buraq <buraq@epfl.ch> | 2003-10-03 15:12:13 +0000 |
---|---|---|
committer | buraq <buraq@epfl.ch> | 2003-10-03 15:12:13 +0000 |
commit | aa4eeeadece5e1e93642682120ca28a9ee62e32d (patch) | |
tree | e65faa584d23ee26d76aee9461480ce93e68c395 /sources | |
parent | 84bdc646dd47a1f3483fb044bce9c1c6bcd7c549 (diff) | |
download | scala-aa4eeeadece5e1e93642682120ca28a9ee62e32d.tar.gz scala-aa4eeeadece5e1e93642682120ca28a9ee62e32d.tar.bz2 scala-aa4eeeadece5e1e93642682120ca28a9ee62e32d.zip |
fixed hash-consing
Diffstat (limited to 'sources')
-rw-r--r-- | sources/scala/xml/Element.scala | 2 | ||||
-rw-r--r-- | sources/scala/xml/FactoryAdapter.scala | 4 | ||||
-rw-r--r-- | sources/scala/xml/ScalaFactoryAdapter.scala | 4 |
3 files changed, 7 insertions, 3 deletions
diff --git a/sources/scala/xml/Element.scala b/sources/scala/xml/Element.scala index 0592af3382..791e617f81 100644 --- a/sources/scala/xml/Element.scala +++ b/sources/scala/xml/Element.scala @@ -40,7 +40,7 @@ object Element { */ def hashValue( name:String, attribs:Map[ String, String ], children:Seq[ Element ] ) = { - name.hashCode() + attribs.elements.hashCode() + children.hashCode() + name.hashCode() + attribs.toList.hashCode() + children.hashCode() } /** returns a hash value computed from the element name, attributes and hash values of children. diff --git a/sources/scala/xml/FactoryAdapter.scala b/sources/scala/xml/FactoryAdapter.scala index 3d277a2504..dbe332283b 100644 --- a/sources/scala/xml/FactoryAdapter.scala +++ b/sources/scala/xml/FactoryAdapter.scala @@ -137,6 +137,7 @@ abstract class FactoryAdapter */ //def endDocument():Unit /*throws SAXException*/ = {} + //var elemCount = 0; //STATISTICS // // ContentHandler methods // @@ -150,7 +151,7 @@ abstract class FactoryAdapter */ override def startElement( uri:String , localName:String , qname:String , attributes:Attributes ):Unit /*throws SAXException*/ = { - + //elemCount = elemCount + 1; //STATISTICS captureText(); tagStack.push(curTag); @@ -362,6 +363,7 @@ abstract class FactoryAdapter } } } // catch + //System.err.println("[FactoryAdapter: total #elements = "+elemCount+"]"); rootElem; } // loadXML diff --git a/sources/scala/xml/ScalaFactoryAdapter.scala b/sources/scala/xml/ScalaFactoryAdapter.scala index 8a666cc293..0d77ee7370 100644 --- a/sources/scala/xml/ScalaFactoryAdapter.scala +++ b/sources/scala/xml/ScalaFactoryAdapter.scala @@ -38,7 +38,7 @@ abstract class ScalaFactoryAdapter // if compress is set, used for hash-consing val cache = new HashMap[int,Element]; - + //var cacheCount = 0; /** creates an element. uses hash-consing if compress == true */ def createElement(elemName:String, @@ -57,6 +57,8 @@ abstract class ScalaFactoryAdapter cache.get( h ).match { case Some(cachedElem) => + //cacheCount = cacheCount + 1; + //System.err.println("[ScalaFactoryAdapter: cache hit "+cacheCount+"]"); cachedElem case None => |