Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » def initialized with alternatives (or)
def initialized with alternatives (or) [message #987183] Sat, 24 November 2012 03:43 Go to next message
Andrea Sindico is currently offline Andrea Sindico
Messages: 266
Registered: November 2010
Senior Member

I need to define a def: which depends on two different alternatives in or.
Precisely I am validating a DSL and I need to retrieve the type of a variable. This depends on the where the variable was defined. It may be for instance a parameter of a method, a property of a class, a local variable. Then I thought to create a def, typed as ocl::OclElement, in the context of the Variable meta-class initialized by these three different possibilities in or. Am I doing the right thing?


Follow me on Twitter @andreasindico

Re: def initialized with alternatives (or) [message #987190 is a reply to message #987183] Sat, 24 November 2012 05:28 Go to previous messageGo to next message
Andrea Sindico is currently offline Andrea Sindico
Messages: 266
Registered: November 2010
Senior Member

A better solution may be defining a set but It seems I am making some syntactical error.
I am doing something like

def: type: Set = {variable.<the first possible element>, variable.<the second possible element>}

or

def: type: Set{} = {variable.<the first possible element>, variable.<the second possible element>}

but in both the cases I get an error.

Also as the two elements of the set are mutually exclusive would this solution be feasible?


Follow me on Twitter @andreasindico

Re: def initialized with alternatives (or) [message #987193 is a reply to message #987190] Sat, 24 November 2012 05:57 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 3844
Registered: July 2009
Senior Member
Hi

You don't explain your problem clearly enough for me to understand "in
or" is not English.

You don't identify what errors you give or provide sufficient context to
reproduce the error.

A zipped project demonstrating your best attempt is nearly always a good
way to avoid wasting my time (and yours).

Regards

Ed Willink


On 24/11/2012 10:28, Andrea Sindico wrote:
> A better solution may be defining a set but It seems I am making some
> syntactical error.
> I am doing something like
>
> def: type: Set = {variable.<the first possible element>, variable.<the
> second possible element>}
>
> or
> def: type: Set{} = {variable.<the first possible element>,
> variable.<the second possible element>}
>
> but in both the cases I get an error.
>
> Also as the two elements of the set are mutually exclusive would this
> solution be feasible?
Re: def initialized with alternatives (or) [message #987207 is a reply to message #987183] Sat, 24 November 2012 08:30 Go to previous message
Andrea Sindico is currently offline Andrea Sindico
Messages: 266
Registered: November 2010
Senior Member

the right form is

def: type: Set = Set{<first element>, <second element>}


Follow me on Twitter @andreasindico

Previous Topic:Custom OCL error messages
Next Topic:how to merge two collections
Goto Forum:
  


Current Time: Fri Apr 18 17:03:57 EDT 2014

Powered by FUDForum. Page generated in 0.01618 seconds