Tiefes Renaming von rep_ocl.
git-svn-id: https://projects.brucker.ch/su4sml/svn/infsec-import/trunk/src/su4sml@3037 3260e6d1-4efc-4170-b0a7-36055960796d
This commit is contained in:
parent
6faecbf088
commit
ddc36ea5e8
|
@ -25,7 +25,7 @@
|
|||
signature REP =
|
||||
sig
|
||||
|
||||
include MDR_CORE
|
||||
include REP_CORE
|
||||
include REP_ACTIVITY_GRAPH
|
||||
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
structure Rep : REP =
|
||||
struct
|
||||
|
||||
open mdr_core Rep_StateMachine Rep_ActivityGraph
|
||||
open Rep_Core Rep_StateMachine Rep_ActivityGraph
|
||||
|
||||
|
||||
end
|
||||
|
|
|
@ -22,18 +22,18 @@
|
|||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
******************************************************************************)
|
||||
|
||||
signature MDR_CORE =
|
||||
signature REP_CORE =
|
||||
sig
|
||||
type operation = { name : string,
|
||||
precondition : (string option * ocl_term.OclTerm) list,
|
||||
postcondition : (string option * ocl_term.OclTerm) list,
|
||||
arguments : (string * ocl_type.OclType) list,
|
||||
result : ocl_type.OclType,
|
||||
precondition : (string option * Rep_OclTerm.OclTerm) list,
|
||||
postcondition : (string option * Rep_OclTerm.OclTerm) list,
|
||||
arguments : (string * Rep_OclType.OclType) list,
|
||||
result : Rep_OclType.OclType,
|
||||
isQuery : bool
|
||||
}
|
||||
|
||||
type associationend = {name : string,
|
||||
aend_type : ocl_type.OclType,
|
||||
aend_type : Rep_OclType.OclType,
|
||||
multiplicity: (int * int) list,
|
||||
ordered: bool
|
||||
}
|
||||
|
@ -41,43 +41,43 @@ type associationend = {name : string,
|
|||
|
||||
datatype Classifier =
|
||||
Class of
|
||||
{ name : ocl_type.Path,
|
||||
parent : ocl_type.Path option,
|
||||
attributes : (string * ocl_type.OclType) list,
|
||||
{ name : Rep_OclType.Path,
|
||||
parent : Rep_OclType.Path option,
|
||||
attributes : (string * Rep_OclType.OclType) list,
|
||||
operations : operation list,
|
||||
associationends : associationend list,
|
||||
invariant : (string option * ocl_term.OclTerm) list,
|
||||
invariant : (string option * Rep_OclTerm.OclTerm) list,
|
||||
stereotypes : string list,
|
||||
interfaces : ocl_type.Path list,
|
||||
interfaces : Rep_OclType.Path list,
|
||||
thyname : string option,
|
||||
activity_graphs : Rep_ActivityGraph.ActivityGraph list
|
||||
}
|
||||
| Interface of (* not supported yet *)
|
||||
{ name : ocl_type.Path,
|
||||
parents : ocl_type.Path list,
|
||||
{ name : Rep_OclType.Path,
|
||||
parents : Rep_OclType.Path list,
|
||||
operations : operation list,
|
||||
stereotypes : string list,
|
||||
invariant : (string option * ocl_term.OclTerm) list,
|
||||
invariant : (string option * Rep_OclTerm.OclTerm) list,
|
||||
thyname : string option
|
||||
}
|
||||
| Enumeration of (* not really supported yet? *)
|
||||
{ name : ocl_type.Path,
|
||||
parent : ocl_type.Path option,
|
||||
{ name : Rep_OclType.Path,
|
||||
parent : Rep_OclType.Path option,
|
||||
operations : operation list,
|
||||
literals : string list,
|
||||
invariant : (string option * ocl_term.OclTerm) list,
|
||||
invariant : (string option * Rep_OclTerm.OclTerm) list,
|
||||
stereotypes : string list,
|
||||
interfaces : ocl_type.Path list,
|
||||
interfaces : Rep_OclType.Path list,
|
||||
thyname : string option
|
||||
}
|
||||
| Primitive of (* not really supported yet *)
|
||||
{ name : ocl_type.Path,
|
||||
parent : ocl_type.Path option,
|
||||
{ name : Rep_OclType.Path,
|
||||
parent : Rep_OclType.Path option,
|
||||
operations : operation list,
|
||||
associationends : associationend list,
|
||||
invariant : (string option * ocl_term.OclTerm) list,
|
||||
invariant : (string option * Rep_OclTerm.OclTerm) list,
|
||||
stereotypes : string list,
|
||||
interfaces : ocl_type.Path list,
|
||||
interfaces : Rep_OclType.Path list,
|
||||
thyname : string option
|
||||
}
|
||||
|
||||
|
@ -85,25 +85,25 @@ val OclAnyC : Classifier
|
|||
|
||||
val normalize : Classifier -> Classifier
|
||||
|
||||
val name_of : Classifier -> ocl_type.Path
|
||||
val package_of : Classifier -> ocl_type.Path
|
||||
val name_of : Classifier -> Rep_OclType.Path
|
||||
val package_of : Classifier -> Rep_OclType.Path
|
||||
val short_name_of : Classifier -> string
|
||||
|
||||
val parent_name_of : Classifier -> ocl_type.Path
|
||||
val parent_package_of : Classifier -> ocl_type.Path
|
||||
val parent_name_of : Classifier -> Rep_OclType.Path
|
||||
val parent_package_of : Classifier -> Rep_OclType.Path
|
||||
val short_parent_name_of : Classifier -> string
|
||||
|
||||
val thy_name_of : Classifier -> string
|
||||
val update_thyname : string -> Classifier -> Classifier
|
||||
val attributes_of : Classifier -> (string * ocl_type.OclType) list
|
||||
val attributes_of : Classifier -> (string * Rep_OclType.OclType) list
|
||||
val operations_of : Classifier -> operation list
|
||||
val invariant_of : Classifier -> (string option * ocl_term.OclTerm) list
|
||||
val invariant_of : Classifier -> (string option * Rep_OclTerm.OclTerm) list
|
||||
val string_of_path : string list -> string
|
||||
|
||||
val arguments_of_op : operation -> (string * ocl_type.OclType) list
|
||||
val precondition_of_op : operation -> (string option * ocl_term.OclTerm) list
|
||||
val result_of_op : operation -> ocl_type.OclType
|
||||
val postcondition_of_op : operation -> (string option * ocl_term.OclTerm) list
|
||||
val arguments_of_op : operation -> (string * Rep_OclType.OclType) list
|
||||
val precondition_of_op : operation -> (string option * Rep_OclTerm.OclTerm) list
|
||||
val result_of_op : operation -> Rep_OclType.OclType
|
||||
val postcondition_of_op : operation -> (string option * Rep_OclTerm.OclTerm) list
|
||||
val name_of_op : operation -> string
|
||||
val mangled_name_of_op : operation -> string
|
||||
|
||||
|
|
|
@ -22,66 +22,66 @@
|
|||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
******************************************************************************)
|
||||
|
||||
structure mdr_core : MDR_CORE =
|
||||
structure Rep_Core : REP_CORE =
|
||||
struct
|
||||
type operation = { name : string,
|
||||
precondition : (string option * ocl_term.OclTerm) list,
|
||||
postcondition : (string option * ocl_term.OclTerm) list,
|
||||
arguments : (string * ocl_type.OclType) list,
|
||||
result : ocl_type.OclType,
|
||||
precondition : (string option * Rep_OclTerm.OclTerm) list,
|
||||
postcondition : (string option * Rep_OclTerm.OclTerm) list,
|
||||
arguments : (string * Rep_OclType.OclType) list,
|
||||
result : Rep_OclType.OclType,
|
||||
isQuery : bool }
|
||||
|
||||
type associationend = {name : string,
|
||||
aend_type: ocl_type.OclType,
|
||||
aend_type: Rep_OclType.OclType,
|
||||
multiplicity: (int*int) list,
|
||||
ordered: bool }
|
||||
|
||||
datatype Classifier =
|
||||
Class of
|
||||
{ name : ocl_type.Path,
|
||||
parent : ocl_type.Path option,
|
||||
attributes : (string * ocl_type.OclType) list,
|
||||
{ name : Rep_OclType.Path,
|
||||
parent : Rep_OclType.Path option,
|
||||
attributes : (string * Rep_OclType.OclType) list,
|
||||
operations : operation list,
|
||||
associationends : associationend list,
|
||||
invariant : (string option * ocl_term.OclTerm) list,
|
||||
invariant : (string option * Rep_OclTerm.OclTerm) list,
|
||||
stereotypes : string list,
|
||||
interfaces : ocl_type.Path list,
|
||||
interfaces : Rep_OclType.Path list,
|
||||
thyname : string option,
|
||||
activity_graphs : Rep_ActivityGraph.ActivityGraph list
|
||||
}
|
||||
| Interface of (* not supported yet *)
|
||||
{ name : ocl_type.Path,
|
||||
parents : ocl_type.Path list,
|
||||
{ name : Rep_OclType.Path,
|
||||
parents : Rep_OclType.Path list,
|
||||
operations : operation list,
|
||||
stereotypes : string list,
|
||||
invariant : (string option * ocl_term.OclTerm) list,
|
||||
invariant : (string option * Rep_OclTerm.OclTerm) list,
|
||||
thyname : string option
|
||||
}
|
||||
| Enumeration of (* not really supported yet? *)
|
||||
{ name : ocl_type.Path,
|
||||
parent : ocl_type.Path option,
|
||||
{ name : Rep_OclType.Path,
|
||||
parent : Rep_OclType.Path option,
|
||||
operations : operation list,
|
||||
literals : string list,
|
||||
invariant : (string option * ocl_term.OclTerm) list,
|
||||
invariant : (string option * Rep_OclTerm.OclTerm) list,
|
||||
stereotypes : string list,
|
||||
interfaces : ocl_type.Path list,
|
||||
interfaces : Rep_OclType.Path list,
|
||||
thyname : string option
|
||||
}
|
||||
| Primitive of (* not really supported yet *)
|
||||
{ name : ocl_type.Path,
|
||||
parent : ocl_type.Path option,
|
||||
{ name : Rep_OclType.Path,
|
||||
parent : Rep_OclType.Path option,
|
||||
operations : operation list,
|
||||
associationends : associationend list,
|
||||
invariant : (string option * ocl_term.OclTerm) list,
|
||||
invariant : (string option * Rep_OclTerm.OclTerm) list,
|
||||
stereotypes : string list,
|
||||
interfaces : ocl_type.Path list,
|
||||
interfaces : Rep_OclType.Path list,
|
||||
thyname : string option
|
||||
}
|
||||
|
||||
(* convert an association end into the corresponding collection type *)
|
||||
fun assoc_to_attr_type {name,aend_type,multiplicity,ordered} =
|
||||
if ordered then ocl_type.Sequence aend_type (* OrderedSet? *)
|
||||
else ocl_type.Set aend_type
|
||||
if ordered then Rep_OclType.Sequence aend_type (* OrderedSet? *)
|
||||
else Rep_OclType.Set aend_type
|
||||
|
||||
(* convert an association end into an attribute of the *)
|
||||
(* corresponding collection type *)
|
||||
|
@ -90,36 +90,36 @@ fun assoc_to_attr (assoc:associationend) = (#name assoc,assoc_to_attr_type assoc
|
|||
(* convert a multiplicity range into an invariant of the form *)
|
||||
(* size > lowerBound and size < upperBound ) *)
|
||||
fun range_to_inv cls_name aend (a,b) =
|
||||
let val cls = ocl_type.Classifier cls_name
|
||||
let val cls = Rep_OclType.Classifier cls_name
|
||||
val attr_type = assoc_to_attr_type aend
|
||||
val attr_name = cls_name@[#name aend]
|
||||
val literal_a = ocl_term.Literal (Int.toString a, ocl_type.Integer)
|
||||
val literal_b = ocl_term.Literal (Int.toString b, ocl_type.Integer)
|
||||
val self = ocl_term.Variable ("self",cls)
|
||||
val attribute = ocl_term.AttributeCall (self,cls,attr_name,attr_type)
|
||||
val literal_a = Rep_OclTerm.Literal (Int.toString a, Rep_OclType.Integer)
|
||||
val literal_b = Rep_OclTerm.Literal (Int.toString b, Rep_OclType.Integer)
|
||||
val self = Rep_OclTerm.Variable ("self",cls)
|
||||
val attribute = Rep_OclTerm.AttributeCall (self,cls,attr_name,attr_type)
|
||||
val attribute_size =
|
||||
ocl_term.OperationCall (attribute,attr_type,
|
||||
Rep_OclTerm.OperationCall (attribute,attr_type,
|
||||
["oclLib","Collection","size"],[],
|
||||
ocl_type.Integer)
|
||||
Rep_OclType.Integer)
|
||||
val lower_bound =
|
||||
ocl_term.OperationCall (attribute_size,ocl_type.Integer,
|
||||
Rep_OclTerm.OperationCall (attribute_size,Rep_OclType.Integer,
|
||||
["oclLib","Real",">="],
|
||||
[(literal_a,ocl_type.Integer)],ocl_type.Boolean)
|
||||
[(literal_a,Rep_OclType.Integer)],Rep_OclType.Boolean)
|
||||
val upper_bound =
|
||||
ocl_term.OperationCall (attribute_size,ocl_type.Integer,
|
||||
Rep_OclTerm.OperationCall (attribute_size,Rep_OclType.Integer,
|
||||
["oclLib","Real","<="],
|
||||
[(literal_b,ocl_type.Integer)],ocl_type.Boolean)
|
||||
[(literal_b,Rep_OclType.Integer)],Rep_OclType.Boolean)
|
||||
val equal =
|
||||
ocl_term.OperationCall (attribute_size,ocl_type.Integer,
|
||||
Rep_OclTerm.OperationCall (attribute_size,Rep_OclType.Integer,
|
||||
["oclLib","OclAny","="],
|
||||
[(literal_a,ocl_type.Integer)],ocl_type.Boolean)
|
||||
[(literal_a,Rep_OclType.Integer)],Rep_OclType.Boolean)
|
||||
in
|
||||
if a = b then equal
|
||||
else if b = ~1 then lower_bound
|
||||
else ocl_term.OperationCall (lower_bound,ocl_type.Boolean,
|
||||
else Rep_OclTerm.OperationCall (lower_bound,Rep_OclType.Boolean,
|
||||
["oclLib","Boolean","and"],
|
||||
[(upper_bound,ocl_type.Boolean)],
|
||||
ocl_type.Boolean)
|
||||
[(upper_bound,Rep_OclType.Boolean)],
|
||||
Rep_OclType.Boolean)
|
||||
end
|
||||
|
||||
(* calculate the invariants of an association end: *)
|
||||
|
@ -132,11 +132,11 @@ fun assoc_to_inv cls_name (aend:associationend) =
|
|||
val range_constraints = map (range_to_inv cls_name aend)
|
||||
(#multiplicity aend)
|
||||
fun ocl_or (x,y) =
|
||||
ocl_term.OperationCall (x,ocl_type.Boolean,
|
||||
Rep_OclTerm.OperationCall (x,Rep_OclType.Boolean,
|
||||
["oclLib","Boolean","or"],
|
||||
[(y,ocl_type.Boolean)],ocl_type.Boolean)
|
||||
[(y,Rep_OclType.Boolean)],Rep_OclType.Boolean)
|
||||
in if range_constraints = []
|
||||
then (SOME inv_name, ocl_term.Literal ("true",ocl_type.Boolean))
|
||||
then (SOME inv_name, Rep_OclTerm.Literal ("true",Rep_OclType.Boolean))
|
||||
else (SOME inv_name, foldr1 ocl_or range_constraints)
|
||||
end
|
||||
|
||||
|
@ -176,7 +176,7 @@ val OclAnyC = Class{name=["OclAny"],parent=NONE,attributes=[],
|
|||
activity_graphs=nil}
|
||||
|
||||
|
||||
fun string_of_path (path:ocl_type.Path) = case path of
|
||||
fun string_of_path (path:Rep_OclType.Path) = case path of
|
||||
[] => ""
|
||||
| p => foldr1 (fn (a,b) => a^"."^b) p
|
||||
|
||||
|
@ -299,27 +299,27 @@ fun p_invariant_of (Class{invariant,...}) = invariant
|
|||
| p_invariant_of (Primitive{invariant,...}) = invariant
|
||||
|
||||
fun invariant_of C = case p_invariant_of C of
|
||||
[] => [(NONE, ocl_term.Literal ("true",ocl_type.Boolean))]
|
||||
[] => [(NONE, Rep_OclTerm.Literal ("true",Rep_OclType.Boolean))]
|
||||
| il => il
|
||||
|
||||
|
||||
fun precondition_of_op ({precondition,...}:operation) = case precondition of
|
||||
[] => [(NONE, ocl_term.Literal ("true",ocl_type.Boolean))]
|
||||
[] => [(NONE, Rep_OclTerm.Literal ("true",Rep_OclType.Boolean))]
|
||||
| il => il
|
||||
|
||||
|
||||
fun postcondition_of_op ({postcondition, ...}:operation) = case postcondition of
|
||||
[] => [(NONE, ocl_term.Literal ("true",ocl_type.Boolean))]
|
||||
[] => [(NONE, Rep_OclTerm.Literal ("true",Rep_OclType.Boolean))]
|
||||
| il => il
|
||||
|
||||
fun name_of_op ({name,...}:operation) = name
|
||||
|
||||
fun mangled_name_of_op ({name,arguments,result,...}:operation) =
|
||||
let
|
||||
val arg_typestrs = map (fn a => (ocl_type.string_of_OclType o snd ) a ) arguments
|
||||
val arg_typestrs = map (fn a => (Rep_OclType.string_of_OclType o snd ) a ) arguments
|
||||
in
|
||||
foldr1 (fn (a,b) =>(a^"_"^b))
|
||||
((name::arg_typestrs)@[ocl_type.string_of_OclType result])
|
||||
((name::arg_typestrs)@[Rep_OclType.string_of_OclType result])
|
||||
end
|
||||
|
||||
fun result_of_op ({result,...}:operation) = result
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
******************************************************************************)
|
||||
|
||||
signature OCL_TYPE =
|
||||
signature REP_OCL_TYPE =
|
||||
sig
|
||||
|
||||
type Path = string list
|
||||
|
@ -38,9 +38,9 @@ sig
|
|||
end
|
||||
|
||||
|
||||
signature OCL_TERM =
|
||||
signature REP_OCL_TERM =
|
||||
sig
|
||||
include OCL_TYPE
|
||||
include REP_OCL_TYPE
|
||||
|
||||
datatype OclTerm =
|
||||
Literal of string * OclType
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
******************************************************************************)
|
||||
|
||||
structure ocl_type : OCL_TYPE =
|
||||
structure Rep_OclType : REP_OCL_TYPE =
|
||||
struct
|
||||
|
||||
type Path = string list
|
||||
|
@ -56,9 +56,9 @@ fun string_of_OclType Integer = "Integer"
|
|||
end
|
||||
|
||||
|
||||
structure ocl_term : OCL_TERM =
|
||||
structure Rep_OclTerm : REP_OCL_TERM =
|
||||
struct
|
||||
open ocl_type
|
||||
open Rep_OclType
|
||||
|
||||
datatype OclTerm =
|
||||
Literal of string * OclType
|
||||
|
|
|
@ -41,9 +41,9 @@ datatype Action = create
|
|||
datatype StateMachine = SM_mk of {top : StateVertex_Id,
|
||||
transition : Transition_Id list}
|
||||
|
||||
datatype Guard = G_mk of {expression : ocl_term.OclTerm}
|
||||
datatype Guard = G_mk of {expression : Rep_OclTerm.OclTerm}
|
||||
|
||||
type Parameter = ocl_type.OclType
|
||||
type Parameter = Rep_OclType.OclType
|
||||
|
||||
datatype Event = SignalEvent of Parameter list
|
||||
| CallEvent of Parameter list
|
||||
|
@ -86,7 +86,7 @@ datatype StateVertex =
|
|||
| SimpleState_ObjectflowState (* from ActivityGraphs *)
|
||||
of {isSynch : bool,
|
||||
parameter : Parameter list,
|
||||
types : ocl_type.Path list (* Classifier_Id *)}
|
||||
types : Rep_OclType.Path list (* Classifier_Id *)}
|
||||
| State_FinalState
|
||||
of {outgoing : Transition_Id list,
|
||||
incoming : Transition_Id list,
|
||||
|
|
|
@ -41,9 +41,9 @@ datatype Action = create
|
|||
datatype StateMachine = SM_mk of {top : StateVertex_Id,
|
||||
transition : Transition_Id list}
|
||||
|
||||
datatype Guard = G_mk of {expression : ocl_term.OclTerm}
|
||||
datatype Guard = G_mk of {expression : Rep_OclTerm.OclTerm}
|
||||
|
||||
type Parameter = ocl_type.OclType
|
||||
type Parameter = Rep_OclType.OclType
|
||||
|
||||
datatype Event = SignalEvent of Parameter list
|
||||
| CallEvent of Parameter list
|
||||
|
@ -86,7 +86,7 @@ datatype StateVertex =
|
|||
| SimpleState_ObjectflowState (* from ActivityGraphs *)
|
||||
of {isSynch : bool,
|
||||
parameter : Parameter list,
|
||||
types : ocl_type.Path list (* Classifier_Id *)}
|
||||
types : Rep_OclType.Path list (* Classifier_Id *)}
|
||||
| State_FinalState
|
||||
of {outgoing : Transition_Id list,
|
||||
incoming : Transition_Id list,
|
||||
|
|
|
@ -35,16 +35,16 @@ struct
|
|||
exception IllFormed of string
|
||||
exception NotYetImplemented
|
||||
|
||||
datatype HashTableEntry = Package of ocl_type.Path
|
||||
| Type of (ocl_type.OclType *
|
||||
datatype HashTableEntry = Package of Rep_OclType.Path
|
||||
| Type of (Rep_OclType.OclType *
|
||||
(XMI.AssociationEnd list))
|
||||
| Generalization of (string * string)
|
||||
| Constraint of XMI.Constraint
|
||||
| Stereotype of string
|
||||
| Variable of XMI.VariableDeclaration
|
||||
| Attribute of ocl_type.Path
|
||||
| Operation of ocl_type.Path
|
||||
| AssociationEnd of ocl_type.Path
|
||||
| Attribute of Rep_OclType.Path
|
||||
| Operation of Rep_OclType.Path
|
||||
| AssociationEnd of Rep_OclType.Path
|
||||
|
||||
fun find_generalization t xmiid =
|
||||
(case valOf (HashTable.find t xmiid)
|
||||
|
@ -96,7 +96,7 @@ fun find_package t xmiid =
|
|||
| _ => raise Option)
|
||||
handle Option => raise IllFormed ("expected Path "^xmiid^" in table")
|
||||
|
||||
fun path_of_classifier (ocl_type.Classifier x) = x
|
||||
fun path_of_classifier (Rep_OclType.Classifier x) = x
|
||||
|
||||
fun find_constraint t xmiid =
|
||||
(case valOf (HashTable.find t xmiid)
|
||||
|
@ -133,19 +133,19 @@ fun find_classifier_type t xmiid
|
|||
= let val ocltype = case valOf (HashTable.find t xmiid) of (Type (x,xs)) => x
|
||||
| _ => raise Option
|
||||
in
|
||||
case ocltype of ocl_type.Integer => ocltype
|
||||
| ocl_type.String => ocltype
|
||||
| ocl_type.Real => ocltype
|
||||
| ocl_type.Boolean => ocltype
|
||||
| ocl_type.Classifier x => ocltype
|
||||
| ocl_type.OclVoid => ocltype
|
||||
| ocl_type.OclAny => ocltype
|
||||
| ocl_type.DummyT => ocltype
|
||||
| ocl_type.Collection (ocl_type.Classifier [x]) => ocl_type.Collection (find_classifier_type t x)
|
||||
| ocl_type.Sequence (ocl_type.Classifier [x]) => ocl_type.Sequence (find_classifier_type t x)
|
||||
| ocl_type.Set (ocl_type.Classifier [x]) => ocl_type.Set (find_classifier_type t x)
|
||||
| ocl_type.Bag (ocl_type.Classifier [x]) => ocl_type.Bag (find_classifier_type t x)
|
||||
| ocl_type.OrderedSet (ocl_type.Classifier [x]) => ocl_type.OrderedSet (find_classifier_type t x)
|
||||
case ocltype of Rep_OclType.Integer => ocltype
|
||||
| Rep_OclType.String => ocltype
|
||||
| Rep_OclType.Real => ocltype
|
||||
| Rep_OclType.Boolean => ocltype
|
||||
| Rep_OclType.Classifier x => ocltype
|
||||
| Rep_OclType.OclVoid => ocltype
|
||||
| Rep_OclType.OclAny => ocltype
|
||||
| Rep_OclType.DummyT => ocltype
|
||||
| Rep_OclType.Collection (Rep_OclType.Classifier [x]) => Rep_OclType.Collection (find_classifier_type t x)
|
||||
| Rep_OclType.Sequence (Rep_OclType.Classifier [x]) => Rep_OclType.Sequence (find_classifier_type t x)
|
||||
| Rep_OclType.Set (Rep_OclType.Classifier [x]) => Rep_OclType.Set (find_classifier_type t x)
|
||||
| Rep_OclType.Bag (Rep_OclType.Classifier [x]) => Rep_OclType.Bag (find_classifier_type t x)
|
||||
| Rep_OclType.OrderedSet (Rep_OclType.Classifier [x]) => Rep_OclType.OrderedSet (find_classifier_type t x)
|
||||
| _ => raise Option
|
||||
end
|
||||
handle Option => raise IllFormed ("expected Classifier "^xmiid^" in table")
|
||||
|
@ -178,20 +178,20 @@ fun insert_classifier table package_prefix class =
|
|||
val path = package_prefix @ [name]
|
||||
val ocltype = if (package_prefix = ["oclLib"]
|
||||
orelse package_prefix = ["UML_OCL"])
|
||||
then if name = "Integer" then ocl_type.Integer
|
||||
else if name = "Boolean" then ocl_type.Boolean
|
||||
else if name = "String" then ocl_type.String
|
||||
else if name = "Real" then ocl_type.Real
|
||||
else if name = "OclVoid" then ocl_type.OclVoid
|
||||
else if name = "OclAny" then ocl_type.OclAny
|
||||
then if name = "Integer" then Rep_OclType.Integer
|
||||
else if name = "Boolean" then Rep_OclType.Boolean
|
||||
else if name = "String" then Rep_OclType.String
|
||||
else if name = "Real" then Rep_OclType.Real
|
||||
else if name = "OclVoid" then Rep_OclType.OclVoid
|
||||
else if name = "OclAny" then Rep_OclType.OclAny
|
||||
(* now this is really ugly... *)
|
||||
else if String.isPrefix "Collection(" name then ocl_type.Collection (ocl_type.Classifier [XMI.classifier_elementtype_of class])
|
||||
else if String.isPrefix "Sequence(" name then ocl_type.Sequence (ocl_type.Classifier [XMI.classifier_elementtype_of class])
|
||||
else if String.isPrefix "Set(" name then ocl_type.Set (ocl_type.Classifier [XMI.classifier_elementtype_of class])
|
||||
else if String.isPrefix "Bag(" name then ocl_type.Bag (ocl_type.Classifier [XMI.classifier_elementtype_of class])
|
||||
else if String.isPrefix "OrderedSet(" name then ocl_type.OrderedSet (ocl_type.Classifier [XMI.classifier_elementtype_of class])
|
||||
else if String.isPrefix "Collection(" name then Rep_OclType.Collection (Rep_OclType.Classifier [XMI.classifier_elementtype_of class])
|
||||
else if String.isPrefix "Sequence(" name then Rep_OclType.Sequence (Rep_OclType.Classifier [XMI.classifier_elementtype_of class])
|
||||
else if String.isPrefix "Set(" name then Rep_OclType.Set (Rep_OclType.Classifier [XMI.classifier_elementtype_of class])
|
||||
else if String.isPrefix "Bag(" name then Rep_OclType.Bag (Rep_OclType.Classifier [XMI.classifier_elementtype_of class])
|
||||
else if String.isPrefix "OrderedSet(" name then Rep_OclType.OrderedSet (Rep_OclType.Classifier [XMI.classifier_elementtype_of class])
|
||||
else raise IllFormed ("didn't recognize ocltype "^name)
|
||||
else ocl_type.Classifier path
|
||||
else Rep_OclType.Classifier path
|
||||
(* This function is called before the associations are handled, *)
|
||||
(* so we do not have to take care of them now... *)
|
||||
val aends = nil
|
||||
|
@ -212,13 +212,13 @@ fun insert_classifier table package_prefix class =
|
|||
end
|
||||
|
||||
|
||||
val triv_expr = ocl_term.Literal ("true",ocl_type.Boolean)
|
||||
val triv_expr = Rep_OclTerm.Literal ("true",Rep_OclType.Boolean)
|
||||
|
||||
fun transform_expression t (XMI.LiteralExp {symbol,expression_type}) =
|
||||
ocl_term.Literal (symbol,find_classifier_type t expression_type)
|
||||
Rep_OclTerm.Literal (symbol,find_classifier_type t expression_type)
|
||||
| transform_expression t (XMI.IfExp {condition,thenExpression,
|
||||
elseExpression,expression_type}) =
|
||||
ocl_term.If (transform_expression t condition,
|
||||
Rep_OclTerm.If (transform_expression t condition,
|
||||
find_classifier_type t (XMI.expression_type_of condition),
|
||||
transform_expression t thenExpression,
|
||||
find_classifier_type t (XMI.expression_type_of thenExpression),
|
||||
|
@ -227,7 +227,7 @@ fun transform_expression t (XMI.LiteralExp {symbol,expression_type}) =
|
|||
find_classifier_type t expression_type)
|
||||
| transform_expression t (XMI.AttributeCallExp {source,referredAttribute,
|
||||
expression_type}) =
|
||||
ocl_term.AttributeCall (transform_expression t source,
|
||||
Rep_OclTerm.AttributeCall (transform_expression t source,
|
||||
find_classifier_type t (XMI.expression_type_of source),
|
||||
find_attribute t referredAttribute,
|
||||
find_classifier_type t expression_type)
|
||||
|
@ -237,7 +237,7 @@ fun transform_expression t (XMI.LiteralExp {symbol,expression_type}) =
|
|||
let val arglist = map (transform_expression t) arguments
|
||||
val argtyplist = map ((find_classifier_type t) o XMI.expression_type_of) arguments
|
||||
in
|
||||
ocl_term.OperationCall (transform_expression t source,
|
||||
Rep_OclTerm.OperationCall (transform_expression t source,
|
||||
find_classifier_type t (XMI.expression_type_of source),
|
||||
find_operation t referredOperation,
|
||||
ListPair.zip (arglist, argtyplist),
|
||||
|
@ -246,7 +246,7 @@ fun transform_expression t (XMI.LiteralExp {symbol,expression_type}) =
|
|||
| transform_expression t (XMI.OperationWithTypeArgExp {source,name,
|
||||
typeArgument,
|
||||
expression_type}) =
|
||||
ocl_term.OperationWithType (transform_expression t source,
|
||||
Rep_OclTerm.OperationWithType (transform_expression t source,
|
||||
find_classifier_type t (XMI.expression_type_of source),
|
||||
name,
|
||||
find_classifier_type t typeArgument,
|
||||
|
@ -254,16 +254,16 @@ fun transform_expression t (XMI.LiteralExp {symbol,expression_type}) =
|
|||
| transform_expression t (XMI.VariableExp {referredVariable,expression_type})=
|
||||
let val var_dec = find_variable_dec t referredVariable
|
||||
in
|
||||
ocl_term.Variable (#name var_dec,find_classifier_type t expression_type)
|
||||
Rep_OclTerm.Variable (#name var_dec,find_classifier_type t expression_type)
|
||||
end
|
||||
| transform_expression t (XMI.AssociationEndCallExp {source, referredAssociationEnd, expression_type}) =
|
||||
ocl_term.AssociationEndCall (transform_expression t source,
|
||||
Rep_OclTerm.AssociationEndCall (transform_expression t source,
|
||||
find_classifier_type t (XMI.expression_type_of source),
|
||||
find_associationend t referredAssociationEnd,
|
||||
find_classifier_type t expression_type
|
||||
)
|
||||
| transform_expression t (XMI.IteratorExp {name,iterators,body,source,expression_type}) =
|
||||
ocl_term.Iterator (name,
|
||||
Rep_OclTerm.Iterator (name,
|
||||
map (fn x => (#name x, find_classifier_type t (#declaration_type x))) iterators,
|
||||
transform_expression t source, find_classifier_type t (XMI.expression_type_of source),
|
||||
transform_expression t body, find_classifier_type t (XMI.expression_type_of body),
|
||||
|
@ -306,8 +306,8 @@ fun transform_attribute t ({xmiid,name,type_id,changeability,visibility,
|
|||
in
|
||||
(name,if multiplicity = [(1,1)]
|
||||
then cls_type
|
||||
else if ordering = XMI.Ordered then ocl_type.Sequence cls_type
|
||||
else ocl_type.Set cls_type)
|
||||
else if ordering = XMI.Ordered then Rep_OclType.Sequence cls_type
|
||||
else Rep_OclType.Set cls_type)
|
||||
end
|
||||
|
||||
fun transform_aend t ({xmiid,name,ordering,multiplicity,participant_id,
|
||||
|
@ -324,7 +324,7 @@ fun transform_classifier t (XMI.Class {xmiid,name,isActive,visibility,isLeaf,
|
|||
invariant}) =
|
||||
let val parents = map ((find_classifier_type t) o (find_parent t))
|
||||
generalizations
|
||||
val filtered_parents = filter (fn x => x <> ocl_type.OclAny) parents
|
||||
val filtered_parents = filter (fn x => x <> Rep_OclType.OclAny) parents
|
||||
in
|
||||
Rep.Class {name = path_of_classifier (find_classifier_type t xmiid),
|
||||
parent = case filtered_parents
|
||||
|
@ -343,7 +343,7 @@ fun transform_classifier t (XMI.Class {xmiid,name,isActive,visibility,isLeaf,
|
|||
end
|
||||
| transform_classifier t (XMI.Primitive {xmiid,name,generalizations,
|
||||
operations,invariant}) =
|
||||
Rep.Primitive {name = case find_classifier_type t xmiid of ocl_type.Classifier x => x
|
||||
Rep.Primitive {name = case find_classifier_type t xmiid of Rep_OclType.Classifier x => x
|
||||
| _ => raise Option,
|
||||
parent = NONE, (* FIX *)
|
||||
operations = map (transform_operation t) operations,
|
||||
|
@ -356,7 +356,7 @@ fun transform_classifier t (XMI.Class {xmiid,name,isActive,visibility,isLeaf,
|
|||
thyname = NONE}
|
||||
| transform_classifier t (XMI.Enumeration {xmiid,name,generalizations,
|
||||
operations,literals,invariant}) =
|
||||
Rep.Enumeration {name = case find_classifier_type t xmiid of ocl_type.Classifier x => x
|
||||
Rep.Enumeration {name = case find_classifier_type t xmiid of Rep_OclType.Classifier x => x
|
||||
| _ => raise Option,
|
||||
parent = NONE, (* FIX *)
|
||||
literals = literals,
|
||||
|
@ -426,7 +426,7 @@ fun transform_assocation t (assoc:XMI.Association) =
|
|||
fun add_aend_to_type (id,ae) =
|
||||
let val type_of_id = find_classifier_type t id
|
||||
val aends_of_id = ae::(find_aends t id)
|
||||
val path_of_id = case type_of_id of ocl_type.Classifier x => x
|
||||
val path_of_id = case type_of_id of Rep_OclType.Classifier x => x
|
||||
val path_of_ae = path_of_id @ [#name ae]
|
||||
in
|
||||
(HashTable.insert t (id,Type (type_of_id,aends_of_id));
|
||||
|
@ -457,7 +457,7 @@ fun transformXMI ({classifiers,constraints,packages,
|
|||
let val (xmiid_table: (string,HashTableEntry) HashTable.hash_table) =
|
||||
HashTable.mkTable (HashString.hashString, (op =)) (101, Option)
|
||||
(* hack: insert a dummy type into the table *)
|
||||
val _ = HashTable.insert xmiid_table ("DummyT",Type (ocl_type.DummyT,nil))
|
||||
val _ = HashTable.insert xmiid_table ("DummyT",Type (Rep_OclType.DummyT,nil))
|
||||
(* for some reasons, there are model elements outside of the top-level *)
|
||||
(* model the xmi-file. So we have to handle them here seperately: *)
|
||||
val _ = map (insert_classifier xmiid_table nil) classifiers
|
||||
|
|
Loading…
Reference in New Issue