From: Lucas Bajolet Date: Thu, 5 Jun 2014 14:37:48 +0000 (-0400) Subject: lib/standard/ropes: Adapted == method for Ropes since the == method from Collection... X-Git-Tag: v0.6.6~43^2~13 X-Git-Url: http://nitlanguage.org lib/standard/ropes: Adapted == method for Ropes since the == method from Collection uses indexed access => very slow on ropes. Signed-off-by: Lucas Bajolet --- diff --git a/lib/standard/ropes.nit b/lib/standard/ropes.nit index 40d531b..f69b547 100644 --- a/lib/standard/ropes.nit +++ b/lib/standard/ropes.nit @@ -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