Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » GMT (Generative Modeling Technologies) » [EVL] Possible Bug with collection comparison
[EVL] Possible Bug with collection comparison [message #383066] Tue, 29 April 2008 14:40 Go to next message
Andrew Lawson is currently offline Andrew LawsonFriend
Messages: 12
Registered: July 2009
Junior Member
I may have discovered a bug which occurs when comparing collections. I
first ran the following validation file...

context SimpleClass!Entity {


constraint CheckingParentExists {

check : self.Child = true implies self.parent-> size = 1

message : 'There is no parent for ' + self.classname

}


constraint CheckChildOperations {

guard: self.Child = true


check : false


message : self.parent.operations->collect(s| s.name) + 'does not have the
correct operations' + self.operations->collect(b|b.name)


}

...which as you would expect returned: " first collection" does not have the
correct operations "second collection"


However when I add in a third constraint which should compare the two
collections (as can be seen below) there is no validation output not even to
the constraint where the check is set to false. Is this a bug or am I doing
something incorrectly? [This used to work correctly]

context SimpleClass!Entity {


constraint CheckingParentExists {

check : self.Child = true implies self.parent-> size = 1

message : 'There is no parent for ' + self.classname

}


constraint CheckChildOperations {

guard: self.Child = true


check : false


message : self.parent.operations->collect(s| s.name) + 'does not have the
correct operations' + self.operations->collect(b|b.name)


}


constraint CheckChildOperations {

guard: self.Child = true


check : self->collect(b|b.operations).includesAll( self.parent->collect(s|
s.operations ))


message : self.classname + 'does not have the correct operations'


}



}
Re: [Epsilon][EVL] Possible Bug with collection comparison [message #383068 is a reply to message #383066] Wed, 30 April 2008 09:46 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi Andrew,

Each constraint in a context must be named uniquely. In your case the
2nd and 3rd constraint have the same name (CheckChildOperations), and
therefore the latter shadows the prior.

A couple of comments: you don't need to use the -> operator; the . does
the same (e.g. you can write x.collect(a|a>0) instead of
x->collect(...)). Also I'm not sure if the self->collect(...) code in
the last constraint makes sense as self is an instance of Entity and
self->collect(b|b.operations) will return a sequence of sequences of
operations (e.g. Sequence{Sequence{op1,op2,op3}} ).

Cheers,
Dimitrios

Andrew Lawson wrote:
> I may have discovered a bug which occurs when comparing collections. I
> first ran the following validation file...
>
> context SimpleClass!Entity {
>
>
> constraint CheckingParentExists {
>
> check : self.Child = true implies self.parent-> size = 1
>
> message : 'There is no parent for ' + self.classname
>
> }
>
>
> constraint CheckChildOperations {
>
> guard: self.Child = true
>
>
> check : false
>
>
> message : self.parent.operations->collect(s| s.name) + 'does not have the
> correct operations' + self.operations->collect(b|b.name)
>
>
> }
>
> ..which as you would expect returned: " first collection" does not have the
> correct operations "second collection"
>
>
> However when I add in a third constraint which should compare the two
> collections (as can be seen below) there is no validation output not even to
> the constraint where the check is set to false. Is this a bug or am I doing
> something incorrectly? [This used to work correctly]
>
> context SimpleClass!Entity {
>
>
> constraint CheckingParentExists {
>
> check : self.Child = true implies self.parent-> size = 1
>
> message : 'There is no parent for ' + self.classname
>
> }
>
>
> constraint CheckChildOperations {
>
> guard: self.Child = true
>
>
> check : false
>
>
> message : self.parent.operations->collect(s| s.name) + 'does not have the
> correct operations' + self.operations->collect(b|b.name)
>
>
> }
>
>
> constraint CheckChildOperations {
>
> guard: self.Child = true
>
>
> check : self->collect(b|b.operations).includesAll( self.parent->collect(s|
> s.operations ))
>
>
> message : self.classname + 'does not have the correct operations'
>
>
> }
>
>
>
> }
>
>
Re: [Epsilon][EVL] Possible Bug with collection comparison [message #615804 is a reply to message #383066] Wed, 30 April 2008 09:46 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi Andrew,

Each constraint in a context must be named uniquely. In your case the
2nd and 3rd constraint have the same name (CheckChildOperations), and
therefore the latter shadows the prior.

A couple of comments: you don't need to use the -> operator; the . does
the same (e.g. you can write x.collect(a|a>0) instead of
x->collect(...)). Also I'm not sure if the self->collect(...) code in
the last constraint makes sense as self is an instance of Entity and
self->collect(b|b.operations) will return a sequence of sequences of
operations (e.g. Sequence{Sequence{op1,op2,op3}} ).

Cheers,
Dimitrios

Andrew Lawson wrote:
> I may have discovered a bug which occurs when comparing collections. I
> first ran the following validation file...
>
> context SimpleClass!Entity {
>
>
> constraint CheckingParentExists {
>
> check : self.Child = true implies self.parent-> size = 1
>
> message : 'There is no parent for ' + self.classname
>
> }
>
>
> constraint CheckChildOperations {
>
> guard: self.Child = true
>
>
> check : false
>
>
> message : self.parent.operations->collect(s| s.name) + 'does not have the
> correct operations' + self.operations->collect(b|b.name)
>
>
> }
>
> ..which as you would expect returned: " first collection" does not have the
> correct operations "second collection"
>
>
> However when I add in a third constraint which should compare the two
> collections (as can be seen below) there is no validation output not even to
> the constraint where the check is set to false. Is this a bug or am I doing
> something incorrectly? [This used to work correctly]
>
> context SimpleClass!Entity {
>
>
> constraint CheckingParentExists {
>
> check : self.Child = true implies self.parent-> size = 1
>
> message : 'There is no parent for ' + self.classname
>
> }
>
>
> constraint CheckChildOperations {
>
> guard: self.Child = true
>
>
> check : false
>
>
> message : self.parent.operations->collect(s| s.name) + 'does not have the
> correct operations' + self.operations->collect(b|b.name)
>
>
> }
>
>
> constraint CheckChildOperations {
>
> guard: self.Child = true
>
>
> check : self->collect(b|b.operations).includesAll( self.parent->collect(s|
> s.operations ))
>
>
> message : self.classname + 'does not have the correct operations'
>
>
> }
>
>
>
> }
>
>
Previous Topic:[EVL] Possible Bug with collection comparison
Next Topic:[TCS] Problem with running TCS
Goto Forum:
  


Current Time: Tue Apr 16 16:50:29 GMT 2024

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

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

Back to the top