Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Calling methods with more than one parameter
Calling methods with more than one parameter [message #62284] Mon, 15 September 2008 06:58 Go to next message
Thomas Kurpick is currently offline Thomas Kurpick
Messages: 4
Registered: July 2009
Junior Member
Hi,

ich have an odd behavior in my OCL. I have a recursive method with two
parameters.

def: countContainedTyeMax(countSpecial: Boolean, type : ActivityType):
Integer = [...]

Both parameters do not change during the recursion in my method.

If I evaluate this method, my variable type ist evaluated to true or false,
depending on what my countSpecial variable is set. If I change the position
of my parameters first ActivityType and then Boolean, my countSpecial
variable ist evaluated to the given ActivityType. How could that be? Any
Ideas?

Thanks,
Thomas
Re: Calling methods with more than one parameter [message #62308 is a reply to message #62284] Mon, 15 September 2008 11:16 Go to previous messageGo to next message
Thomas Kurpick is currently offline Thomas Kurpick
Messages: 4
Registered: July 2009
Junior Member
More Information so far:

The Method:

def: calculateCount(oldNumber: Integer, newNumber: Integer): Integer =
if oldNumber >= 0 then
if newNumber = -1 then
-1
else
oldNumber.max(newNumber)
endif
else
oldNumber
endif

This Method should evaluate to 4, when called with calculateCount(1, 4),
evaluates with 1.
I'm using OCL 1.1.2.

Evaluation output:
[OCL] Evaluate: self
[OCL] Result : Testobject
[OCL] Evaluate: 1
[OCL] Result : 1
[OCL] Evaluate: 4
[OCL] Result : 4
[OCL] Evaluate: oldNumber
[OCL] Result : 1
[OCL] Evaluate: 0
[OCL] Result : 0
[OCL] Evaluate: oldNumber.>=(0)
[OCL] Result : true
[OCL] Evaluate: newNumber
[OCL] Result : 1
[OCL] Evaluate: 1
[OCL] Result : 1
[OCL] Evaluate: 1.-()
[OCL] Result : -1
[OCL] Evaluate: newNumber.=(1.-())
[OCL] Result : false
[OCL] Evaluate: oldNumber
[OCL] Result : 1
[OCL] Evaluate: newNumber
[OCL] Result : 1
[OCL] Evaluate: oldNumber.max(newNumber)
[OCL] Result : 1
[OCL] Evaluate: if newNumber.=(1.-()) then 1.-() else
oldNumber.max(newNumber) endif
[OCL] Result : 1
[OCL] Evaluate: if oldNumber.>=(0) then if newNumber.=(1.-()) then 1.-()
else oldNumber.max(newNumber) endif else oldNumber endif
[OCL] Result : 1
[OCL] Evaluate: if oldNumber.>=(0) then if newNumber.=(1.-()) then 1.-()
else oldNumber.max(newNumber) endif else oldNumber endif
[OCL] Result : 1
[OCL] Evaluate: self.calculateCount(1, 4)
[OCL] Result : 1
[OCL] Evaluate: self.calculateCount(1, 4)
[OCL] Result : 1


"Thomas Kurpick" <thomas.kurpick@rwth-aachen.de> schrieb im Newsbeitrag
news:gal12f$hn$1@build.eclipse.org...
> Hi,
>
> ich have an odd behavior in my OCL. I have a recursive method with two
> parameters.
>
> def: countContainedTyeMax(countSpecial: Boolean, type : ActivityType):
> Integer = [...]
>
> Both parameters do not change during the recursion in my method.
>
> If I evaluate this method, my variable type ist evaluated to true or
> false, depending on what my countSpecial variable is set. If I change the
> position of my parameters first ActivityType and then Boolean, my
> countSpecial variable ist evaluated to the given ActivityType. How could
> that be? Any Ideas?
>
> Thanks,
> Thomas
>
Re: Calling methods with more than one parameter [message #62331 is a reply to message #62284] Mon, 15 September 2008 11:36 Go to previous message
Eclipse User
Originally posted by: cdamus.zeligsoft.com

Hi, Thomas,

You will find that this is fixed in the MDT OCL 1.2.1 release and in
recent 1.3 builds, too.

HTH,

Christian


Thomas Kurpick wrote:
> Hi,
>
> ich have an odd behavior in my OCL. I have a recursive method with two
> parameters.
>
> def: countContainedTyeMax(countSpecial: Boolean, type : ActivityType):
> Integer = [...]
>
> Both parameters do not change during the recursion in my method.
>
> If I evaluate this method, my variable type ist evaluated to true or false,
> depending on what my countSpecial variable is set. If I change the position
> of my parameters first ActivityType and then Boolean, my countSpecial
> variable ist evaluated to the given ActivityType. How could that be? Any
> Ideas?
>
> Thanks,
> Thomas
>
>
Previous Topic:Re: Reference to ExpressionInOCL
Next Topic:[Announce] MDT OCL 1.2.2 R1.2.2 is available
Goto Forum:
  


Current Time: Thu Oct 02 04:44:10 GMT 2014

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

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