diff options
author | buraq <buraq@epfl.ch> | 2004-04-29 15:59:42 +0000 |
---|---|---|
committer | buraq <buraq@epfl.ch> | 2004-04-29 15:59:42 +0000 |
commit | 84ff0a4c40da09630ccd4d84dc0bbe87d44966e5 (patch) | |
tree | 1a5c4527fb6fe7c7b41fccb83f80032e25279b40 | |
parent | f988ff0675c7dca4ecb82e36f8edfc3c9f71efe2 (diff) | |
download | scala-84ff0a4c40da09630ccd4d84dc0bbe87d44966e5.tar.gz scala-84ff0a4c40da09630ccd4d84dc0bbe87d44966e5.tar.bz2 scala-84ff0a4c40da09630ccd4d84dc0bbe87d44966e5.zip |
added attribute map
-rw-r--r-- | sources/scala/xml/Elem.scala | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/sources/scala/xml/Elem.scala b/sources/scala/xml/Elem.scala index 1d4bf38c66..5ef1da62b9 100644 --- a/sources/scala/xml/Elem.scala +++ b/sources/scala/xml/Elem.scala @@ -12,32 +12,32 @@ case class Elem( label:String, child:Node* ) extends Node { } } - private val hmap = new HashMap[String,String](); + def `@` = new HashMap[String,String](); /** the attributes axis - default is Nil */ - def attribute: Seq[Pair[String, String]] = hmap.elements.toSeq( hmap.size ); + def attribute: Seq[Pair[String, String]] = `@`.toList; /** returns a new element with updated attributes */ final def %(attrs: Seq[Pair[String, String]]):Elem = { val newmap = new HashMap[String,String](); - for( val p <- hmap.elements ) { newmap += p._1 -> p._2 }; + for( val p <- `@`.elements ) { newmap += p._1 -> p._2 }; for( val p <- attrs ) { newmap += p._1 -> p._2 }; new Elem( label, child:_* ) { - private val hmap = newmap; - override def attribute = newmap.elements.toSeq( newmap.size ); + override def `@` = newmap; + override def attribute = `@`.toList; }; } /** returns a new symbol with updated attribute */ final def %(attr: Pair[String, String]):Elem = { val newmap = new HashMap[String,String](); - for( val p <- hmap.elements ) { newmap += p._1 -> p._2 }; + for( val p <- `@`.elements ) { newmap += p._1 -> p._2 }; newmap += attr._1 -> attr._2; new Elem( label, child:_* ) { - private val hmap = newmap; - override def attribute = newmap.elements.toSeq( newmap.size ); + override def `@` = newmap; + override def attribute = `@`.toList; }; } } |