[Fragemnts to Hypotheses propagated
martin.hofmann@uni-bamberg.de**20081114141209] hunk ./src/Data/Hypotheses.hs 4
-    Hypo, openRs, closedRs, allRs, 
-    hypo, updateRule,
+    Hypo, 
+    hypo, extend, shrink, modify,
hunk ./src/Data/Hypotheses.hs 16
-import Data.Rules (Rule, Rules, rule, rules, isOpen, Rateable(..), RatingData, )
-import qualified Data.Rules as R (insert,delete, replace, map, fold, union)
hunk ./src/Data/Hypotheses.hs 17
+import Terms
+
hunk ./src/Data/Hypotheses.hs 22
+import Data.Map (Map)
+import qualified Data.Map as M
+
+import Data.Rules (Rules, Rule, Rateable(..), rules)
+import qualified Data.Rules as R --(insert,delete, replace, map, fold, union)
+
+import Data.Fragments (RuleFrag, RuleFrags,name, frag, covr, opos, isOpen)
+import qualified Data.Fragments as F
+
+
hunk ./src/Data/Hypotheses.hs 36
-data Hypo  = HH { open   :: Rules
-                , closed :: Rules
+
+data Hypo  = HH { open   :: RuleFrags
+                , clsd :: Map Name Rules
hunk ./src/Data/Hypotheses.hs 42
--- should be more like this
---data Hypo  = HH { open   :: [(Rule,[Int])]
---                , closed :: Rules
---                }
--- where the Ints are the indices of the covered rule, stored in IOData
-
hunk ./src/Data/Hypotheses.hs 53
-instance Rateable Hypo where
-    rate h       = R.fold (\r d -> (rate r)+d) 0 (open h)
+--instance Rateable Hypo where
+--    rate h       = foldr (\r d -> (rate(fst r))+d) 0 (open h)
hunk ./src/Data/Hypotheses.hs 66
-hypo 
-     :: Rules   -- ^open rules 
-     -> Rules   -- ^closed rules
-     -> Hypo    
-hypo ro rc  = HH ro rc
-
--- | Accessors for Hypothese
-openRs, closedRs, allRs :: Hypo -> Rules
-openRs   = open
-closedRs = closed
-allRs h  = R.union (open h) (closed h)
+hypo :: RuleFrags -> Hypo    
+hypo ro  = HH ro M.empty
hunk ./src/Data/Hypotheses.hs 69
-     
hunk ./src/Data/Hypotheses.hs 70
-updateRule 
-     :: Rule    -- ^replace/update old rule
-     -> Rule    -- ^with new rule
+
+extend :: RuleFrag -> Hypo -> Hypo
+extend rf (HH open clsd) 
+    | isOpen rf  = HH (F.insert rf open) clsd
+    | otherwise  = HH open $ M.alter (R.insertM (frag rf)) (name rf) clsd
+
+shrink :: RuleFrag -> Hypo -> Hypo
+shrink rf (HH open clsd) 
+    | isOpen rf  = HH (F.delete rf open) clsd
+    | otherwise  = HH open $ M.alter (R.deleteM (frag rf)) (name rf) clsd
+    
+
+modify 
+     :: RuleFrag    -- ^replace/update old rule
+     -> RuleFrag    -- ^with new rule
hunk ./src/Data/Hypotheses.hs 87
-updateRule rold rnew h = 
-    let
-        openrs = if isOpen rnew
-                    then R.replace rold rnew $ open $ h
-                    -- we assume a new rule to be 'brand' new
-                    else R.delete rold $ open $ h
-        clsdrs = if (isOpen rnew)
-                    then closed  h
-                    else R.insert rnew $ closed h
-        in hypo openrs clsdrs
+modify rold rnew h = 
+    (extend rnew) $ (shrink rold) h