Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMT (Generative Modeling Technologies) » [EVL] Printing collections
[EVL] Printing collections [message #383062] Tue, 29 April 2008 14:19 Go to next message
Andrew Lawson is currently offline Andrew LawsonFriend
Messages: 12
Registered: July 2009
Junior Member
I'm having trouble comparing two collections.

I create the collections by following a reference from the start entity (in
this case named parent) and then following a link named operations and then
collecting together all of the name attributes of the classes.

Is there anyway to print the collections in EVL so that I can see what
collections are being compared?

self.parent.operations->collect(s| s.name)



The relevant parts of the metamodel are:

class Entity {

attr String classname;

attr String instancename;

attr Boolean Child;

val Attribute[+] attribute;

val Operation[*] operations;

val EntityReference[+] reference;

ref Entity[0..1] parent;

}





class Operation{



attr String name;

val Type[*] arguments;

}
Re: [Epsilon][EVL] Printing collections [message #383064 is a reply to message #383062] Tue, 29 April 2008 14:28 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi Andrew,

You can print a Collection as a string using the
concat(delimiter:String) operation. E.g.

Sequence{1, 'Apple', 2}.concat(':').println() prints 1:Apple:2

Cheers,
Dimitrios

Andrew Lawson wrote:
> I'm having trouble comparing two collections.
>
> I create the collections by following a reference from the start entity (in
> this case named parent) and then following a link named operations and then
> collecting together all of the name attributes of the classes.
>
> Is there anyway to print the collections in EVL so that I can see what
> collections are being compared?
>
> self.parent.operations->collect(s| s.name)
>
>
>
> The relevant parts of the metamodel are:
>
> class Entity {
>
> attr String classname;
>
> attr String instancename;
>
> attr Boolean Child;
>
> val Attribute[+] attribute;
>
> val Operation[*] operations;
>
> val EntityReference[+] reference;
>
> ref Entity[0..1] parent;
>
> }
>
>
>
>
>
> class Operation{
>
>
>
> attr String name;
>
> val Type[*] arguments;
>
> }
>
>
>
>
>
>
Re: [Epsilon][EVL] Printing collections [message #615802 is a reply to message #383062] Tue, 29 April 2008 14:28 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi Andrew,

You can print a Collection as a string using the
concat(delimiter:String) operation. E.g.

Sequence{1, 'Apple', 2}.concat(':').println() prints 1:Apple:2

Cheers,
Dimitrios

Andrew Lawson wrote:
> I'm having trouble comparing two collections.
>
> I create the collections by following a reference from the start entity (in
> this case named parent) and then following a link named operations and then
> collecting together all of the name attributes of the classes.
>
> Is there anyway to print the collections in EVL so that I can see what
> collections are being compared?
>
> self.parent.operations->collect(s| s.name)
>
>
>
> The relevant parts of the metamodel are:
>
> class Entity {
>
> attr String classname;
>
> attr String instancename;
>
> attr Boolean Child;
>
> val Attribute[+] attribute;
>
> val Operation[*] operations;
>
> val EntityReference[+] reference;
>
> ref Entity[0..1] parent;
>
> }
>
>
>
>
>
> class Operation{
>
>
>
> attr String name;
>
> val Type[*] arguments;
>
> }
>
>
>
>
>
>
Previous Topic:[EVL] Printing collections
Next Topic:[EVL] Possible Bug with collection comparison
Goto Forum:
  


Current Time: Tue Nov 25 23:48:49 GMT 2014

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

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