From dd405c5f4b75d8d201a684165da1747eac039db0 Mon Sep 17 00:00:00 2001 From: "Thomas A. Christensen II" <25492070+MillironX@users.noreply.github.com> Date: Tue, 3 Jan 2023 20:11:08 -0600 Subject: [PATCH] Refactor _lendiff to use multiple dispatch --- src/Edit.jl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Edit.jl b/src/Edit.jl index 7b5fe42..dc06f3f 100644 --- a/src/Edit.jl +++ b/src/Edit.jl @@ -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