cleanup
git-svn-id: https://projects.brucker.ch/su4sml/svn/su4sml/trunk@8363 3260e6d1-4efc-4170-b0a7-36055960796d
This commit is contained in:
parent
c9853fadbd
commit
1b9374388d
|
@ -142,129 +142,6 @@ fun parseModel oclFile =
|
|||
in
|
||||
(#2 context_classes)
|
||||
end
|
||||
(*
|
||||
fun removePackages (uml,ocl) packageList =
|
||||
let
|
||||
(* filter package and update associations
|
||||
* fun filter_package model p = filter (fn cl => not
|
||||
* (Rep_Core.package_of cl = p)) model *)
|
||||
fun filter_package (all_classifiers,all_associations) p =
|
||||
let
|
||||
|
||||
(* FIXME: correct handling for reflexive assocs + !isNavigable *)
|
||||
fun valid_assoc {name,aends,qualifiers,aclass} =
|
||||
List.length aends > 1
|
||||
|
||||
fun update_association cls_name {name,aends,qualifiers,aclass}
|
||||
:Rep_Core.association =
|
||||
let
|
||||
val cls_path = Rep_OclType.path_of_OclType cls_name
|
||||
val modified_aclass = if (cls_path = (valOf aclass))
|
||||
then NONE
|
||||
else aclass
|
||||
val modified_aends = filter (fn {aend_type,...} =>
|
||||
not (aend_type = cls_name))
|
||||
aends
|
||||
in
|
||||
{name=name,
|
||||
aends=modified_aends,
|
||||
qualifiers=qualifiers (*FIXME?*),
|
||||
aclass=modified_aclass}
|
||||
end
|
||||
|
||||
fun update_associationends ((Rep_Core.Class {name,associations,
|
||||
...}),assocs):
|
||||
Rep_Core.association list =
|
||||
let
|
||||
val assocs = let
|
||||
fun m f (x::xs) = ((f x)::(m f xs)
|
||||
handle _ => (m f xs))
|
||||
| m f [] = []
|
||||
in
|
||||
m (get_association all_associations)
|
||||
associations
|
||||
end
|
||||
val modified_assocs = map (update_association name) assocs
|
||||
in
|
||||
filter valid_assoc modified_assocs
|
||||
end
|
||||
| update_associationends ((Rep_Core.AssociationClass
|
||||
{name, associations,association,
|
||||
...}),assocs) =
|
||||
let
|
||||
(* update_association also handles the aclass update *)
|
||||
val assocs = let
|
||||
fun m f (x::xs) = ((f x)::(m f xs)
|
||||
handle _ => (m f xs))
|
||||
| m f [] = []
|
||||
in
|
||||
m (get_association all_associations)
|
||||
(association::associations)
|
||||
end
|
||||
val modified_assocs = map (update_association name) assocs
|
||||
in
|
||||
filter valid_assoc modified_assocs
|
||||
end
|
||||
| update_associationends ((Rep_Core.Primitive
|
||||
{name,associations,...}),assocs)=
|
||||
let
|
||||
val assocs = map (get_association all_associations)
|
||||
associations
|
||||
val modified_assocs = map (update_association name) assocs
|
||||
in
|
||||
filter valid_assoc modified_assocs
|
||||
end
|
||||
| update_associationends ((Rep_Core.Template
|
||||
{parameter,classifier}),assocs) =
|
||||
(* FIXME: sound? *)
|
||||
update_associationends (classifier,assocs)
|
||||
| update_associationends (_,assocs) =
|
||||
assocs
|
||||
|
||||
val _ = trace high "### clasifiers \n"
|
||||
val (kept_classifiers,removed_cls) =
|
||||
List.partition (fn cl => not (Rep_Core.package_of cl = p))
|
||||
all_classifiers
|
||||
val _ = trace high "### associations\n"
|
||||
val kept_associations =
|
||||
(case removed_cls of
|
||||
[] => all_associations
|
||||
| xs => foldl update_associationends all_associations xs)
|
||||
in
|
||||
(kept_classifiers,kept_associations)
|
||||
end
|
||||
|
||||
fun filter_cl_package cl p =
|
||||
List.filter (fn cl => not (package_of_context cl = p)) cl
|
||||
val _ = trace high "### Excluding Packages ###\n"
|
||||
val _ = trace high "### UML\n"
|
||||
val uml =
|
||||
let
|
||||
fun stringToPath s = (String.tokens (fn s => (s = (#":"))) s)
|
||||
in
|
||||
foldr (fn (p,m) => filter_package m (stringToPath p))
|
||||
uml packageList
|
||||
end
|
||||
val _ = trace high "### OCL\n"
|
||||
val ocl =
|
||||
let
|
||||
fun stringToPath s = (String.tokens (fn s => (s = (#":"))) s)
|
||||
in
|
||||
foldr (fn (p,m) => filter_cl_package m (stringToPath p))
|
||||
ocl packageList
|
||||
end
|
||||
val _ = trace high ("### Finished excluding Packages ("
|
||||
^(Int.toString(length (#1 uml)))
|
||||
^ " Classifiers found and "
|
||||
^(Int.toString(length (#2 uml)))
|
||||
^ " Associations found and "
|
||||
^(Int.toString(length ocl))
|
||||
^" Constraints Found) ###\n\n")
|
||||
in
|
||||
(uml,ocl)
|
||||
end
|
||||
*)
|
||||
|
||||
|
||||
fun removePackages packageList (cl,al) =
|
||||
let
|
||||
|
|
Loading…
Reference in New Issue