Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » OCL Set Function to Java Code(Turn a OCL Function into Java Code)
OCL Set Function to Java Code [message #1221990] Thu, 19 December 2013 09:15 Go to next message
Javi Bardo is currently offline Javi BardoFriend
Messages: 1
Registered: December 2013
Junior Member
I have this function in OCL language...

context Board :: set(row : int, col : int, value : int) : int
let square : Square = self.getSquare(row, col) in:
post:
        if not (row>=1 and row<=6 and col>=1 and col<=6 and value>=0 and value<=6 and not
isRepeated(row, col, value))
        then
                result= -1
                square.value = square.value@pre
        else if self.areas->exists(a : Area | not r.isComplete()) then
                result = 0
                square.value = value
        else
                result = 2
                square.value = value
        endif
endif

...and I want to code it in Java but don't know how... Could someone help me please? I'd be very grateful...

Thank you!
Re: OCL Set Function to Java Code [message #1222124 is a reply to message #1221990] Thu, 19 December 2013 18:13 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Looks easy to me. You'll have to elaborate on what you can't do.

Regards

Ed Willink

On 19/12/2013 17:06, Javi Bardo wrote:
> I have this function in OCL language...
>
> context Board :: set(row : int, col : int, value : int) : int
> let square : Square = self.getSquare(row, col) in:
> post:
> if not (row>=1 and row<=6 and col>=1 and col<=6 and value>=0
> and value<=6 and not
> isRepeated(row, col, value))
> then
> result= -1
> square.value = square.value@pre
> else if self.areas->exists(a : Area | not r.isComplete()) then
> result = 0
> square.value = value
> else
> result = 2
> square.value = value
> endif
> endif
>
> ...and I want to code it in Java but don't know how... Could someone
> help me please? I'd be very grateful...
>
> Thank you!
Previous Topic:OCL standard library error : no viable alternative at input 'validating'
Next Topic:Transform OCL into some text
Goto Forum:
  


Current Time: Fri Apr 26 20:36:07 GMT 2024

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

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

Back to the top