ocl collection [message #56440] |
Fri, 23 May 2008 02:07 |
Eclipse User |
|
|
|
Originally posted by: asma.charfi.com
Hi evrybody
I have a collection and I want to verify if it contains a double or not (is
there an element that occur many times)
so I write this: the collection represent ownedports (the self refer to a
component)
self.ownedPort->asBag()->size()=self.ownedPort->asSet()->size()
if there is a double this constraint fails.
Now, I want to get the element that occur many times . I did not succed in
wrinting the right constraint :(
can so help me
thank you very much
Asma
|
|
|
Re: ocl collection [message #56494 is a reply to message #56440] |
Thu, 22 May 2008 19:43 |
Eclipse User |
|
|
|
Originally posted by: cdamus.zeligsoft.com
--=-joBuOg5MFFIb4svzRMiv
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Hi, Asma,
You should be able to do this to determine whether any element is
repeated:
self.ownedPort->exists(e | self.ownedPort->count(e) > 1)
To get the elements that have multiple occurrences:
self.ownedPort->select(e | self.ownedPort->count(e) > 1)
HTH,
Christian
On Thu, 2008-05-22 at 19:07 -0700, charfi asma wrote:
> Hi evrybody
>
> I have a collection and I want to verify if it contains a double or not (is
> there an element that occur many times)
> so I write this: the collection represent ownedports (the self refer to a
> component)
> self.ownedPort->asBag()->size()=self.ownedPort->asSet()->size()
> if there is a double this constraint fails.
>
> Now, I want to get the element that occur many times . I did not succed in
> wrinting the right constraint :(
>
> can so help me
>
> thank you very much
>
>
>
> Asma
>
>
>
>
--=-joBuOg5MFFIb4svzRMiv
Content-Type: text/html; charset=utf-8
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.16.1">
</HEAD>
<BODY>
Hi, Asma,<BR>
<BR>
You should be able to do this to determine whether any element is repeated:<BR>
<BR>
self.ownedPort->exists(e | self.ownedPort->count(e) > 1)<BR>
<BR>
To get the elements that have multiple occurrences:<BR>
<BR>
self.ownedPort->select(e | self.ownedPort->count(e) > 1)<BR>
<BR>
HTH,<BR>
<BR>
Christian<BR>
<BR>
<BR>
On Thu, 2008-05-22 at 19:07 -0700, charfi asma wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
<FONT COLOR="#000000">Hi evrybody</FONT>
<FONT COLOR="#000000">I have a collection and I want to verify if it contains a double or not (is </FONT>
<FONT COLOR="#000000">there an element that occur many times)</FONT>
<FONT COLOR="#000000">so I write this: the collection represent ownedports (the self refer to a </FONT>
<FONT COLOR="#000000">component)</FONT>
<FONT COLOR="#000000"> self.ownedPort->asBag()->size()=self.ownedPort ->asSet()->size() </FONT>
<FONT COLOR="#000000">if there is a double this constraint fails.</FONT>
<FONT COLOR="#000000">Now, I want to get the element that occur many times . I did not succed in </FONT>
<FONT COLOR="#000000">wrinting the right constraint :(</FONT>
<FONT COLOR="#000000">can so help me</FONT>
<FONT COLOR="#000000">thank you very much</FONT>
<FONT COLOR="#000000">Asma</FONT>
</PRE>
</BLOCKQUOTE>
</BODY>
</HTML>
--=-joBuOg5MFFIb4svzRMiv--
|
|
|
Re: ocl collection [message #56681 is a reply to message #56494] |
Mon, 26 May 2008 05:00 |
Eclipse User |
|
|
|
Originally posted by: asma.charfi.com
This is a multi-part message in MIME format.
------=_NextPart_000_0009_01C8BEB2.C803D690
Content-Type: text/plain;
charset="utf-8"
Content-Transfer-Encoding: quoted-printable
thank you very much Christian :)
but the idea of comparing bag and set size is not too bad :)
Asma
"Christian W. Damus" <cdamus@zeligsoft.com> a =C3=A9crit dans le =
message de news: 1211485381.6120.80.camel@cwdlappy...
Hi, Asma,
You should be able to do this to determine whether any element is =
repeated:
self.ownedPort->exists(e | self.ownedPort->count(e) > 1)
To get the elements that have multiple occurrences:
self.ownedPort->select(e | self.ownedPort->count(e) > 1)
HTH,
Christian
On Thu, 2008-05-22 at 19:07 -0700, charfi asma wrote:=20
Hi evrybody
I have a collection and I want to verify if it contains a double or not =
(is=20
there an element that occur many times)
so I write this: the collection represent ownedports (the self refer to =
a=20
component)
self.ownedPort->asBag()->size()=3Dself.ownedPort->asSet()- >size()
if there is a double this constraint fails.
Now, I want to get the element that occur many times . I did not succed =
in=20
wrinting the right constraint :(
can so help me
thank you very much
Asma
------=_NextPart_000_0009_01C8BEB2.C803D690
Content-Type: text/html;
charset="utf-8"
Content-Transfer-Encoding: quoted-printable
=EF=BB=BF<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; CHARSET=3DUTF-8">
<META content=3D"MSHTML 6.00.6000.20772" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>thank you very much Christian =
:)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>but the idea of comparing bag and set =
size is not=20
too bad :)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Asma</FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Christian W. Damus" <<A=20
href=3D"mailto:cdamus@zeligsoft.com">cdamus@zeligsoft.com</A>> a =
=C3=A9crit dans=20
le message de news: <A=20
=
href=3D"mailto:1211485381.6120.80.camel@cwdlappy">1211485381.6120.80.came=
l@cwdlappy</A>...</DIV>Hi,=20
Asma,<BR><BR>You should be able to do this to determine whether any =
element is=20
repeated:<BR><BR> self.ownedPort->exists(e |=20
self.ownedPort->count(e) > 1)<BR><BR>To get the elements that =
have=20
multiple occurrences:<BR><BR> self.ownedPort->select(e |=20
self.ownedPort->count(e) > =
1)<BR><BR>HTH,<BR><BR>Christian<BR><BR><BR>On=20
Thu, 2008-05-22 at 19:07 -0700, charfi asma wrote:=20
<BLOCKQUOTE TYPE=3D"CITE"><PRE><FONT color=3D#000000>Hi =
evrybody</FONT>
<FONT color=3D#000000>I have a collection and I want to verify if it =
contains a double or not (is </FONT>
<FONT color=3D#000000>there an element that occur many times)</FONT>
<FONT color=3D#000000>so I write this: the collection represent =
ownedports (the self refer to a </FONT>
<FONT color=3D#000000>component)</FONT>
<FONT =
color=3D#000000> self.ownedPort->asBag()->size()=3Dself.ownedPo rt-&g=
t;asSet()->size()</FONT>
<FONT color=3D#000000>if there is a double this constraint fails.</FONT>
<FONT color=3D#000000>Now, I want to get the element that occur many =
times . I did not succed in </FONT>
<FONT color=3D#000000>wrinting the right constraint :(</FONT>
<FONT color=3D#000000>can so help me</FONT>
<FONT color=3D#000000>thank you very much</FONT>
<FONT color=3D#000000>Asma</FONT>
</PRE></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>
------=_NextPart_000_0009_01C8BEB2.C803D690--
|
|
|
Powered by
FUDForum. Page generated in 0.04092 seconds