[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Swarm-Support] FW: 1) Storing a queue in a swarm object (2) Passing
From: |
Paul Johnson |
Subject: |
Re: [Swarm-Support] FW: 1) Storing a queue in a swarm object (2) Passing a variable with a method and inserting it in a ModelSchedule |
Date: |
Tue, 14 Sep 2004 13:24:03 -0500 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.2) Gecko/20040803 |
Mervin Chan wrote:
Hi,
I have some newbie questions. I am primarily doing development on a
Swarm application using Java for my University research project.
My two questions are:
1) Is there any way to add a queue in a Swarm object?
In my application (modeling a manufacturing plant), I have a “Factory”
and many “Product” objects.
Products have different time-stamps to represent the time that they are
created. Once the products are created, I want the Factory to store the
Products in ascending order of their timestamps.
If you just use a Swarm List (or a java list, for that matter) and
addLast the new things, then they will be processed in order.
2) Is there a way to pass a variable together with the method and
then inserting it in a ModelSchedule.
Yes, that's a common thing. I believe every single Swarm model does
that. Don't you find an example like you need in jheatbugs, or
jmousetrap? I wrote a Java version of ElFarol a while ago, you could
look at that. OR the Java version of the Artificial Stock Market you
can grab off http://artstkmkt.sourceforge.net.
If you look in the working examples:
http://www.ku.edu/~pauljohn/SwarmFaq/WorkingExampleCode/java/
I suggest you look at the one Marcus Daniels did FActionArguments.txt
The transition from ObjC to Java was somewhat dicey and Marcus Daniels
worked out some new, more efficient ways to do the "createActionForEach"
and he discussed that new "createFActionForEach" thing in some things
I've saved in the memos directory
http://www.ku.edu/~pauljohn/SwarmFaq/Memos/
All I know is what Marcus taught us on that one. Consult:
http://www.ku.edu/~pauljohn/SwarmFaq/Memos/MarcusJavaCreateActions.txt
http://www.ku.edu/~pauljohn/SwarmFaq/Memos/MarcusJavaCreateActions2.txt
http://www.ku.edu/~pauljohn/SwarmFaq/Memos/MarcusJavaCreateFActions.txt
--
Paul E. Johnson email: address@hidden
Dept. of Political Science http://lark.cc.ku.edu/~pauljohn
1541 Lilac Lane, Rm 504
University of Kansas Office: (785) 864-9086
Lawrence, Kansas 66044-3177 FAX: (785) 864-5700