maude-help AT lists.siebelschool.illinois.edu
Subject: Maude-help mailing list
List archive
- From: Francisco Duran <duran AT lcc.uma.es>
- To: rechard yin <xiterator AT hotmail.com>
- Cc: maude-help AT peepal.cs.uiuc.edu
- Subject: [Maude-help] Re: [Maude-users] hierachical initialization in maude
- Date: Thu, 10 Feb 2005 11:19:01 +0100
- List-archive: <http://maude.cs.uiuc.edu/pipermail/maude-help>
- List-id: Maude help list <maude-help.maude.cs.uiuc.edu>
Hi Jianfei,
My apologies for the delay. In the future, I recomend using the maude-help mailing list for this kind of questions.
I'm not sure what you mean, but if what you need is messages to initialize (or change) your attributes' values, you just need to add declarations as follows.
(omod A is
inc CONFIGURATION+ .
pr STRING .
class A | str : String .
---- how to build a msg to support initialize the attribute "str"
---- of the object of B
msg to_str_ : Oid String -> Msg . ---- choose your prefered syntax
rl < O:Oid : A:Aid | >
to O:Oid str S:String
=> < O:Oid : A:Aid | str : S:String > .
endom)
An similarly for B...
(omod B is inc CONFIGURATION+ .
pr STRING .
inc A .
class B | age : String .
subclasses B < A .
---- how to build a msg only need explicitly to initialize the attribute
---- "age" of the object of B and invoke A's initialization msg.
msg to_age_ : Oid String -> Msg . ---- choose your prefered syntax
rl < O:Oid : B:Aid | >
to O:Oid age S:String
=> < O:Oid : B:Aid | age : S:String > .
endom)
Cheers,
Paco
rechard yin wrote:
Hi all,
i am wondering that there is a approach to build a hierarchical initialization support in the hierarchy of classes in omod.
so we can use the mechanism of constructors invoking link as that in C++ . The application scene is that
each father class has some attributes, and we only need explicitly set the attributes of the object of leaf class.
(omod A is
inc CONFIGURATION+ .
pr STRING .
class A | str : String .
--- how to build a msg to support initialize the attribute "str" of the object of B
endom)
(omod B is inc CONFIGURATION+ .
pr STRING .
inc A .
class B | age : String .
subclasses B < A .
--- how to build a msg only need explicitly to initialize the attribute "age" --- of the object of B and invoke A's initialization msg.
endom)
Thanks.
Jianfei Yin
_________________________________________________________________
ÏíÓÃÊÀ½çÉÏ×î´óµÄµç×ÓÓʼþϵͳ¡ª MSN Hotmail¡£ http://www.hotmail.com _______________________________________________
Maude-users mailing list
Maude-users AT maude.cs.uiuc.edu
http://maude.cs.uiuc.edu/cgi-bin/mailman/listinfo/maude-users
- [Maude-help] Re: [Maude-users] hierachical initialization in maude, Francisco Duran, 02/10/2005
Archive powered by MHonArc 2.6.16.