|
Re: OCL constraint [message #533765 is a reply to message #533329] |
Sun, 16 May 2010 20:43 |
Eclipse User |
|
|
|
Originally posted by: Alexander.Igdalov.gmail.com
Hi Esin,
I would recommend you to write this operation in Java. Refer to
"Customizing the Environment" section of the OCL Developer Guide (in
Help) for details.
Your statement
> " not (self.name->includes(' ')) "
doesn't check for spaces but converts a String (i.e. self.name) to a Set
of Strings containing one element (self.name) and attempts to find a
String equal to ' '.
HTH,
- Alex.
esin wrote:
> Hi there,
>
> I have a trouble in an OCL constraint that checks the blank characters
> in a string. I cannot write a constraint using the operations defined on
> OCL String. Following constraint is not working either. Could anyone
> help me?
>
>
> " not (self.name->includes(' ')) "
>
>
> ...
|
|
|
|
Re: OCL constraint [message #533921 is a reply to message #533329] |
Mon, 17 May 2010 13:28 |
|
Hi, all,
A less pleasant-looking alternative to Java is:
(1..self.name.size())->collect(i |
self.name.substring(i, i))->excludes(' ')
which basically includes an expansion of the OCL 2.2 characters() operation.
:-)
Christian
On 13/05/10 08:14 AM, esin wrote:
> Hi there,
>
> I have a trouble in an OCL constraint that checks the blank characters
> in a string. I cannot write a constraint using the operations defined on
> OCL String. Following constraint is not working either. Could anyone
> help me?
>
>
> " not (self.name->includes(' ')) "
>
>
> ...
|
|
|
Re: OCL constraint [message #533935 is a reply to message #533921] |
Mon, 17 May 2010 14:06 |
Eclipse User |
|
|
|
Originally posted by: Alexander.Igdalov.gmail.com
Cool! That's what an expert advice is!
Christian W. Damus wrote:
> Hi, all,
>
> A less pleasant-looking alternative to Java is:
>
> (1..self.name.size())->collect(i |
> self.name.substring(i, i))->excludes(' ')
>
> which basically includes an expansion of the OCL 2.2 characters()
> operation.
>
> :-)
>
> Christian
>
>
> On 13/05/10 08:14 AM, esin wrote:
>> Hi there,
>>
>> I have a trouble in an OCL constraint that checks the blank characters
>> in a string. I cannot write a constraint using the operations defined on
>> OCL String. Following constraint is not working either. Could anyone
>> help me?
>>
>>
>> " not (self.name->includes(' ')) "
>>
>>
>> ...
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.03466 seconds