Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Help with OCL function(Need help with an OCL function)
Help with OCL function [message #1242571] Sun, 09 February 2014 20:20 Go to next message
Pablo Rodríguez is currently offline Pablo RodríguezFriend
Messages: 3
Registered: February 2014
Junior Member
Hi all,

Please I need help with an OCL operation to pass one of my master's subject... I do not know much about OCL language...

What I've to do is next:

Implement the operation:

Server::validMovement(playerName:String, movement:Movement):bool

This operation returns true if and only if exists a game who has one of its players with name playerName, that player would have the attribute hasTurn to true and the game board returns true when calling one operation validMovement(movement)

It's supposed that the operation Board:validMovement(g:Game):bool exists and it's NOT necessary documentary it in OCL

Thank you all in advance... It's very important and urgent to me... Sad
Re: Help with OCL function [message #1242956 is a reply to message #1242571] Mon, 10 February 2014 10:05 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 4187
Registered: July 2009
Senior Member
Hi

I am sorry but it is not my practice to do other people's work for them.

If, after the study that you are expected to do, you have some
legitimate queries then try asking them.

Regards

Ed Willink


On 10/02/2014 00:15, Pablo Rodríguez wrote:
> Hi all,
> Please I need help with an OCL operation to pass one of my master's
> subject... I do not know much about OCL language...
>
> What I've to do is next:
>
> Implement the operation:
>
> Server::validMovement(playerName:String, movement:Movement):bool
>
> This operation returns true if and only if exists a game who has one
> of its players with name playerName, that player would have the
> attribute hasTurn to true and the game board returns true when calling
> one operation validMovement(movement)
>
> It's supposed that the operation Board:validMovement(g:Game):bool
> exists and it's NOT necessary documentary it in OCL
>
> Thank you all in advance... It's very important and urgent to me... :(
Re: Help with OCL function [message #1242963 is a reply to message #1242956] Mon, 10 February 2014 10:18 Go to previous messageGo to next message
Pablo Rodríguez is currently offline Pablo RodríguezFriend
Messages: 3
Registered: February 2014
Junior Member
Hi,

Yes, of course I get it. And for sure I've something that I think it could be in the right way...

context Server:: validMovement(playerName: String, movement: Movement) : boolean
post : result = self.games-> one (g : Game| g.players -> exists (p : Player | p.name=playerName and p.hasTurn=true) and g.board.validMovement(movement))


Thanks all in advance!

Regards
Re: Help with OCL function [message #1243608 is a reply to message #1242963] Tue, 11 February 2014 07:39 Go to previous message
Pablo Rodríguez is currently offline Pablo RodríguezFriend
Messages: 3
Registered: February 2014
Junior Member
Hi

Maybe is this better?

context Server:: validMovement(playerName: String, movement: Movement) : boolean
pre : result = self.games-> forAll (g : Game| g.players -> forAll(p : Player | p.name=playerName and p.hasTurn=true) and g.board.validMovement(movement)=true)



Thanks all in advance!

Regards

[Updated on: Tue, 11 February 2014 07:39]

Report message to a moderator

Previous Topic:Return a set of Tuple in OCLInEcore editor
Next Topic:Recover OCL statement String From OCLExpression Object
Goto Forum:
  


Current Time: Fri Dec 19 08:45:08 GMT 2014

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

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