Changed handling of association ends with multiplicity (0,1) or (1,1). Instead
of generating attributes of type Set (or Sequence) we generate non-collection typed attributes. In the case of multiplicty (0,0) no invariant is generated, in the case of (1,1) the invariant "assocEnd->OclIsDefined()" is generated. git-svn-id: https://projects.brucker.ch/su4sml/svn/infsec-import/trunk/src/su4sml@3251 3260e6d1-4efc-4170-b0a7-36055960796d
This commit is contained in:
parent
0f1b8df03d
commit
f27239f22a
|
@ -88,7 +88,10 @@ datatype Classifier =
|
||||||
|
|
||||||
(* convert an association end into the corresponding collection type *)
|
(* convert an association end into the corresponding collection type *)
|
||||||
fun assoc_to_attr_type {name,aend_type,multiplicity,ordered,visibility} =
|
fun assoc_to_attr_type {name,aend_type,multiplicity,ordered,visibility} =
|
||||||
if ordered then Rep_OclType.Sequence aend_type (* OrderedSet? *)
|
case multiplicity of
|
||||||
|
[(0,1)] => aend_type
|
||||||
|
| [(1,1)] => aend_type
|
||||||
|
| _ =>if ordered then Rep_OclType.Sequence aend_type (* OrderedSet? *)
|
||||||
else Rep_OclType.Set aend_type
|
else Rep_OclType.Set aend_type
|
||||||
|
|
||||||
(* convert an association end into an attribute of the *)
|
(* convert an association end into an attribute of the *)
|
||||||
|
@ -140,7 +143,20 @@ fun range_to_inv cls_name aend (a,b) =
|
||||||
(* FIXME: 2. is not implemented yet... *)
|
(* FIXME: 2. is not implemented yet... *)
|
||||||
fun assoc_to_inv cls_name (aend:associationend) =
|
fun assoc_to_inv cls_name (aend:associationend) =
|
||||||
let val inv_name = "multiplicity_constraint_for_association_end_"^(#name aend)
|
let val inv_name = "multiplicity_constraint_for_association_end_"^(#name aend)
|
||||||
val range_constraints = map (range_to_inv cls_name aend)
|
val range_constraints = case (#multiplicity aend) of
|
||||||
|
[(0,1)] => let
|
||||||
|
val attr_name = cls_name@[#name aend]
|
||||||
|
val attr_type = assoc_to_attr_type aend
|
||||||
|
val cls = Rep_OclType.Classifier cls_name
|
||||||
|
val self = Rep_OclTerm.Variable ("self",cls)
|
||||||
|
val attribute = Rep_OclTerm.AttributeCall (self,cls,attr_name,attr_type)
|
||||||
|
in
|
||||||
|
[Rep_OclTerm.OperationCall (attribute,attr_type,
|
||||||
|
["oclIsDefined"],[],
|
||||||
|
Rep_OclType.Boolean)]
|
||||||
|
end
|
||||||
|
| [(1,1)] => [] (* FIXME: should be aend->OclIsDefined() *)
|
||||||
|
| _ => map (range_to_inv cls_name aend)
|
||||||
(#multiplicity aend)
|
(#multiplicity aend)
|
||||||
fun ocl_or (x,y) =
|
fun ocl_or (x,y) =
|
||||||
Rep_OclTerm.OperationCall (x,Rep_OclType.Boolean,
|
Rep_OclTerm.OperationCall (x,Rep_OclType.Boolean,
|
||||||
|
|
Loading…
Reference in New Issue