lib/standard/ropes: Adapted == method for Ropes since the == method from Collection...
authorLucas Bajolet <r4pass@hotmail.com>
Thu, 5 Jun 2014 14:37:48 +0000 (10:37 -0400)
committerLucas Bajolet <r4pass@hotmail.com>
Thu, 5 Jun 2014 18:17:07 +0000 (14:17 -0400)
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

lib/standard/ropes.nit

index 40d531b..f69b547 100644 (file)
@@ -154,6 +154,17 @@ abstract class Rope
                end
        end
 
+       redef fun ==(o)
+       do
+               if not o isa Text then return false
+               if o.length != self.length then return false
+               var oit = o.chars.iterator
+               for i in self.chars.iterator do
+                       if i != oit.item then return false
+                       oit.next
+               end
+               return true
+       end
 end
 
 # Rope that cannot be modified