|
Re: Playing with setContext [message #17119 is a reply to message #17057] |
Thu, 12 April 2007 16:20 |
Eclipse User |
|
|
|
Originally posted by: cdamus.ca.ibm.com
Hi, Youmm,
Using the OCLHelper.setOperationContext(...) method, you specify both the
classifier and operation context of the constraint (note that the
classifier could be one that inherits but does not define the operation).
With the helper, you provide only the constraint expression to the
createPrecondition() method, e.g.:
EClass myEClass;
EOperation myEOperation;
helper.setOperationContext(myEClass, myEOperation);
Constraint ct = helper.createPrecondition("true = true");
ct.setName("cond1");
The OCLHelper is intended primarily for parsing constraints embedded in
models, where normally the constraint text consists of the expression only
(the constraint name and context being provided via separate attributes of
the constraint element).
HTH,
Christian
Youmm P. wrote:
> Hello,
>
> Is it possible to play with setContext / setOperationContext with OCL /
> OCLHelper to parse a string like this
>
> "context myMethod(i : MyObject) : MyObject
> pre
> cond1: true = true
> "
>
> or like this
>
> "context myMethod(i : MyObject) : MyObject
> pre
> true = true
> "
> and setting the good EPackage / EClass for the method ?
>
> It's the same question as yesterday but I don't need the class name in
> the condition (I can infer it with the model).
|
|
|
Powered by
FUDForum. Page generated in 0.03294 seconds