Refactor _lendiff to use multiple dispatch

This commit is contained in:
Thomas A. Christensen II 2023-01-03 20:11:08 -06:00
parent cab3029bc6
commit dd405c5f4b

View file

@ -57,6 +57,8 @@ function BioGenerics.rightposition(e::Edit)
end
function lendiff(edit::Edit)
x = edit.x
return x isa Substitution ? 0 : (x isa Deletion ? -length(x) : length(x.x))
x = _mutation(edit)
# Each edit type has logic for its length, we just need to know what direction to go
multiplier = x isa Substitution ? 0 : (x isa Deletion ? -1 : 1)
return length(x) * multiplier
end