some support for ClassifierInState

git-svn-id: https://projects.brucker.ch/su4sml/svn/infsec-import/trunk/src/su4sml@3175 3260e6d1-4efc-4170-b0a7-36055960796d
This commit is contained in:
Jürgen Doser 2005-10-05 17:18:41 +00:00
parent d3c2e3c478
commit 68318dc4bf
5 changed files with 32 additions and 8 deletions

View File

@ -152,7 +152,8 @@ val filter_named_aends = List.filter (fn {name=SOME _,...}:XMI.AssociationEnd =
fun transform_classifier t (XMI.Class {xmiid,name,isActive,visibility,isLeaf,
generalizations,attributes,operations,
invariant,stereotype,clientDependency,
supplierDependency,taggedValue}) =
supplierDependency,taggedValue,
classifierInState}) =
let val parents = map ((find_classifier_type t) o (find_parent t))
generalizations
val filtered_parents = filter (fn x => x <> Rep_OclType.OclAny) parents

View File

@ -283,7 +283,9 @@ type Class = { xmiid : string,
stereotype: string list,
taggedValue: TaggedValue list,
clientDependency: string list,
supplierDependency: string list}
supplierDependency: string list,
(* xmi.id's of contained ClassifierInStates: *)
classifierInState: string list }
(* from UML 1.5 Core: --------------------------------------------------------
* A data type is a type whose values have no identity (i.e., they are

View File

@ -44,6 +44,7 @@ datatype HashTableEntry = Package of Rep_OclType.Path
| Transition of XMI.Transition
| Dependency of XMI.Dependency
| TagDefinition of string
| ClassifierInState of string
fun find_tagdefinition t xmiid =
(case valOf (HashTable.find t xmiid)
@ -152,12 +153,20 @@ fun filter_postcondition t cs
constr_type_name = "post"
end) cs
fun find_classifier t xmiid =
(case valOf (HashTable.find t xmiid)
of Type (_,_,c,_) => c
| _ => raise Option)
handle Option => raise IllFormed ("expected Classifier "^xmiid^" in table")
fun find_classifierInState_classifier t cis_id =
(case valOf (HashTable.find t cis_id)
of ClassifierInState c => find_classifier t c
| _ => raise Option)
handle Option => raise IllFormed ("expected ClassifierInState "
^cis_id^" in table")
fun find_activity_graph_of t xmiid =
(case valOf (HashTable.find t xmiid)
of Type (_,_,_,ag) => ag
@ -238,6 +247,9 @@ fun insert_dependency table dep =
fun insert_tagdefinition table (td:XMI.TagDefinition) =
HashTable.insert table (#xmiid td, TagDefinition (#name td))
fun insert_classifierInState table cls_id cis_id =
HashTable.insert table (cis_id,ClassifierInState cls_id)
fun insert_classifier table package_prefix class =
let val id = XMI.classifier_xmiid_of class
val name = XMI.classifier_name_of class
@ -266,7 +278,9 @@ fun insert_classifier table package_prefix class =
HashTable.insert table (id,Type (ocltype,aends,class,ag));
case class
of XMI.Class c => (List.app (insert_attribute table path) (#attributes c);
List.app (insert_operation table path) (#operations c); ())
List.app (insert_operation table path) (#operations c);
List.app (insert_classifierInState table id) (#classifierInState c);
())
| XMI.Primitive c => (List.app (insert_operation table path) (#operations c); ())
| XMI.Enumeration c => (List.app (insert_operation table path) (#operations c); ())
| XMI.Interface c => (List.app (insert_operation table path) (#operations c); ())
@ -370,8 +384,6 @@ fun classifier_has_stereotype t st c =
List.exists (fn x => (find_stereotype t x) = st)
(XMI.classifier_stereotype_of c)
(* split an association into association ends, and put the association ends *)
(* ends into the xmi.id table under the corresponding (i.e., opposite) *)
(* classifier. *)

View File

@ -154,7 +154,7 @@ datatype StateVertex =
isSynch : bool,
parameter : Parameter list,
taggedValue : TaggedValue list,
type_ : Rep_OclType.Path option}
type_ : string}
| FinalState
of {xmiid : string,
name : string,
@ -195,6 +195,9 @@ and StateMachine = mk_StateMachine of
top : StateVertex,
transitions : Transition list}
fun state_type_of (ObjectFlowState{type_,...}) = type_
| state_type_of _ = raise IllFormed "state_type_of called on a non-ObjectFlow state"
fun state_entry_of (CompositeState{entry,...}) = entry
| state_entry_of (SubactivityState{entry,...}) = entry
| state_entry_of (SimpleState{entry,...}) = entry
@ -202,6 +205,7 @@ fun state_entry_of (CompositeState{entry,...}) = entry
| state_entry_of (ObjectFlowState{entry,...}) = entry
| state_entry_of (FinalState{entry,...}) = entry
| state_entry_of (PseudoState{entry,...}) = entry
| state_entry_of _ = raise IllFormed "state_entry_of called on a state that does not have entry actions"
fun state_xmiid_of (CompositeState{xmiid,...}) = xmiid
| state_xmiid_of (SubactivityState{xmiid,...}) = xmiid

View File

@ -514,7 +514,11 @@ fun mkClass atts trees
trees)),
supplierDependency = (map (getXmiIdref o XmlTree.attributes_of)
(XmlTree.follow "UML:ModelElement.supplierDependency"
trees))}
trees)),
classifierInState = (map (getXmiId o XmlTree.attributes_of)
(XmlTree.filter "UML:ClassifierInState"
(XmlTree.follow "UML:Namespace.ownedElement"
trees)))}
fun mkAssociationClass atts trees
= XMI.AssociationClass { xmiid = getXmiId atts,
@ -790,6 +794,7 @@ fun mkState tree =
val getStereo = List.concat o
(map ((map mkStereotypeR) o XmlTree.node_children_of)) o
(XmlTree.filter "UML:ModelElement.stereotype")
fun getType t = map (getTid o hd o XmlTree.node_children_of) (XmlTree.filter "UML:ObjectFlowState.type" (XmlTree.node_children_of t))
(*
val visibility = getVisibility atts
@ -860,7 +865,7 @@ fun mkState tree =
outgoing = getOutgoing trees, incoming = getIncoming trees,
isSynch = getBoolAtt "isSynch" atts,
parameter = nil,
type_ = NONE,
type_ = hd (getType tree),
taggedValue = getTagVal trees}
|"UML:FinalState" =>
XMI.FinalState{