From 1935bd3e5387b29478f2659b10bacedc26b847fb Mon Sep 17 00:00:00 2001 From: buraq Date: Mon, 8 Dec 2003 15:39:48 +0000 Subject: turned into trait --- sources/scala/xml/AttributedNode.scala | 14 ++++++-------- sources/scala/xml/Node.scala | 4 ++-- 2 files changed, 8 insertions(+), 10 deletions(-) (limited to 'sources') 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 ]; -- cgit v1.2.3