what is the beste way to check whether a reference is not null? What i

want to define is a constraint, that if one end of an binary reference

is set, the other side has to be set as well.

Both binary ends have the multiplicity 0 .. 1.

I have two different approaches:

1. context Class1 inv: self.sideA <> null implies self.sideB <> null

2. context Class1 inv: self.sideA.notEmpyt() implies self.sideB.notEmpty()

3. context Class1 inv: self.sideA->size() = 1 implies self.sideB->size() = 1

What is the best approach?!

Thanks Timothy]]>

If you want to test for not-null, testing for not-null seems like a good

approach.

not-empty and not-null are different concepts.

Regards

Ed Willink

Timothy Marc wrote:

> Hey all,

>

> what is the beste way to check whether a reference is not null? What i

> want to define is a constraint, that if one end of an binary reference

> is set, the other side has to be set as well.

>

> Both binary ends have the multiplicity 0 .. 1.

>

> I have two different approaches:

>

> 1. context Class1 inv: self.sideA <> null implies self.sideB <> null

> 2. context Class1 inv: self.sideA.notEmpyt() implies self.sideB.notEmpty()

> 3. context Class1 inv: self.sideA->size() = 1 implies self.sideB->size()

> = 1

>

> What is the best approach?!

>

> Thanks Timothy]]>