1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 06:11:49 +03:00

Invert reverse d-paths as appropriate.

This commit is contained in:
Rob Rix 2017-03-13 11:22:43 -04:00
parent f1ad91a346
commit 14f96d8bf0

View File

@ -108,7 +108,7 @@ decompose myers = let ?callStack = popCallStack callStack in case myers of
backwardV <- gets backward
let reverseEndpoint = let x = backwardV `at` k in Endpoint x (x - k)
if odd delta && k `inInterval` (delta - pred d, delta + pred d) && overlaps graph forwardEndpoint reverseEndpoint then
return (Just (Snake reverseEndpoint forwardEndpoint, EditDistance $ 2 * d - 1))
return (Just (Snake (Endpoint (n - x reverseEndpoint) (m - y reverseEndpoint)) forwardEndpoint, EditDistance $ 2 * d - 1))
else
continue)
<*> for [negate d, negate d + 2 .. d] (\ k -> do
@ -116,7 +116,7 @@ decompose myers = let ?callStack = popCallStack callStack in case myers of
forwardV <- gets forward
let forwardEndpoint = let x = forwardV `at` (k + delta) in Endpoint x (x - k)
if even delta && (k + delta) `inInterval` (negate d, d) && overlaps graph forwardEndpoint reverseEndpoint then
return (Just (Snake reverseEndpoint forwardEndpoint, EditDistance $ 2 * d))
return (Just (Snake (Endpoint (n - x reverseEndpoint) (m - y reverseEndpoint)) forwardEndpoint, EditDistance $ 2 * d))
else
continue)