mirror of
https://github.com/github/semantic.git
synced 2024-12-22 14:21:31 +03:00
at does not return in Myers.
This commit is contained in:
parent
a41a4aa9b0
commit
9ab575b264
@ -65,15 +65,13 @@ findDPath direction d k = M (FindDPath direction d k) `Then` return
|
|||||||
data MyersState = MyersState { forward :: !(Vector.Vector Int), backward :: !(Vector.Vector Int), offset :: Diagonal }
|
data MyersState = MyersState { forward :: !(Vector.Vector Int), backward :: !(Vector.Vector Int), offset :: Diagonal }
|
||||||
|
|
||||||
getK :: Direction -> Diagonal -> Myers Endpoint
|
getK :: Direction -> Diagonal -> Myers Endpoint
|
||||||
getK direction diagonal = do
|
getK direction (Diagonal diagonal) = do
|
||||||
state <- get
|
MyersState forward backward (Diagonal offset) <- get
|
||||||
let v = (case direction of { Forward -> forward ; Reverse -> backward }) state
|
let v = case direction of { Forward -> forward ; Reverse -> backward }
|
||||||
v `at` diagonal
|
return $! v `at` Diagonal (offset + diagonal)
|
||||||
|
|
||||||
at :: Vector.Vector Int -> Diagonal -> Myers Endpoint
|
at :: Vector.Vector Int -> Diagonal -> Endpoint
|
||||||
at v (Diagonal k) = do
|
at v (Diagonal k) = Endpoint (v Vector.! k) 0
|
||||||
Diagonal o <- gets offset
|
|
||||||
return (Endpoint (v Vector.! o + k) 0)
|
|
||||||
|
|
||||||
overlaps :: Endpoint -> Endpoint -> Bool
|
overlaps :: Endpoint -> Endpoint -> Bool
|
||||||
overlaps (Endpoint x y) (Endpoint u v) = x - y == u - v && x <= u
|
overlaps (Endpoint x y) (Endpoint u v) = x - y == u - v && x <= u
|
||||||
|
Loading…
Reference in New Issue
Block a user