Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Switch-case Return
Switch-case Return [message #633359] Sat, 16 October 2010 20:19 Go to next message
Henning is currently offline HenningFriend
Messages: 32
Registered: October 2010
Member
Hi!

I was wondering if the following behavior of switch-case works as intended:
rule switchexample
	transform d : Source!Domain
	to d : Target!Domain{

	callSomeOperation().println();		
}
operation callSomeOperation() : String{
	var choice = "choice_1";
	
	switch (choice){
		case "choice_1":
			"choice detected".println(); 
			return "first choice chosen!";
	}
	return "nothing chosen";
}


Output:

Buildfile: /Users/henning/Documents/workspaces/diplom/my.example/launch .xml

loadModels:

main:
[epsilon.etl - switchexample.etl] choice detected
[epsilon.etl - switchexample.etl] nothing chosen
BUILD SUCCESSFUL
Total time: 290 milliseconds

I would have expected to get only "choice detected". What do I have to do to return the value immediately from the case-statement?
Re: Switch-case Return [message #633385 is a reply to message #633359] Sun, 17 October 2010 09:53 Go to previous messageGo to next message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi Henning,

Unfortunately this is a bug. Could you please file a bug report while
I'm preparing an interim release that fixes this?

Cheers,
Dimitris

Henning wrote:
> Hi!
>
> I was wondering if the following behavior of switch-case works as intended:
> rule switchexample
> transform d : Source!Domain
> to d : Target!Domain{
>
> callSomeOperation().println();
> }
> operation callSomeOperation() : String{
> var choice = "choice_1";
>
> switch (choice){
> case "choice_1":
> "choice detected".println(); return "first
> choice chosen!";
> }
> return "nothing chosen";
> }
>
> Output:
>
> Buildfile: /Users/henning/Documents/workspaces/diplom/my.example/launch
> .xml
>
> loadModels:
>
> main:
> [epsilon.etl - switchexample.etl] choice detected
> [epsilon.etl - switchexample.etl] nothing chosen
> BUILD SUCCESSFUL
> Total time: 290 milliseconds
>
> I would have expected to get only "choice detected". What do I have to
> do to return the value immediately from the case-statement?
Re: Switch-case Return [message #633388 is a reply to message #633385] Sun, 17 October 2010 10:30 Go to previous messageGo to next message
Henning is currently offline HenningFriend
Messages: 32
Registered: October 2010
Member
Hi,

I reported bug 327989 for this matter.

Henning
Re: Switch-case Return [message #633390 is a reply to message #633385] Sun, 17 October 2010 10:31 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi Henning,

Many thanks! The new interim release that fixes this is available here:

http://download.eclipse.org/modeling/gmt/epsilon/interim/

Cheers,
Dimitris

Dimitris Kolovos wrote:
> Hi Henning,
>
> Unfortunately this is a bug. Could you please file a bug report while
> I'm preparing an interim release that fixes this?
>
> Cheers,
> Dimitris
>
> Henning wrote:
>> Hi!
>>
>> I was wondering if the following behavior of switch-case works as
>> intended:
>> rule switchexample
>> transform d : Source!Domain
>> to d : Target!Domain{
>>
>> callSomeOperation().println(); }
>> operation callSomeOperation() : String{
>> var choice = "choice_1";
>> switch (choice){
>> case "choice_1":
>> "choice detected".println(); return "first
>> choice chosen!";
>> }
>> return "nothing chosen";
>> }
>>
>> Output:
>>
>> Buildfile:
>> /Users/henning/Documents/workspaces/diplom/my.example/launch .xml
>>
>> loadModels:
>>
>> main:
>> [epsilon.etl - switchexample.etl] choice detected
>> [epsilon.etl - switchexample.etl] nothing chosen
>> BUILD SUCCESSFUL
>> Total time: 290 milliseconds
>>
>> I would have expected to get only "choice detected". What do I have to
>> do to return the value immediately from the case-statement?
Previous Topic:[ETL] Accessing packages
Next Topic:onefile="true" doesn't seem to work
Goto Forum:
  


Current Time: Fri Nov 28 22:07:20 GMT 2014

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

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