+ equiv on TriplesBlock is unsorted
authorEric Prud'hommeaux <eric@w3.org>
Sun, 14 Feb 2010 07:46:50 -0500
changeset 164 6a5bfefcfcdb
parent 163 90cd6100e605
child 165 8b545d69368e
+ equiv on TriplesBlock is unsorted
src/main/scala/SPARQL.scala
--- a/src/main/scala/SPARQL.scala	Thu Feb 11 09:52:33 2010 -0500
+++ b/src/main/scala/SPARQL.scala	Sun Feb 14 07:46:50 2010 -0500
@@ -112,6 +112,12 @@
 
 case class TriplesBlock(triplepatterns:List[TriplePattern]) extends GraphPattern {
   override def toString = "{\n  " + (triplepatterns.toList.map(s => s.toString.replace("\n", "\n  ")).mkString(".\n  ")) + "\n}"
+  override def equals (other:Any):Boolean = other match {
+    case that:TriplesBlock => (that canEqual this) && triplepatterns.toSet == that.triplepatterns.toSet
+    case _ => false
+  }
+  override def canEqual(other : Any) : Boolean = other.isInstanceOf[TriplesBlock]
+  override def hashCode:Int = 41*triplepatterns.toSet.hashCode
 }
 case class TableConjunction(gps:List[GraphPattern]) extends GraphPattern {
   assert (!(gps exists (x => { x match { case TableConjunction(_) => true case _ => false } })))