-- LTS graph printing function to ALDEBARAN format

printALD :: [Node] -> String
printALD nl = "des (0," ++ show (countTransitions(0, nl)) ++ "," ++ show (length nl) ++ ")\n" 
         ++ dumpALDtrans nl 
-- printALD nl = dumpALDtrans nl 

countTransitions :: (Int,[Node]) -> Int
countTransitions (cnt,[]) = cnt
countTransitions (cnt,(n, as, t):ns)= countTransitions(cnt+countT(t),ns)

countT :: [(string,Int)] -> Int
countT [] = 0
countT ((f,n):ts) = 1 + countT ts

dumpALDtrans :: [Node] -> String
dumpALDtrans [] = []
dumpALDtrans (n:ns) = dumpSingleTransALD n ++ dumpALDtrans ns

dumpSingleTransALD :: Node -> String
dumpSingleTransALD (n,_,tl) = dumpTRALD (n,tl)

dumpTRALD :: (Int,[(String,Int)]) -> String
dumpTRALD (_,[]) = []
dumpTRALD (n,(f,x):ts) = 	"(" ++ 
			(show n) ++
			"," ++
			(show f) ++
			"," ++ 
			(show x) ++ 
			")\n" ++
			dumpTRALD (n,ts)

showWL :: [String] -> String
showWL [] = "[]"
showWL (we:[]) = "[" ++ we ++"]"
showWL (we:ws) = "[" ++ we ++ "," ++ "]"
