Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » oclIstTypeOf and oclIsKindOf
oclIstTypeOf and oclIsKindOf [message #58648] Fri, 13 June 2008 12:22 Go to next message
Timothy Marc is currently offline Timothy MarcFriend
Messages: 547
Registered: July 2009
Senior Member
Hi all,

i've cross-read the OCL Specification and have a question concerning the
functions, mentioned in the subject line.

let's assume, there are a Class A, and a inheritance tree like

X
|->Y
|->Z1
|->Z2

and A has a association of type X with rolename name.

Now i want to check, whether the A.name carries the Type Z2 during
evaluation time. I think i have to write (with context type A):

self.name.oclIsKindOf(Z2) --checks the inheritance tree, whether name is
a type of the inheritance tree of Z2?

But the expression

self.name.oclIsTypeOf(Z2)

will fail, because isTypeOf is equals to the Java equal(Objet obj) method,
taht doesn't care about inheritance, but only about the concrete type.

Is this a correct interpretation?

Cheers,
--Timothy
Re: oclIstTypeOf and oclIsKindOf [message #58672 is a reply to message #58648] Fri, 13 June 2008 13:16 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.zeligsoft.com

--=-tEFYiLRj4p+oym3CubPr
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Hi, Timothy,

The oclIsTypeOf() operation checks whether an object's type is identical
to the specified type. The oclIsKindOf() operation checks whether an
object's type conforms to the specified type. The Java analogues are:

self.name.oclIsKindOf(Z2) <==> this.name instanceof Z2

self.name.oclIsTypeOf(Z2) <==> this.name.getClass() == Z2.class

HTH,

Christian


On Fri, 2008-06-13 at 14:22 +0200, Timothy Marc wrote:

> Hi all,
>
> i've cross-read the OCL Specification and have a question concerning the
> functions, mentioned in the subject line.
>
> let's assume, there are a Class A, and a inheritance tree like
>
> X
> |->Y
> |->Z1
> |->Z2
>
> and A has a association of type X with rolename name.
>
> Now i want to check, whether the A.name carries the Type Z2 during
> evaluation time. I think i have to write (with context type A):
>
> self.name.oclIsKindOf(Z2) --checks the inheritance tree, whether name is
> a type of the inheritance tree of Z2?
>
> But the expression
>
> self.name.oclIsTypeOf(Z2)
>
> will fail, because isTypeOf is equals to the Java equal(Objet obj) method,
> taht doesn't care about inheritance, but only about the concrete type.
>
> Is this a correct interpretation?
>
> Cheers,
> --Timothy
>
>
>

--=-tEFYiLRj4p+oym3CubPr
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.0">
</HEAD>
<BODY>
Hi, Timothy,<BR>
<BR>
The oclIsTypeOf() operation checks whether an object's type is identical to the specified type.&nbsp; The oclIsKindOf() operation checks whether an object's type conforms to the specified type.&nbsp; The Java analogues are:<BR>
<BR>
&nbsp; self.name.oclIsKindOf(Z2)&nbsp; &lt;==&gt;&nbsp; this.name instanceof Z2<BR>
<BR>
&nbsp; self.name.oclIsTypeOf(Z2) &lt;==&gt;&nbsp; this.name.getClass() == Z2.class<BR>
<BR>
HTH,<BR>
<BR>
Christian<BR>
<BR>
&nbsp; <BR>
On Fri, 2008-06-13 at 14:22 +0200, Timothy Marc wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
<FONT COLOR="#000000">Hi all,</FONT>

<FONT COLOR="#000000">i've cross-read the OCL Specification and have a question concerning the </FONT>
<FONT COLOR="#000000">functions, mentioned in the subject line.</FONT>

<FONT COLOR="#000000">let's assume, there are a Class A, and a inheritance tree like</FONT>

<FONT COLOR="#000000">X</FONT>
<FONT COLOR="#000000">|-&gt;Y</FONT>
<FONT COLOR="#000000"> |-&gt;Z1</FONT>
<FONT COLOR="#000000"> |-&gt;Z2</FONT>

<FONT COLOR="#000000">and A has a association of type X with rolename name.</FONT>

<FONT COLOR="#000000">Now i want to check, whether the A.name carries the Type Z2 during </FONT>
<FONT COLOR="#000000">evaluation time. I think i have to write (with context type A):</FONT>

<FONT COLOR="#000000"> self.name.oclIsKindOf(Z2) --checks the inheritance tree, whether name is </FONT>
<FONT COLOR="#000000">a type of the inheritance tree of Z2?</FONT>

<FONT COLOR="#000000">But the expression</FONT>

<FONT COLOR="#000000"> self.name.oclIsTypeOf(Z2)</FONT>

<FONT COLOR="#000000">will fail, because isTypeOf is equals to the Java equal(Objet obj) method, </FONT>
<FONT COLOR="#000000">taht doesn't care about inheritance, but only about the concrete type.</FONT>

<FONT COLOR="#000000">Is this a correct interpretation?</FONT>

<FONT COLOR="#000000">Cheers,</FONT>
<FONT COLOR="#000000">--Timothy</FONT>



</PRE>
</BLOCKQUOTE>
</BODY>
</HTML>

--=-tEFYiLRj4p+oym3CubPr--
Re: oclIstTypeOf and oclIsKindOf [message #58745 is a reply to message #58672] Mon, 16 June 2008 12:54 Go to previous message
Timothy Marc is currently offline Timothy MarcFriend
Messages: 547
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.

------=_NextPart_000_0011_01C8CFC0.F1BF84B0
Content-Type: text/plain;
charset="utf-8"
Content-Transfer-Encoding: quoted-printable

Hi Christian,

thanks again.=20

Timothy

"Christian W. Damus" <cdamus@zeligsoft.com> schrieb im Newsbeitrag =
news:1213363017.6414.18.camel@cwdlappy...
Hi, Timothy,

The oclIsTypeOf() operation checks whether an object's type is =
identical to the specified type. The oclIsKindOf() operation checks =
whether an object's type conforms to the specified type. The Java =
analogues are:

self.name.oclIsKindOf(Z2) <=3D=3D> this.name instanceof Z2

self.name.oclIsTypeOf(Z2) <=3D=3D> this.name.getClass() =3D=3D =
Z2.class

HTH,

Christian

=20
On Fri, 2008-06-13 at 14:22 +0200, Timothy Marc wrote:=20
Hi all,

i've cross-read the OCL Specification and have a question concerning the =

functions, mentioned in the subject line.

let's assume, there are a Class A, and a inheritance tree like

X
|->Y
|->Z1
|->Z2

and A has a association of type X with rolename name.

Now i want to check, whether the A.name carries the Type Z2 during=20
evaluation time. I think i have to write (with context type A):

self.name.oclIsKindOf(Z2) --checks the inheritance tree, whether =
name is=20
a type of the inheritance tree of Z2?

But the expression

self.name.oclIsTypeOf(Z2)

will fail, because isTypeOf is equals to the Java equal(Objet obj) =
method,=20
taht doesn't care about inheritance, but only about the concrete type.

Is this a correct interpretation?

Cheers,
--Timothy




------=_NextPart_000_0011_01C8CFC0.F1BF84B0
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.16674" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi Christian,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>thanks again. </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Timothy</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV>"Christian W. Damus" &lt;<A=20
href=3D"mailto:cdamus@zeligsoft.com">cdamus@zeligsoft.com</A>&gt; =
schrieb im=20
Newsbeitrag <A=20
href=3D"news:1213363017.6414.18.camel@cwdlappy">news:1213363017.6414.18.c=
amel@cwdlappy</A>...</DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">Hi,=20
Timothy,<BR><BR>The oclIsTypeOf() operation checks whether an object's =
type is=20
identical to the specified type.&nbsp; The oclIsKindOf() operation =
checks=20
whether an object's type conforms to the specified type.&nbsp; The =
Java=20
analogues are:<BR><BR>&nbsp; self.name.oclIsKindOf(Z2)&nbsp; =
&lt;=3D=3D&gt;&nbsp;=20
this.name instanceof Z2<BR><BR>&nbsp; self.name.oclIsTypeOf(Z2)=20
&lt;=3D=3D&gt;&nbsp; this.name.getClass() =3D=3D=20
Z2.class<BR><BR>HTH,<BR><BR>Christian<BR><BR>&nbsp; <BR>On Fri, =
2008-06-13 at=20
14:22 +0200, Timothy Marc wrote:=20
<BLOCKQUOTE TYPE=3D"CITE"><PRE><FONT color=3D#000000>Hi all,</FONT>

<FONT color=3D#000000>i've cross-read the OCL Specification and have a =
question concerning the </FONT>
<FONT color=3D#000000>functions, mentioned in the subject line.</FONT>

<FONT color=3D#000000>let's assume, there are a Class A, and a =
inheritance tree like</FONT>

<FONT color=3D#000000>X</FONT>
<FONT color=3D#000000>|-&gt;Y</FONT>
<FONT color=3D#000000> |-&gt;Z1</FONT>
<FONT color=3D#000000> |-&gt;Z2</FONT>

<FONT color=3D#000000>and A has a association of type X with rolename =
name.</FONT>

<FONT color=3D#000000>Now i want to check, whether the A.name carries =
the Type Z2 during </FONT>
<FONT color=3D#000000>evaluation time. I think i have to write (with =
context type A):</FONT>

<FONT color=3D#000000> self.name.oclIsKindOf(Z2) --checks the =
inheritance tree, whether name is </FONT>
<FONT color=3D#000000>a type of the inheritance tree of Z2?</FONT>

<FONT color=3D#000000>But the expression</FONT>

<FONT color=3D#000000> self.name.oclIsTypeOf(Z2)</FONT>

<FONT color=3D#000000>will fail, because isTypeOf is equals to the Java =
equal(Objet obj) method, </FONT>
<FONT color=3D#000000>taht doesn't care about inheritance, but only =
about the concrete type.</FONT>

<FONT color=3D#000000>Is this a correct interpretation?</FONT>

<FONT color=3D#000000>Cheers,</FONT>
<FONT color=3D#000000>--Timothy</FONT>



</PRE></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_0011_01C8CFC0.F1BF84B0--
Previous Topic:query Instance specification
Next Topic:ASTNode - transient positions
Goto Forum:
  


Current Time: Thu Apr 25 12:14:38 GMT 2024

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

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

Back to the top