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]]>

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

>]]>

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

>

>]]>