Implement break list attachments without internal item updates
This commit is contained in:
@@ -231,11 +231,16 @@ springLinkTest = LTest (const Nothing) $
|
|||||||
|
|
||||||
type LDTComb a b = LabelDoubleTree b a -> LabelDoubleTree b a -> Maybe (LabelDoubleTree b a)
|
type LDTComb a b = LabelDoubleTree b a -> LabelDoubleTree b a -> Maybe (LabelDoubleTree b a)
|
||||||
|
|
||||||
leftIsParentCombine' :: LDTComb CItem ItemLink
|
|
||||||
leftIsParentCombine' ltree rtree = Nothing
|
|
||||||
|
|
||||||
leftIsParentCombine :: LDTComb CItem ItemLink
|
leftIsParentCombine :: LDTComb CItem ItemLink
|
||||||
leftIsParentCombine ltree rtree = do
|
leftIsParentCombine ltree rtree = do
|
||||||
|
let l = rightChildList ltree
|
||||||
|
xs = dropWhile ((\s -> not $ S.member s (structureToPotentialFunction rtree)) . fst) l
|
||||||
|
(sf,linktype) <- safeHead xs
|
||||||
|
return $
|
||||||
|
ltree & ldtRight .:~ (linktype, rtree & ldtValue . _2 .~ sf)
|
||||||
|
|
||||||
|
leftIsParentCombine' :: LDTComb CItem ItemLink
|
||||||
|
leftIsParentCombine' ltree rtree = do
|
||||||
lu <- (ltree ^. ldtValue . _3 . tryRightLink) rtree --(rtree ^. ldtValue)
|
lu <- (ltree ^. ldtValue . _3 . tryRightLink) rtree --(rtree ^. ldtValue)
|
||||||
return $
|
return $
|
||||||
ltree & ldtValue %~ (lu ^. luParentUpdate)
|
ltree & ldtValue %~ (lu ^. luParentUpdate)
|
||||||
@@ -255,6 +260,12 @@ leftChildList t = foldl' f l (reverse $ t ^.. ldtLeft . each . _1)
|
|||||||
l = fst $ itemToBreakLists (t ^. ldtValue . _1) (t ^. ldtValue . _2)
|
l = fst $ itemToBreakLists (t ^. ldtValue . _1) (t ^. ldtValue . _2)
|
||||||
f x y = tail $ dropWhile ((/=y) . snd) x
|
f x y = tail $ dropWhile ((/=y) . snd) x
|
||||||
|
|
||||||
|
rightChildList :: LabelDoubleTree ItemLink CItem -> [(ItemStructuralFunction, ItemLink)]
|
||||||
|
rightChildList t = foldl' f l (reverse $ t ^.. ldtRight . each . _1)
|
||||||
|
where
|
||||||
|
l = snd $ itemToBreakLists (t ^. ldtValue . _1) (t ^. ldtValue . _2)
|
||||||
|
f x y = tail $ dropWhile ((/=y) . snd) x
|
||||||
|
|
||||||
rightIsParentCombine' :: LDTComb CItem ItemLink
|
rightIsParentCombine' :: LDTComb CItem ItemLink
|
||||||
rightIsParentCombine' ltree rtree = do
|
rightIsParentCombine' ltree rtree = do
|
||||||
lu <- (rtree ^. ldtValue . _3 . tryLeftLink) ltree -- (ltree ^. ldtValue)
|
lu <- (rtree ^. ldtValue . _3 . tryLeftLink) ltree -- (ltree ^. ldtValue)
|
||||||
|
|||||||
Reference in New Issue
Block a user