Subject: | |
From: | |
Reply To: | |
Date: | Mon, 4 Jan 2016 19:50:27 +0100 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
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
|
|
|