QVTO iteration() operation, acc returns nothing [message #690952] |
Thu, 30 June 2011 09:09  |
Eclipse User |
|
|
|
Hi,
in the specification 2.0 i red that acc is the accumulation object and returns the things you want, so i tried one example but nothing happened. The aim is to iterate over two lists and save duplicat values in a third list.
var str : List(String) := List{"A","B","C"};
var st : List(String) := List{"A","B","D"};
var temp : Sequence(String) := Sequence{};
str -> forEach(i){
temp = st -> iterate(it : String;
acc : Sequence(String) = Sequence{"Z"} |
if(i.equalsIgnoreCase(it))then {
acc += it; //acc gives nothing back
acc -> including(it); // its empty
//temp += it; //only direkt access works
}endif );
};
Additional Question: could i use QVT List type in javaBlackboxLibrary directly or only OCL Types?
Thank you.
|
|
|
Re: QVTO iteration() operation, acc returns nothing [message #690962 is a reply to message #690952] |
Thu, 30 June 2011 09:21  |
Eclipse User |
|
|
|
Hi
Your example is a very uncomfortable mix of OCL and QVT. I would be
surprised if it is valid. I recommend pure OCL for OCL constructs e.g.
.... iterate(it : String; acc : Sequence(String) = Sequence{"Z"} | if
i.equalsIgnoreCase(it)) then acc->including(it) else acc endif) ...
Regards
Ed Willink
>
> in the specification 2.0 i red that acc is the accumulation object and
> returns the things you want, so i tried one example but nothing
> happened. The aim is to iterate over two lists and save duplicat
> values in a third list.
>
> var str : List(String) := List{"A","B","C"};
> var st : List(String) := List{"A","B","D"};
> var temp : Sequence(String) := Sequence{};
>
> str -> forEach(i){
> temp = st -> iterate(it : String;
> acc : Sequence(String) = Sequence{"Z"} |
> if(i.equalsIgnoreCase(it))then {
> acc += it; //acc gives nothing back
> acc -> including(it); // its empty
> //temp += it; //only direkt access works
> }endif );
> };
>
> Additional Question: could i use QVT List type in javaBlackboxLibrary
> directly or only OCL Types?
>
> Thank you.
|
|
|
Powered by
FUDForum. Page generated in 0.06166 seconds