Skip to Content.
Sympa Menu

maude-help - Re: [Maude-help] getting attribute's value problem

maude-help AT lists.cs.illinois.edu

Subject: Maude-help mailing list

List archive

Re: [Maude-help] getting attribute's value problem


Chronological Thread 
  • From: Francisco Durán <duran AT lcc.uma.es>
  • To: Petr Vrchlavsky <vrchlavsky.petr AT gmail.com>
  • Cc: maude-help AT cs.uiuc.edu
  • Subject: Re: [Maude-help] getting attribute's value problem
  • Date: Thu, 17 Jan 2013 10:59:43 +0100
  • List-archive: <http://lists.cs.uiuc.edu/pipermail/maude-help/>
  • List-id: <maude-help.cs.uiuc.edu>

Hi Peter,

Remember that you are in a functional world, you define functions operating
on terms.

You want to get the name of an object, whose identifier is given by an Oid.
In Maude you have two sort structures for classes, one for the class
structure (class Car is a subclass of Cid) and object sorts (sort Object and
the sorts you may be interested in adding). Sort Configuration is declared as
a multiset of objects (there might not be two objects with the same id) and
messages.

The getName function should then be defined as

op getName : Oid Configuration ~> String .
eq getName(O:Oid, < O:Oid : C:Car | name : St:String, Ats:AttributeSet >
Conf:Configuration) = St:String .

Best regards,

Francisco


On 16/01/2013, at 01:13, Petr Vrchlavsky wrote:

> Hello, can you please give me an advice or better an example on how to
> retrieve an attribute from an object? Is it even possible? My issue is that
> I would like to compere given data with a given object's attribute. Let say
> that I have a modu like this one below:
>
> (omod CAR is
>
> pr STRING .
> pr NAT .
>
> class Car | name : String, maxspeed : Nat .
>
> endom)
>
> My goal is to have an operation similar to the one below:
>
> op getName : Car -> String .
>
> which would give me the value of the name attribute of the Car class. Is
> there any way how to recieve that information from a class/object? It
> doesnt need to be an operation, it can be an msg or anything that give me
> the capabilities to compare an attribute value against a given value.
>
> Thank you for any response
> Peter V.
> _______________________________________________
> Maude-help mailing list
> Maude-help AT cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/maude-help






Archive powered by MHonArc 2.6.16.

Top of Page