-loadData :: String -- ^ Node data in text format
- -> String -- ^ Instance data in text format
- -> Result (Container.Container Node.Node,
- Container.Container Instance.Instance,
- String, NameList, NameList)
-loadData ndata idata = do
- {- node file: name t_mem n_mem f_mem t_disk f_disk -}
- (ktn, nl) <- loadTabular ndata
- (\ (name:tm:nm:fm:td:fd:fo:[]) ->
- return (name,
- if any (== "?") [tm,nm,fm,td,fd] || fo == "Y" then
- Node.create 0 0 0 0 0 True
- else
- Node.create (read tm) (read nm) (read fm)
- (read td) (read fd) False
- ))
- Node.setIdx
- {- instance file: name mem disk status pnode snode -}
- (kti, il) <- loadTabular idata
- (\ (name:mem:dsk:status:pnode:snode:[]) -> do
- pidx <- lookupNode pnode name ktn
- sidx <- lookupNode snode name ktn
- let newinst = Instance.create (read mem) (read dsk)
- status pidx sidx
- return (name, newinst)
- )
- Instance.setIdx
+loadData :: ([(String, Int)], Node.AssocList,
+ [(String, Int)], Instance.AssocList) -- ^ Data from either
+ -- Text.loadData
+ -- or Rapi.loadData
+ -> Result (NodeList, InstanceList, String, NameList, NameList)
+loadData (ktn, nl, kti, il) = do