MASON-INTEREST-L Archives

June 2015

MASON-INTEREST-L@LISTSERV.GMU.EDU

Options: Use Monospaced Font
Show HTML Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Ernesto Carrella <[log in to unmask]>
Reply To:
MASON Multiagent Simulation Toolkit <[log in to unmask]>
Date:
Sun, 21 Jun 2015 20:55:30 +0000
Content-Type:
multipart/alternative
Parts/Attachments:
text/plain (2698 bytes) , text/html (9 kB)
Missing a } after the super.setInspectors(...); call:

public static void main(String[] args){
    YourSimState state = new YourSimState(1);
    YourGUIState gui = new YourGUIState(state);
    Console c = new Console(gui)
        {
        public void setInspectors(Bag inspectors, Bag names)
            {
            //sort the two bags here!
             super.setInspectors(inspectors, names);
            }
        };
    c.setVisible(true);}




On Sun, Jun 21, 2015 at 9:50 PM Ernesto Carrella <[log in to unmask]>
wrote:

> Dealing with displaying inspectors is one of the many things that the
> Console object does and unfortunately the only way to really modify the way
> inspectors are listed is by subclassing the Console object.
> The easiest way to do it would be as follows. Probably in your main method
> with the GUI looks something like this:
>
> public static void main(String[] args){
>     YourSimState state = new YourSimState(1);
>     YourGUIState gui = new YourGUIState(state);
>     Console c = new Console(gui);
>     c.setVisible(true)}
>
>
> Now you subclass console anonymously like this:
>
> public static void main(String[] args){
>     YourSimState state = new YourSimState(1);
>     YourGUIState gui = new YourGUIState(state);
>     Console c = new Console(gui)
>         {
>         public void setInspectors(Bag inspectors, Bag names)
>             {
>             //sort the two bags here!
>              super.setInspectors(inspectors, names);
>             };
>     c.setVisible(true)}
>
>
> where you provide your sorting behavior where the comment is.
> Notice that you are dealing with two bags, not a LinkedHashMap so you need
> to be extra careful that whatever ordering you assign to the inspector bag
> is also the order you assign to the names bag, but that's really about it.
>
> Ideally you'd like to change the way your display/portrayal calls the
> console's "setInspectors" instead. Unfortunately displays are also pretty
> complicated objects that juggle many responsibilities and you'd have to
> track and override every time they call setInspectors which I think it's
> harder to do.
>
> Hope this helps!
>
>
> On Sun, Jun 21, 2015 at 10:49 AM Axel Kowald <[log in to unmask]>
> wrote:
>
>> Hello Everybody,
>>
>> my simulation progresses and I have several inspectors that are listed
>> in the model tab of the console (for setting parameter values in my
>> model). However, I wonder what controls the order in which the
>> inspectors are listed?  Especially since the ordering can change from
>> one program start to the next !?  Ideally I would like to specify my own
>> order because some parameters belong logically together.
>>
>>     Axel
>>
>> P.S. Also many thanks for the replies to the doLoop question.
>>
>


ATOM RSS1 RSS2