blob: fda696becc7334f0932658531b168f2e64312b3e [file] [log] [blame]
Paul Duffine2363012015-11-30 16:20:41 +00001/*
2 * Copyright (C) 2014 Google Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5 * in compliance with the License. You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software distributed under the License
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11 * or implied. See the License for the specific language governing permissions and limitations under
12 * the License.
13 */
14
15package com.google.caliper.runner;
16
17import java.util.concurrent.Callable;
18
19import javax.inject.Inject;
20
21/**
22 * A ScheduledTrial is a simple pair of a {@link TrialRunLoop} and a
23 * {@link TrialSchedulingPolicy}.
24 */
25@TrialScoped final class ScheduledTrial {
26 private final TrialRunLoop runLoop;
27 private final Experiment experiment;
28 private final TrialSchedulingPolicy policy;
29
30 @Inject ScheduledTrial(Experiment experiment, TrialRunLoop runLoop,
31 TrialSchedulingPolicy policy) {
32 this.runLoop = runLoop;
33 this.experiment = experiment;
34 this.policy = policy;
35 }
36
37 TrialSchedulingPolicy policy() {
38 return policy;
39 }
40
41 Experiment experiment() {
42 return experiment;
43 }
44
45 Callable<TrialResult> trialTask() {
46 return runLoop;
47 }
48}