public class InMemoryQueue extends Object implements ExperimentQueue
ExperimentQueue interface
that can be used for JUnit tests.| Modifier and Type | Field and Description |
|---|---|
private Deque<ExperimentConfiguration> |
queue |
| Constructor and Description |
|---|
InMemoryQueue() |
| Modifier and Type | Method and Description |
|---|---|
void |
add(ExperimentConfiguration experiment)
Adds the given experiment to the queue.
|
ExperimentConfiguration |
getExperiment(String experimentId)
Retrieves the experiment configuration with the given experiment id.
|
ExperimentConfiguration |
getNextExperiment()
Returns the experiment that should be executed next.
|
List<ExperimentConfiguration> |
listAll()
Returns the list of all experiments waiting in this queue.
|
boolean |
remove(ExperimentConfiguration experiment)
Removes the experiment from the queue.
|
private Deque<ExperimentConfiguration> queue
public ExperimentConfiguration getNextExperiment()
ExperimentQueuegetNextExperiment in interface ExperimentQueuepublic void add(ExperimentConfiguration experiment)
ExperimentQueueadd in interface ExperimentQueueexperiment - the experiment that should be addedpublic boolean remove(ExperimentConfiguration experiment)
ExperimentQueueremove in interface ExperimentQueueexperiment - the experiment that should be removed from the queuetrue if the given experiment has been removedpublic List<ExperimentConfiguration> listAll()
ExperimentQueuelistAll in interface ExperimentQueuepublic ExperimentConfiguration getExperiment(String experimentId)
ExperimentQueuegetExperiment in interface ExperimentQueueexperimentId - the id of the experiment that should be retrievednull if such an experiment
can not be foundCopyright © 2017–2018. All rights reserved.