self
lesser than other
?
redef fun <(other: OTHER): Bool do
if self == other then return false
if self.located_in(other) then return true
if other.located_in(self) then return false
if line_start != other.line_start then return line_start < other.line_start
if column_start != other.column_start then return column_start < other.column_start
if line_end != other.line_end then return line_end < other.line_end
return column_end < other.column_end
end
src/location.nit:253,2--263,4
# Lexicographical comparaison
#
# ~~~
# assert "abc" < "xy"
# assert "ABC" < "abc"
# ~~~
redef fun <(other)
do
var self_chars = self.chars.iterator
var other_chars = other.chars.iterator
while self_chars.is_ok and other_chars.is_ok do
if self_chars.item < other_chars.item then return true
if self_chars.item > other_chars.item then return false
self_chars.next
other_chars.next
end
if self_chars.is_ok then
return false
else
return true
end
end
lib/core/text/abstract_text.nit:1054,2--1077,4
redef fun <(other)
do
if not other isa FlatText then return super
if self.object_id == other.object_id then return false
var myits = _items
var itsits = other._items
var mbt = _byte_length
var obt = other.byte_length
var minln = if mbt < obt then mbt else obt
var mst = _first_byte
var ost = other.first_byte
for i in [0 .. minln[ do
var my_curr_char = myits[mst]
var its_curr_char = itsits[ost]
if my_curr_char > its_curr_char then return false
if my_curr_char < its_curr_char then return true
mst += 1
ost += 1
end
return mbt < obt
end
lib/core/text/flat.nit:570,2--598,4