MASON-INTEREST-L Archives

January 2019

MASON-INTEREST-L@LISTSERV.GMU.EDU

Options: Use Monospaced Font
Show Text Part by Default
Condense Mail Headers

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

Print Reply
Sender:
MASON Multiagent Simulation Toolkit <[log in to unmask]>
Date:
Tue, 22 Jan 2019 14:17:21 -0500
Reply-To:
MASON Multiagent Simulation Toolkit <[log in to unmask]>
Message-ID:
Subject:
MIME-Version:
1.0
Content-Transfer-Encoding:
7bit
In-Reply-To:
Content-Type:
text/plain; charset="us-ascii"
From:
John Filleau <[log in to unmask]>
Parts/Attachments:
text/plain (58 lines)
Thanks! I'll give this a shot.

John

-----Original Message-----
From: MASON Multiagent Simulation Toolkit
[mailto:[log in to unmask]] On Behalf Of Sean Luke
Sent: Tuesday, January 22, 2019 2:00 PM
To: [log in to unmask]
Subject: Re: Custom Inspector with Domain of Agent Names

There's some overuse of the term volatility, and that's my fault no doubt.
:-)

INSPECTORS can be volatile.  This means that they're updated every time step
[the default].  The alternative is that they're only updated when you press
a "refresh" button.

The underlying PROPERTIES of an object which a SimpleInspector is inspecting
can be "volatile".  This means that every time the SimpleInspector is called
to update itself, it has to rebuild itself from scratch because the
underlying object could have changed in significant ways.  That's what you
want to do.

What I suggest you do is make a subclass of SimpleInspector along these
lines:

public class MySimpleInspector
	{
    public MySimpleInspector(Properties properties, GUIState state, String
name, int maxProperties) 
	{ super(properties, state, name, maxProperties; }

    public boolean needToRebuild(Object myObject)
	{
	// determine if the object has changed and so I need to rebuild
	return true;  // <--- change this
	}

	// this is largely stolen from SimpleInspector, look there to see
    public void updateInspector()
        {
        if (needToRebuild(properties.getObject()))
            {
            remove(propertyList);
            generateProperties(start);
            doEnsuredRepaint(this);
            }
	else super.updateInspector();
        }
    }

The idea is that you don't want to force a rebuild from scratch every
timestep, just when your agent changes his agentNames list or whatever it
was.

Sean

ATOM RSS1 RSS2