Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Expressions in Raw Text
Expressions in Raw Text [message #3630] Wed, 07 February 2007 11:12 Go to next message
Chris Lenz is currently offline Chris Lenz
Messages: 214
Registered: July 2009
Senior Member
OCLExpression<EClassifier> expr = parseDef(
"package ocltest context Fruit " + //$NON-NLS-1$
"def: bestColor(c : Color) : Color = if self.color = Color::black
then c else self.color endif" + //$NON-NLS-1$
" endpackage"); //$NON-NLS-1$

Constraint constraint = (Constraint) expr.eContainer().eContainer();
assertNotNull(constraint);

assertEquals(UMLReflection.DEFINITION, constraint.getStereotype());

assertSame(color, expr.getType());


I found this in the tests of ocl ecore.

My question, how can I evaluate expressions against this method.
The other methods define the operation via helper.defineOperation, but
how can I make this operation available for the evaluator.

Chris
Re: Expressions in Raw Text [message #3696 is a reply to message #3630] Wed, 07 February 2007 15:07 Go to previous message
Chris Lenz is currently offline Chris Lenz
Messages: 214
Registered: July 2009
Senior Member
ok found it myself parsedef defines it in ocl
Chris
Chris Lenz schrieb:
> OCLExpression<EClassifier> expr = parseDef(
> "package ocltest context Fruit " + //$NON-NLS-1$
> "def: bestColor(c : Color) : Color = if self.color = Color::black
> then c else self.color endif" + //$NON-NLS-1$
> " endpackage"); //$NON-NLS-1$
>
> Constraint constraint = (Constraint) expr.eContainer().eContainer();
> assertNotNull(constraint);
>
> assertEquals(UMLReflection.DEFINITION, constraint.getStereotype());
>
> assertSame(color, expr.getType());
>
>
> I found this in the tests of ocl ecore.
>
> My question, how can I evaluate expressions against this method.
> The other methods define the operation via helper.defineOperation, but
> how can I make this operation available for the evaluator.
>
> Chris
Previous Topic:[Announce] EclipseCon 2007 Registration
Next Topic:[Announce] OCL goes Generic! And OCL goes UML!
Goto Forum:
  


Current Time: Fri Sep 19 21:59:07 GMT 2014

Powered by FUDForum. Page generated in 0.01870 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software