|
From: Ivan L. <ila...@se...> - 2003-09-11 13:37:28
|
After some time, I turned back to the issue of PropertyDescriptors. For
testing purposes, I turned to the property descriptors offered by the
original Repast, such as Range and List. For some reason, I can't use them
in agent classes, and I can use them in the model.
I'm working according to the instruction given in the How-to document, and
it works fine for the model class. What I get with agents is a read-only
control in the property dialog, named ParameterDescriptors, of type
Hashtable.
To refresh your memory, I will quote a part of the documentation:
-------------
Assuming your model has a property called "numAgents" that is represented by
an integer. You can tie this property to a RangePropertyDescriptor as
follows:
RangePropertyDescriptor d = new RangePropertyDescriptor("numAgents",
10, 100, 20);
descriptors.put("numAgents", d);
***
The minimum amount of code necessary for an agent to use PropertyDescriptors
follows:
public class MyAgent implements DescriptorContainer {
private Hashtable descriptors = new Hashtable();
public Hashtable getParameterDescriptors() {
return descriptors;
}
}
-------------
It is said in the documentation that this has to be done because the agent
class has to implement the DescriptorContainer interface. This all seems
fine and logical, but doesn't work for me.
Any clues?
Thanks,
Ivan Lazarevic
-----Original Message-----
From: Mark R. Diggory [mailto:mdi...@la...]
Sent: Friday, June 20, 2003 5:59 PM
To: Gulyas Laszlo
Cc: Ivan Lazarevic; rep...@li...
Subject: Re: [Repast-developer] probing properties of collection type
Hey, I've got it in my source tree, its welcome to be integrated into
RePast. I can jar it up as well, if anyone wants it before then.
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/repast-jellytag/repast-jelly-
taglibrary/common/src/java/org/mrd/repast/util/
-M.
Gulyas Laszlo wrote:
>Hi,
>
>Also, a while back Mark Diggory (mdi...@la...) had a
>prototype that could handle arrays, and so on. I don't know what has
>happened to it...
>
>HTH,
>
>gulya
>
>++++++++++++++++++++++++++++++++++++++
>If you can represent the individual elements as strings you can make the
>get/set methods for the collection return a string representation (e.g. "1
>2
>4 5 9") , you can then parse the String in to the individual elements in
>the
>set method. If they can't be represented as strings you'll have to do a
>custom approach.
>
>
>Nick
>
>
>----- Original Message -----
>From: "Ivan Lazarevic" <ila...@se...>
>To: <rep...@li...>
>Sent: Thursday, June 19, 2003 10:24 AM
>Subject: [Repast-developer] probing properties of collection type
>
>
>
>
>
>>I'm trying to use a probe dialog to display an object property which is
>>
>>
>a
>
>
>>collection. Is there a way to do this using the existing probing
>>
>>
>mechanism?
>
>
>>What I achieved so far is a probe dialog saying that my list in not
>>
>>
>empty,
>
>
>>but I couldn't show its members.
>>
>>It crossed my mind that I might have to define my own collection type,
>>
>>
>and
>
>
>>some access methods for it. But then again, what should be the accessor
>>method names, and where are the limits of this approach?
>>
>>Thanks,
>>Ivan Lazarevic
>>
>>
>>
>>
>>
>>
>>
>>-------------------------------------------------------
>>This SF.Net email is sponsored by: INetU
>>Attention Web Developers & Consultants: Become An INetU Hosting Partner.
>>Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
>>INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
>>_______________________________________________
>>Repast-developer mailing list
>>Rep...@li...
>>https://lists.sourceforge.net/lists/listinfo/repast-developer
>>
>>
>>
>
>
>
>
>
--
Mark Diggory
Software Developer
Harvard MIT Data Center
http://www.hmdc.harvard.edu
|