Last change
on this file since 193 was
193,
checked in by Maciej Komosinski, 10 years ago
|
Set svn:eol-style native for all textual files
|
-
Property svn:eol-style set to
native
|
File size:
1009 bytes
|
Line | |
---|
1 | package com.framsticks.experiment; |
---|
2 | |
---|
3 | import java.util.Iterator; |
---|
4 | |
---|
5 | import com.framsticks.params.annotations.FramsClassAnnotation; |
---|
6 | import com.framsticks.util.dispatching.Future; |
---|
7 | import com.framsticks.util.dispatching.FutureHandler; |
---|
8 | import com.framsticks.util.dispatching.JoinableCollection; |
---|
9 | |
---|
10 | @FramsClassAnnotation |
---|
11 | public class SimulatorGroup extends JoinableCollection<SimulatorProvider> implements SimulatorProvider { |
---|
12 | |
---|
13 | @Override |
---|
14 | public String getName() { |
---|
15 | return "simulator group"; |
---|
16 | } |
---|
17 | |
---|
18 | |
---|
19 | @Override |
---|
20 | public void provideSimulator(final SimulatorSpecification specification, final FutureHandler<Simulator> future) { |
---|
21 | final Iterator<SimulatorProvider> iterator = joinables.iterator(); |
---|
22 | |
---|
23 | new Future<Simulator>(future) { |
---|
24 | |
---|
25 | @Override |
---|
26 | protected void result(Simulator result) { |
---|
27 | if (result != null) { |
---|
28 | future.pass(result); |
---|
29 | return; |
---|
30 | } |
---|
31 | if (!iterator.hasNext()) { |
---|
32 | future.pass(null); |
---|
33 | return; |
---|
34 | } |
---|
35 | iterator.next().provideSimulator(specification, this); |
---|
36 | |
---|
37 | } |
---|
38 | }.pass(null); |
---|
39 | |
---|
40 | } |
---|
41 | |
---|
42 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.