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 end
function lendiff(edit::Edit) function lendiff(edit::Edit)
x = edit.x x = _mutation(edit)
return x isa Substitution ? 0 : (x isa Deletion ? -length(x) : length(x.x)) # 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 end