MASON-INTEREST-L Archives

January 2016

MASON-INTEREST-L@LISTSERV.GMU.EDU

Options: Use Monospaced Font
Show Text 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:
Axel Kowald <[log in to unmask]>
Reply To:
MASON Multiagent Simulation Toolkit <[log in to unmask]>
Date:
Mon, 4 Jan 2016 19:50:27 +0100
Content-Type:
text/plain
Parts/Attachments:
text/plain (28 lines)
Hi,
> Okay, I've just added some tweaks to ParallelSequence to loosen that requirement.  So in general:
>
> 1. You create a ParallelSequence with an existing Collection or array.
>
> 2. Thereafter you can use Sequence's methods to add, remove, or replace steppables.  You can call these methods at any time (in ParallelSequence) as they are synchronized (in ParallelSequence only).
very good, because I think I need this feature!

But playing with the code I think I spotted a bug in the Sequence class.
The Sequence contructor for Collection does not set "size". Thus if I
create my ParallelSequence with a Collection, size is zero, leading to a
division by zero exception.

    public Sequence(Steppable[] steps)
        {
        this.steps = (Steppable[])(steps.clone());
        size = steps.length;
        }
        
    public Sequence(Collection collection)
        {
        steps = new Steppable[collection.size()];
        steps = (Steppable[])(collection.toArray(steps));
        }


Axel

ATOM RSS1 RSS2