From: Max C. <mxc...@sa...> - 2003-08-27 01:07:45
|
One thing you could do is just subclass the revelant RePast classes and do this however you like or just alter the code itself, but then you'd have to include your altered JAR files with your sim. I've done similar things in the past. Hopefully it should be easier with 2.0's replacement of many "private"s with "protected" -max On Tuesday, August 26, 2003, at 07:54 PM, Mark R. Diggory wrote: > I believe that the GUI uses reflection on the model class to determine > if there is a getter/setter for the parameters listed in the String[]. > Parameters can also be primitives, I think the type coversion between > the string representation and the actual type of the parameter is > going on in the Swing GUI via PropertyDescriptors. > > So the getters and setters are very critical to accessing the > parameter. You could write a PropertyDescriptor to get/set the > Parameter to/from the string value represented in the text field. so > you could get the p.value and set the p.value, but you'd still require > "getName/setName" methods. > > maybe at some point a "Map" PropertyDescriptor could be written which > would take a mapping of name--> value pairs and generated a set of GUI > fields to change the value of the entries in the map. I think this > would get closer to what your thinking of. I don't know what the > details of how this would work in relation to batch parameterization. > > -Mark > > p.s. on a side note: when it comes to Java Beans one would usually > write a BeanInfo class to designate which set/get bean methods are > exposed via the Bean API in the inderlying bean class, I wonder > sometimes why this strategy wasn't applied to RePast Models and > instead the String[] approach was used. > > Ian Nunn wrote: > >> To get a parameter to appear in the GUI window, one codes the >> parameter name as a string in a parameter string array, e.g. "name". >> And one builds get and set methods with the name to allow for batch >> modification of values, e.g "public NameType getName() {return name;} >> ". Can one imbed the parameter "name" in a parameter object - call >> it p - and reference the parameter name "p.name" as a string in the >> parameter array for repast to use? I assume Repast is doing some >> string wizardry to build internal references. >> Regards, >> Ian Nunn > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Repast-interest mailing list > Rep...@li... > https://lists.sourceforge.net/lists/listinfo/repast-interest |