blob: c57f5a39a942a805f75e348915bd0a1df3888321 [file] [log] [blame]
Paul Duffin7fc0b452015-11-10 17:45:15 +00001/*
2 * Copyright (C) 2010 Google Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.google.caliper;
18
19/**
20 * Represents an invocation of a benchmark, including the run itself, as well as the environment
21 * in which the run occurred.
22 */
23public final class Result {
24 private /*final*/ Run run;
25 private /*final*/ Environment environment;
26
27 public Result(Run run, Environment environment) {
28 this.run = run;
29 this.environment = environment;
30 }
31
32 public Run getRun() {
33 return run;
34 }
35
36 public Environment getEnvironment() {
37 return environment;
38 }
39
40 @Override public boolean equals(Object o) {
41 return o instanceof Result
42 && ((Result) o).run.equals(run)
43 && ((Result) o).environment.equals(environment);
44 }
45
46 @Override public int hashCode() {
47 return run.hashCode() * 37 + environment.hashCode();
48 }
49
50 @Override public String toString() {
51 return run + "@" + environment;
52 }
53
54 @SuppressWarnings("unused")
55 private Result() {} // for gson
56}