module CM.Helpers where
import CM.Metamodel
pquantShow :: ParticipationQuantity -> String
pquantShow (Limited x) = show x
pquantShow Unlimited = "*"
pquantShow Unique = "1"
ptypeShow :: ParticipationType -> String
ptypeShow pt = case pt of
(Mandatory Unique) -> "1"
(Optional Unique) -> "0..1"
(Mandatory x) -> "1.." ++ pquantShow x
(Optional x) -> "0.." ++ pquantShow x
(Custom x y) -> pquantShow x ++ ".." ++ pquantShow y
findAttributeValue :: [MetaAttribute] -> String -> String
findAttributeValue [] _ = ""
findAttributeValue (x:xs) a = if a == maName x then maValue x
else findAttributeValue xs a
findParticipantId :: [MetaParticipation] -> String -> String
findParticipantId [] _ = ""
findParticipantId (x:xs) a = if a == mpName x then mpIdentifier x
else findParticipantId xs a