Paul Duffin | 7fc0b45 | 2015-11-10 17:45:15 +0000 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | package com.google.caliper; |
| 18 | |
| 19 | import com.google.common.annotations.GwtCompatible; |
| 20 | |
| 21 | import java.io.Serializable; |
| 22 | import java.util.HashMap; |
| 23 | import java.util.Map; |
| 24 | |
| 25 | /** |
| 26 | * A description of an environment in which benchmarks are run. |
| 27 | * |
| 28 | * WARNING: a JSON representation of this class is stored on the app engine server. If any changes |
| 29 | * are made to this class, a deserialization adapter must be written for this class to ensure |
| 30 | * backwards compatibility. |
| 31 | * |
| 32 | * <p>Gwt-safe |
| 33 | */ |
| 34 | @SuppressWarnings("serial") |
| 35 | @GwtCompatible |
| 36 | public final class Environment |
| 37 | implements Serializable /* for GWT Serialization */ { |
| 38 | private /*final*/ Map<String, String> propertyMap; |
| 39 | |
| 40 | public Environment(Map<String, String> propertyMap) { |
| 41 | this.propertyMap = new HashMap<String, String>(propertyMap); |
| 42 | } |
| 43 | |
| 44 | public Map<String, String> getProperties() { |
| 45 | return propertyMap; |
| 46 | } |
| 47 | |
| 48 | @Override public boolean equals(Object o) { |
| 49 | return o instanceof Environment |
| 50 | && ((Environment) o).propertyMap.equals(propertyMap); |
| 51 | } |
| 52 | |
| 53 | @Override public int hashCode() { |
| 54 | return propertyMap.hashCode(); |
| 55 | } |
| 56 | |
| 57 | @Override public String toString() { |
| 58 | return propertyMap.toString(); |
| 59 | } |
| 60 | |
| 61 | @SuppressWarnings("unused") |
| 62 | private Environment() {} // for GWT Serialization |
| 63 | } |