diff options
author | buraq <buraq@epfl.ch> | 2003-12-08 15:39:48 +0000 |
---|---|---|
committer | buraq <buraq@epfl.ch> | 2003-12-08 15:39:48 +0000 |
commit | 1935bd3e5387b29478f2659b10bacedc26b847fb (patch) | |
tree | 4ee3baf1281b74516bc59ec432b351f9c796c108 | |
parent | 709ba6a8feb0eea8a63b8bfb7d62fc93148f9c63 (diff) | |
download | scala-1935bd3e5387b29478f2659b10bacedc26b847fb.tar.gz scala-1935bd3e5387b29478f2659b10bacedc26b847fb.tar.bz2 scala-1935bd3e5387b29478f2659b10bacedc26b847fb.zip |
turned into trait
-rw-r--r-- | sources/scala/xml/AttributedNode.scala | 14 | ||||
-rw-r--r-- | sources/scala/xml/Node.scala | 4 |
2 files changed, 8 insertions, 10 deletions
diff --git a/sources/scala/xml/AttributedNode.scala b/sources/scala/xml/AttributedNode.scala index 29fb617f87..05198e4841 100644 --- a/sources/scala/xml/AttributedNode.scala +++ b/sources/scala/xml/AttributedNode.scala @@ -5,22 +5,20 @@ import scala.collection.Map; /** superclass for specific representation of XML elements. These are created by ** a xxx2scala binding tool **/ -abstract class AttributedNode extends Node { +trait AttributedNode extends Node { final def apply(key:String):Option[String] = attributes.get(key); /** returns a mapping from all present attributes to values */ def attributes: Map[String,String]; - protected val attribHashCode:int; - /** hashcode for this node*/ - override def hashCode() = Utility.hashCode( label, attribHashCode, children ); + override def hashCode() = Utility.hashCode( label, attributes.toList.hashCode(), children ); - final def toXML:String = Utility.toXML( this ); + override def toXML:String = Utility.toXML( this ); - override def toString() = { - var s = new StringBuffer( label ); + override def toString() = toXML /*{ + var s = new StringBuffer( "AttributedNode('"+label ); val as = attributes; if( as != null ) s.append( Utility.attr2xml( as.elements ) ); @@ -28,6 +26,6 @@ abstract class AttributedNode extends Node { s.append( children.toString() ); s.append(")"); s.toString(); - } + }*/ } diff --git a/sources/scala/xml/Node.scala b/sources/scala/xml/Node.scala index b7efa44a9a..7ce7f44fbf 100644 --- a/sources/scala/xml/Node.scala +++ b/sources/scala/xml/Node.scala @@ -1,9 +1,9 @@ package scala.xml ; -/** superclass for specific representation of XML elements. These are created by +/** trait for representation of XML elements. These are created by ** a xxx2scala binding tool **/ -abstract class Node { +trait Node { def label: String; def children: Seq[ Node ]; |