[gme-users] Problem with enum in OCL

Jesper Berthing jbe at cfsi.dk
Wed Aug 23 22:39:13 CDT 2006


Hi Zoli,

I tryed with the "meta::", but it did not work for me. Therefore I have create a new project with two atoms, just like I described below. The project is attached to this email.

So if anybody has the time to try it out and possible find the mistake in the model I would be very happy. ;-)

Below are some of the tests that I have carried out.

My guess is that #Blocking is not "defined" in the constraint in the right way for the expression to be true. If I for example use the expression below the constraint is never violated.

let var:ocl::Enumeration = ocl::Enumeration { #Non Blocking, #Blocking } in
self.connectedFCOs( "dst", meta::Signals )-> forAll( c: meta::Semaphore
| c.semaphoreType = var )

The last thing I tried was to attach a enumattribute to the Event Atom with the enum definition (#No,0 and #Yes, 1) and used the following constraint it is possbile to control when the connection is allowed (if both semaphoreType and eventType is set to the same (Non Blocking and No) and (Blocking and Yes)).

self.connectedFCOs( "dst", meta::Signals )-> forAll( c: meta::Semaphore
| c.semaphoreType = self.eventType )

Of course I could make the enum attribute hidden for the user and set the default value to Yes. but that will not help me in other cases where I need to check for a certain enum value.

I am using the latest version of GME (6.5.8), if this information helps.

regards,
Jesper 

-----Original Message-----
From: gme-users-bounces at list.isis.vanderbilt.edu on behalf of Zoltan Molnar
Sent: Wed 8/23/2006 6:00 PM
To: gme-users
Subject: RE: [gme-users] Problem with enum in OCL
 
For me it works although i used the "meta::" prefix for Signals and
Semaphore like: 
 
self.connectedFCOs( "dst", meta::Signals )-> forAll( c: meta::Semaphore
| c.semaphoreType = #Blocking )
 
Zoli
 

-----Original Message-----
From: gme-users-bounces at list.isis.vanderbilt.edu
[mailto:gme-users-bounces at list.isis.vanderbilt.edu] On Behalf Of Jesper
Berthing
Sent: Tuesday, August 22, 2006 2:56 PM
To: gme-users
Subject: [gme-users] Problem with enum in OCL




Hi there,

I have two FCOs that can be connected via "Signals", the destination FCO
has a enum with the name semaphoreType (Non Blocking = 0, Blocking = 1).
The constraint is used to allow connections when the semaphoreType is
Blocking and not Non Blocking.

Therefore I have made the following constraint, but it keeps returning
false when I create the connection between the two FCOs. Some how the
c.semaphoreType is not equal to #Blocking, how come?

self.connectedFCOs( "dst", Signals )->forAll( c : Semaphore |
c.semaphoreType = #Blocking)

I have used this previous post:
http://list.isis.vanderbilt.edu/pipermail/gme-users/2005-July/000812.htm
l in order to figure out that enums are represented using #.


Regards,
Jesper 



-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/ms-tnef
Size: 19812 bytes
Desc: not available
Url : http://list.isis.vanderbilt.edu/pipermail/gme-users/attachments/20060823/5345c17f/attachment.bin


More information about the gme-users mailing list